On Monday 03 July 2006 08:33, John Buckman wrote: > One of the reasons I want to use Berkeley DB is that I'd like every > web page string to be a BDB database lookup, allowing wiki-style > correcting of strings on a web page (ie, anyone can correct, on the > spot, any translated text on any page). SQL just wouldn't work with > that design, with a dozen or so db lookups per page.
So the design requires a number of queries, too many for responsive performance from an SQL database. However, if you use the BDB database, you will still have to go through some sort of database API, either the one which exists, or a custom designed API. The purpose of the built in API is to share connections across threads and even virtual servers, but it isn't really suited for simple key/value lookup. If the number of key/value pairs is small, everything could be loaded into memory, into an nsv_array. If the number of key/value pairs is large, then the solution is to load pairs into memory only on first use. Maybe a high-use cache could be developed and pre-loaded on server startup. If the cache will eventually grow too large, then ns_cache could be used to expire stale data. Maybe BDB doesn't have the option to unload memory mapped regions. If this is true, then ns_cache would be the better choice to control memory usage. But none of these solutions deals with how the key/value pairs are added to the database and distributed to one or more AOLservers. At some point there has to be a single master list of these pairs. Loading all these into memory, or into a BDB or DJB cdb requires only one SQL query. You can even do one query to write the database on the master, then distribute this with rsync or whatever to replace the old database. Overall, it seems like BDB or cdb would have the same memory requirements of an nsv array, but they require some kind of API to get to this memory. Since it is just key/value pairs, this API overhead is a total waste: you have to use it even when the data is already in memory. tom jackson -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.