Mike Perham

On Ruby, software and the Internet

Berkeley DB and Ruby

December 3rd, 2007 · 5 Comments

I’ve been working with Berkeley DB in Ruby to do some prototyping of a scalable metric store for FiveRuns. In theory it’s a great toolkit. Rather than using a generic relational database, you can build the exact structures and functionality required to store/retrieve your data. So far, my impression is that the API is ugly compared to a typical Ruby API (bitmask configuration, for one) and can be difficult to debug. Neither is a showstopper though and I certainly do like the fact that it has a long history of success behind it.

To do this I’ve had to work with the BDB ruby binding. Unfortunately it’s pretty crufty C code and doesn’t have any mailing list or community around it at all. I found an alternative binding which is much smaller; I’m going to test it out tomorrow.

Anyone out there have experience with BDB and Ruby? Any advice or experiences to share?

Tags: Ruby

5 responses so far ↓

  • 1 Gregory Burd // Dec 4, 2007 at 8:23 pm

    Mike,

    We’d like to make Berkeley DB easier to use, especially for Ruby (and other scripting language) users. I’d be open to working with you, or anyone else in the Ruby space, to learn how better to integrate DB into Ruby programming. We’ve done this for Java programmers with the “Direct Persistence Layer (DPL)” for use with the Berkeley DB Java Edition. Java programmers seem to find it much better, more familiar, and it doesn’t require “messy bit-masks”. As for experts in DB and Ruby, contact my old friend Jim Menard (www.io.com/~jimm/).

    -greg

    Gregory Burd
    Product Manager, Berkeley DB/JE/XML – Oracle Corporation

  • 2 Jamal Abdou-Karim Bengeloun // Sep 25, 2008 at 3:26 pm

    Did something come throught out of all those experiments? Like a drop in replacement for sqlite in rails?

  • 3 mperham // Sep 25, 2008 at 3:29 pm

    No, BDB is several layers lower than sqlite. You’d need to write a lot of code to replace sqlite.

  • 4 Jamal Abdou-Karim Bengeloun // Sep 26, 2008 at 7:38 am

    Too bad (I thought they were alike)! Did you get any performance improvements that would justify “lots of code” compare to say using a RDBMS like MySQL or PostgreSQL?

  • 5 Mike Perham // Sep 26, 2008 at 8:23 am

    There are incredible performance improvements to be had but you don’t get a lot of the features an RDBMS would provide, like a schema and data types. It’s really good if you just have a Hash or Tree of data you want to be persistent.

Leave a Comment