Hello,

 

Using BerkeleyDB in Perl 5.8.8 on a FreeBSD system, I am applying its tied

hashes inside forked children of a daemon, as a means of IPC. This works

great, except that for every child, when it forks, I currently set the

environment and initialize the databases, like:

 

if (not eval {$env = new BerkeleyDB::Env

        -Cachesize => 16777216,

        -Home      => '/var/db/Berkeley',

        -Flags     => DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL}) {

    log_error ((($_ = $BerkeleyDB::Error) ? ($_) : ($!)));

} elsif (not eval {tie %whitelisted, 'BerkeleyDB::Hash',

 

....

 

Etc. I wonder, is this really necessary? For one, I'm thinking it wreaks

havoc on the Cache, as re-initializing a cache for each child seems rather

pointless under these circumstances. Could I not just tie these databases

in the parent once, and then reuse them per child? I know for MySQL

connections this certainly goes wrong.

 

My main point just is, that I would like the retain the use of a shared

Cache, among the forking children. If anyone knows how to do such a thing,

I'd appreciate hearing about it.

 

Thanks.

_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to