Berkely DB – many writers, many readers

Eric S. Johansson esj at harvee.org
Sun Jul 10 12:12:13 EDT 2005


Andy Leszczynski wrote:
> 
> I need to now option I open the Berkley DB (both db and env) to have 
> configuration for multiple writers and multiple readers.  Via multiple 
> processes  and multiple threads. No trx needed.

the simple answer is you can't.  bdbm is probably single writer multiple 
reader.  I believe if you use of the the most recent sleepy cat 
database, you have support for multiple readers and writers in any context.

when I did this, I stuck my gdbm database into a multithreaded 
stand-alone process.  I used XML RPC for access and used a per key 
locking mechanism internal to the data storage and retrieval process. 
This locking mechanism set appropriate locks so that a writer for 
specific key would wait for all readers of that key to finish, and block 
all subsequent readers until it was done.

so far is working pretty well but I haven't tried it in a high load 
situation.

---eric




More information about the Python-list mailing list