![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Your title in your question is asking how to create an in-memory database in Berkeley DB. Documentation for how create a RAM only database can be found here: http://www.sleepycat.com/docs/ref/program/ram.html In your message you ask about how to pre-load a file backed database in cache. At least that is what I think you are asking. In order to do that you should create a cache large enough to hold the database and create a cursor that will walk the database. You can use the DB_MULTIPLE flag to make this go faster. For more information: http://www.sleepycat.com/docs/api_cxx/dbc_get.html Ron |
#4
| |||
| |||
|
|
thanks for your reply. acturally i am using OpenLdap which takes berkeley-db as its backend db. and for performance reason i want to read all entries in memory when startup .but i dont know whether i can do it , could you give me some advise ? |
#5
| |||
| |||
|
|
"William" <W (AT) abc (DOT) com> writes: thanks for your reply. acturally i am using OpenLdap which takes berkeley-db as its backend db. and for performance reason i want to read all entries in memory when startup .but i dont know whether i can do it , could you give me some advise ? I think that OpenLdap developers will be vastly more competent to help you with this idea. Or talk you out of it, if appropriate. Berkeley DB, as far as I know, does not contain an application-independant "magically pull everything into RAM as fast as possible" knob. |
#6
| |||
| |||
|
|
But something that may be almost as good is to define a BDB cache that resides in shared memory. If the BDB cache is large enough to contain all of the data, then once the database is primed everything will stay in memory; on the next application startup it will still be there. |
#7
| |||
| |||
|
|
Howard Chu <XYZ.hyc (AT) highlandsun (DOT) com> writes: But something that may be almost as good is to define a BDB cache that resides in shared memory. If the BDB cache is large enough to contain all of the data, then once the database is primed everything will stay in memory; on the next application startup it will still be there. If the OS is worth its pagecache algorithms, the data in the backing file will be there just as well. |
|
A file backed shared memory segment, as is usually used for the cache, is practically identical in handling to the backing file itself. |
#8
| |||
| |||
|
|
A file backed shared memory segment, as is usually used for the cache, is practically identical in handling to the backing file itself. There is a marked performance boost on Solaris using SysV shared memory regions instead of shared mmap'd files for the BDB cache. The difference on Linux is unmeasurable, but not everybody runs Linux. There are probably many other platforms where the difference is also significant; you don't have enough information to make such definitive statements. |
![]() |
| Thread Tools | |
| Display Modes | |
| |