Getting started with RocksDB in Ruby

If you haven’t already heard about RocksDB and you are doing some heavy computations, you definitely should try it out. It is a key-value NoSQL database designed to store its data in memory and on SSD drives. It is built by Facebook on top of LevelDB codebase. It is fast and persistent and, for example, is uses as storage backend for CockroachDB.

This is a general story. But how about using it from Ruby? Well, there is a gem, but it’s not actively maintained and even does not compile with more recent versions of RocksDB.

Fortunately, there is also a good news. I have to use RocksDB for a data processing task at Boostcom and as a result of that I created a fork designed to support recent versions of RocksDB plus some additional features not implemented in original gem (for now it’s only support for CompactRange function).

So, to get started, just put this in your Gemfile:

gem 'rocksdb-ruby', github: 'Boostcom/rocksdb-ruby', branch: 'next'

You also need to have RocksDB development libs installed for the gem to compile. On macOS, just brew install rocksdb, on recent Ubuntu versions - apt-get install librocksdb-dev.

Want to know more?

I definitely recommend reading How To Sound Like You Know RocksDB if you want to know why RocksDB is so cool, so fast, so reliable etc.

Related posts