dbTalk Databases Forums  

multi process berkeley-db I don't want it to cache anything

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss multi process berkeley-db I don't want it to cache anything in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
elie
 
Posts: n/a

Default multi process berkeley-db I don't want it to cache anything - 07-24-2006 , 03:08 PM






Hello,

I am using Berkely DB with 2 processes ( one to read and one to write).
they listen to message ques and do thier work according to some rules.

my problem is that.
the reading program is caching the database, it reads fine what the
database had when the it started, but the updates to the database, (by
the writing process) do not show up.
if i restart the reading process it will read the new data OK. but will
not get any updates.

so I think that my reading process is caching what the database had
when it started. can someone tell me how to turn off that feature?

i've tried, setting the cache size to the minimum size,
/* TODO set the page size 16K maybe
if ((ret = dbp->set_pagesize(dbp, 1024)) != 0) {
dbp->err(dbp, ret, "set_pagesize");
}
*/
and i've tried the DB_NOMMAP flag.
open_flags = DB_CREATE | DB_NOMMAP;


Reply With Quote
  #2  
Old   
Klaas
 
Posts: n/a

Default Re: multi process berkeley-db I don't want it to cache anything - 07-24-2006 , 04:31 PM






elie wrote:
Quote:
I am using Berkely DB with 2 processes ( one to read and one to write).
they listen to message ques and do thier work according to some rules.
You do not have to worry about synchronization/caching if you are using
an evironent. Are you using an environment (without DB_PRIVATE)?

-Mike



Reply With Quote
  #3  
Old   
elie
 
Posts: n/a

Default Re: multi process berkeley-db I don't want it to cache anything - 07-24-2006 , 06:25 PM




no I'm not using an enviromnet, I'll give that a try.

Klaas wrote:
Quote:
elie wrote:
I am using Berkely DB with 2 processes ( one to read and one to write).
they listen to message ques and do thier work according to some rules.

You do not have to worry about synchronization/caching if you are using
an evironent. Are you using an environment (without DB_PRIVATE)?

-Mike


Reply With Quote
  #4  
Old   
AndiKox
 
Posts: n/a

Default Re: multi process berkeley-db I don't want it to cache anything - 08-01-2006 , 09:49 AM



Hi elie,

First of all it would be good to know if you decided on using an
enviroment, if so how did you configure your enviroment when opened
using DB_ENV->open method, what flags did you specify and let us know
if you use transactions.

Please be aware that if you use DB_PRIVATE flag on your enviroment,
this Env may only be accessed by a single process (which can be
multithreaded). You should not specify this flag if more than a single
process will be accessing the enviroment; you will most likely cause
database corruption and encounter an unpredictable behavior. With
DB_PRIVATE you don't need to do all the work involved by
flushing/syncing the cache, since you use only the heap memory.

So, in your case, you should use system shared memory, specifying
DB_SYSTEM_MEM or the filesystem, by not specifying any memory-related
flag to the DB_ENV->open method. For further clarification you can
review this link http://www.sleepycat.com/docs/ref/env/region.html

If you are not using an enviroment and you don't have an in-memory
database you should use the DB->sync method
(http://www.sleepycat.com/docs/api_c/db_sync.html) to periodically
flush the cache content to the disk. Similarly, in case you use an
enviroment (transactions also) not configured with DB_PRIVATE, you
should use the db_checkpoint utility or implement your own checkpoint
utility using the DB_ENV->txn_checkpoint function
(http://www.sleepycat.com/docs/ref/tr...eckpoint.html).
These two methods assure that updates are written on disk, so you can
find them when accessing through the reader process.

Setting the cache size to a minimum size has no effect; you will
probably still have there cached key/data pairs.
The DB_NOMMAP flag on DB->open method implies the use of enviroments;
you can further check this aspect on
http://www.sleepycat.com/docs/api_c/..._mmapsize.html.

Hope this info will help you in solving this issue, regards,

Andrei Costache, Oracle Corporation


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.