tbusch has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm using the CPAN module BerkeleyDB to share several 1 GB hash tables between processes. While the out-of-box behaviour of those hash tables is fairly quick, I was still wondering if anyone knew of some parameters to improve performance. Do you know what to look out for ? And if yes what parameters do I need to change and how ? I'm sure there a lot of options that are not documented in the CPAN module.

Many thanks in advance for any advice.

  • Comment on BerkeleyDB performance tuning using perl API

Replies are listed 'Best First'.
Re: BerkeleyDB performance tuning using perl API
by samtregar (Abbot) on Jul 28, 2006 at 15:52 UTC
    The most important one I know about is CacheSize. A recent change to Geo::PostalCode started setting this to the size of the DB, effectively caching the entire file. The speedup was impressive. Also, if you're using the tied interface you can get a nice bump by switching to OO - tie has a significant overhead in Perl.

    -sam

      I had a look at Geo::PostalCode. Unfortunately they use the old Berkeley DB API called DB_File rather than BerkeleyDB. Do you know how to set the CacheSize with the new API ? It's not mentionned in the doc.
        tbusch,
        It's not mentionned in the doc.

        What docs are you reading? From the synopsis in TFM, [ -CacheSize    => $number, ]

        Cheers - L~R