Alternative to BerkeleyDB?

27k Views Asked by At

I'm looking for a dbm-like library that I can use in place of Berkeley DB, which I'm currently using. My main reason for switching is the licensing fees for BDB are pretty high (free for open source apps, but my employer does not want to open source this particular app for various reasons).

I've looked briefly at qdbm but it doesn't look like it will fill my needs -- lots of keys (several million) and large data items (> 1-5 megabytes). Before I continue my search I figured I'd ask because it seems there are tons of dbm-like libraries out there.

9

There are 9 best solutions below

0
On

C/C++

Java

0
On

You could try JDBM. It is a free (Apache 2) key-value store with disk persistence. Simple API and high performance

8
On

SQLite is public domain, meaning you can use it for any purpose whatsoever, and is widely used and supported.

1
On

db4o is pretty cheap and fast but it can only be used with java or .net

2
On

Firebird is your best friend.

0
On

You could look at Tokyo Cabinet. Its the successor to qdbm/gdbm, and if you decide to scale has a nice network front-end available.

Edit:

Another variant is Kyoto Cabinet; developed by the same person, but supposedly easier to use.

0
On

Postgres or HSQLDB and possible even H2 database

1
On

You can get much improved performance out of any dbm (even qdbm) and improved parallelism with a simple level of indirection: Simply take your keys and hash them, and use data_dir/H(key)/ as the database to store those keys. Limit the hash output to a small value (say) 255 for best results.

This approach has a number of benefits, easily summarized:

  • Conceptually simple
  • Easy to implement and test
  • Doesn't lock the entire database for updates
  • Can support much larger databases
  • Easy to replace the DBM component

The hash probably doesn't even need to be cryptographically secure; just mostly uniform. DJB's cdb hash works well in most cases.

0
On

If you are on Windows then you can use the builtin esent database engine. http://blogs.msdn.com/windowssdk/archive/2008/10/23/esent-extensible-storage-engine-api-in-the-windows-sdk.aspx