Using db4o with multiple application instances under medium trust
- by Anders Fjeldstad
I recently stumbled over the object database engine db4o which I think looks really interesting. I would like to use it in an ASP.NET MVC application that will be deployed to a shared hosting environment under medium trust. Because of the trust level, I'm restricted to using db4o in embedded/in-process mode.
That in itself should be no problem, but the hosting provider also transparently runs each web application in multiple (load-balanced) server instances with shared storage, which I would say is normally a very nice feature for a $10/month hoster. However, since an instance of a db4o server with write access (whether in-process or networked) locks the underlying database file, having multiple instances of the application using the same file won't work (or at least I can't see how it would).
So the question is: is it possible to use db4o in this specific environment?
I have considered letting each application have its own database which is synchronized with a master database using replication (dRS), but that approach will most likely end up with very frequent bi-directional replication (read master changes at beginning of each request, write to master after each change) which I don't think will be very efficient.
Summary of the web application/environment characteristics:
Read-intensive (but not entirely read-only)
Some delay (a few seconds) is acceptible between the time that a change is made and the time when the change shows up in all the application instances' data
Must run in medium trust
No guarantee that the load-balancer uses "sticky sessions"
All suggestions are much appreciated!