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

1

8

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);
        }
    }
}
Roguish answered 22/10, 2008 at 16:56 Comment(5)
Please visit the db4o forums so we can work out a solution.Immure
You wasting time dude.. let's say everything would work top notch 100%... is your evaluation going to conclude to disband SQL and entity framework in favor of db4o? truly sorry to be annoying.. its just that I've been there before. db4o must support all aspects of the C# language with no limitation whatsoever or forfeit the battle.Unconsidered
@Unconsidered You saw this question was asked in 2008, right?Roguish
@PeterMounce lol.. why did it show on top of my list? btw what was your conclusion - I'm really curious :)Unconsidered
@Unconsidered we concluded at the time that we weren't being paid to write a database server, and I think ended up reverting to using a relational database with an ORM on top. The project was short-lived.Roguish
N
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.

Nitwit answered 23/4, 2013 at 1:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.