db4o client/server appears to only be able to process one query at a time?

你离开我真会死。 提交于 2019-12-22 04:12:34

问题


We're evaluating db4o (an OO-DBMS from http://www.db4o.com). We've put together a performance test for client/server mode, where we spin up a server, then hammer it with several clients at once. It seems like the server can only process one client's query at a time.

Have we missed a configuration switch somewhere that allows for this scenario? Server implementation is below. The client connects, queries (read-only), and disconnects per operation, and operations run one immediately after the other from several worker threads in the client process. We see same behaviour if we spin up one client process with one worker each against the same server.

Any suggestions?

Edit: We've now discovered, and tried out, the Lazy and Snapshot QueryModes, and although this alleviates the blocking server problem (partially), we still see significant concurrency problems when our clients (we run 40 concurrent test-clients that wait 1-300ms before issuing a random operation-request) hammer on the server. There appear to be exceptions emanating from the LINQ provider and from the IO internals :-(

public class Db4oServer : ServerConfiguration, IMessageRecipient
{
    private bool stop;

    #region IMessageRecipient Members

    public void ProcessMessage(IMessageContext con, object message)
    {
        if (message is StopDb4oServer)
        {
            Close();
        }
    }

    #endregion

    public static void Main(string[] args)
    {
        //Ingestion.Do();
        new Db4oServer().Run(true, true);
    }

    public void Run(bool shouldIndex, bool shouldOptimizeNativeQueries)
    {
        lock (this)
        {
            var cfg = Db4oFactory.NewConfiguration();
            if (shouldIndex)
            {
                cfg.ObjectClass(typeof (Sequence))
                               .ObjectField("<ChannelID>k__BackingField")
                               .Indexed(true);
                cfg.ObjectClass(typeof (Vlip))
                               .ObjectField("<ChannelID>k__BackingField")
                               .Indexed(true);
            }
            if (shouldOptimizeNativeQueries)
            {
                cfg.OptimizeNativeQueries(true);
            }

            var server = Db4oFactory.OpenServer(cfg, FILE, PORT);
            server.GrantAccess("0", "kieran");
            server.GrantAccess("1", "kieran");
            server.GrantAccess("2", "kieran");
            server.GrantAccess("3", "kieran");
            //server.Ext().Configure().ClientServer().SingleThreadedClient(false);
            server.Ext().Configure().MessageLevel(3);
            server.Ext().Configure().Diagnostic().AddListener(new DiagnosticToConsole());
            server.Ext().Configure().ClientServer().SetMessageRecipient(this);
            try
            {
                if (!stop)
                {
                    Monitor.Wait(this);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            server.Close();
        }
    }

    public void Close()
    {
        lock (this)
        {
            stop = true;
            Monitor.PulseAll(this);
        }
    }
}

回答1:


Well, there is something on the db40 servers that doesn't allow too many clients on at a time since it is too much for some to handle. You also locked it which did nothing to help in this case.



来源:https://stackoverflow.com/questions/226681/db4o-client-server-appears-to-only-be-able-to-process-one-query-at-a-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!