ObjectDB ObjectDB

Server vs embedded mode in multi-instance scenario


We are creating a web app that will have multiple different clients, each on their own EC2 instance(s). The clients do not need to share any data, so each could have its own ObjectDB. Clients have a user base of about 2,000 to 60,000 users that could possibly be using their application at any given time (100k absolute maximum). We will probably have multiple instances per client for availability concerns as well as auto scale during peak usage, at least for the benefit of our web application if not for objectdb. Its a standard web app with an average amount of data being fetched per page view.

I see two ways to integrate objectdb: first, since during 99% of the time there will only be one active instance of the app, use embedded mode inside the web application itself. Then if we ever have to boot up another instance, we can point objectdb of those new instances at the first instance as slaves (they have their own read-only version, but writes are pushed to the master). Am I understanding this correctly?

Our second option would be to have a separate objectdb server that handles connections from multiple instances. But from what I can tell, there will be about a 50% performance drop from using Server mode to accommodate the <1% of use scenarios. However (at least from a traditional database background) this split would help ObjectDB and our webapp stop competing for system resources (cpu time, memory, etc). Is that a valid concern? The graphs on your site would seem to say otherwise, with such a big performance improvement for embedded mode, but maybe that has a limit. Is there a guideline as to system requirements for certain loads on ObjectDB?

Would you recommend an embedded or server mode for our scenario? Are there concerns that I'm missing such as availability, bad SPOF issues, or security that would make you advise one way or the other?


Usually embedded mode is faster than client-server mode and preferred when possible. But since both modes share the same API, you can easily check and compare both with your application.

There is an undocumented feature that allows using a combined embedded-server mode, in which the database is accessed in embedded mode by the main user (e.g. the web application) but is still accessible by other clients.

You may enable it by adding the embedded-server element to the configuration:

        <connection port="6136" max="100" />
        <data path="$objectdb/db" />
        <embedded-server enabled="true" />

Now you should be able to open the same database in "embedded mode" by several processes. The first one will use the database in real embedded mode and will start a private server. All the other processes will connect to that server.

To enable connection to the database from other machines - the first process should use a url such as: test.odb;port=3333 (specifying a port).

All the other processes should be able to connect to the database remotely using that port, e.g. by objectdb://localhost:3333/.


ObjectDB Support

Can you please elaborate a little more on the best way to configure the server when using a combined embedded-server mode?

What I am wanting to do is run a master in embedded mode with multiple remote slaves replicating the db and I was hoping I could also run the slave apps in embedded mode while doing this.

The part that i'm not sure about is if I need to worry about resources on the stand-alone(non-embedded) servers given the embedded server will be the one doing all the work and the stand-alone servers are essentially just doing the replication between master and slaves.

Ideally I could just replicate from within embedded mode but I understand this feature is not available(yet?), so I am trying to find a work around that will allow me to run in embedded mode on all nodes while being able to replicate the db's still. I just don't want to double the resources required to do this because I am running two instances of the db on each server.


This is not supported yet, since replication requires ordinary servers (and not embedded servers).

ObjectDB Support



Whats the full connection URL that i should pass to the persistance.xml to connect ODB server started in embedded mode?


From #2 above:

"To enable connection to the database from other machines - the first process should use a url such as: test.odb;port=3333 (specifying a port).

All the other processes should be able to connect to the database remotely using that port, e.g. by objectdb://localhost:3333/."

i.e. the full client-server connection url should be "objectdb://host:port/" with no path.

host could be localhost.

In order to have a port number you have to specify a port when you open the database in embedded mode, by adding a port parameter (;port=3333) to the url.

ObjectDB Support


To post on this website please sign in.