[erlang-questions] Building edtk and bdb

Matt Stancliff <>
Fri Oct 12 22:03:41 CEST 2007

On Oct 12, 2007, at 14:36, Chris Newcombe wrote:

> Matt Stancliff sent me an 'installer' script a while back which does
> the download and applies some patches to remove the absolute paths.

   There's a newer version of the edtk+bdb installer at http:// 

   The new version has nicer options and you can easily compile the bdb
driver natively if you like.  (If you haven't looked, edtk has five  
and my install script will download everything and built it for you.)

   Note -- edtk+bdb does not work under OS X.  To get it working with
OS X, gsl and sfl need to be modified (quick #define fixes) and then
something else busts which I never got around to fixing.
   If you get edtk+bdb building under OS X, I would love to see your

   With all the talk of BDB recently on the mailing list, I'd like to
share some benchmarks I have.  I have a generic BDB/Mnesia compatibility
layer, but it's fairly slow compared to raw BDB or mnesia access:

Tests for entire record DB reading/writing:
Test                    5.5.5 BEAM        Per second
mnesia_dirty_read          1.00            123055.2  (123k)
mnesia_dirty_read_idx      4.04            30451.4   (30k)
mnesia_read_idx            4.16            29570.7   (29k)
mnesia_read                4.27            28836.8   (28k)
mnesia_dirty_write         4.91            25060.5   (25k)
mnesia_write               16.56           7431.8    (7k)
mnesia_dirty_wrte_with_idx 17.03           7224.9    (7k)
mnesia_write_with_idx      27.93           4405.6    (4k)
bdb_record_read            91.3            1347.8    (1k)
bdb_record_read_idx        124.36          989.5     (0.9k)
bdb_record_write           156.15          788       (0.7k)
bdb_record_write_idx       340.41          361.5     (0.3k)

Tests for caching methods:
Test                    5.5.5 BEAM        Per second
ets_read                   1.00            613379.3  (613k)
mnesia_mem_read            1.61            380888.9  (380k)
process_per_cache_item     9.09            67509.4   (67k)
bdb_plain_read             25.09           24449.5   (24k)
bdb_record_read            452.70          1354.9    (1k)

My bdb_record functions act like mnesia functions.  You can do:
   - bdb:write_record(#person{name = bob, age = 23})
   - bdb:read(person, bob) => [#person{name = bob, age = 23}]
Those functions involve a lot of term_to_binary and binary_to_term

The bdb_plain_read test is raw BDB reading with a known binary
key (no term conversions).

Note:  Even though my BDB record reading is 450x slower
than reading from ets, I still get over 1300 read/s.


Matt Stancliff            
AIM: seijimr              iPhone: 678-591-9337
"The best way to predict the future is to invent it." --Alan Kay

More information about the erlang-questions mailing list