kv-hash, a new key-value store

At OCamlLabs/Tarides, I have been working on kv-hash (https://github.com/tomjridge/kv-hash), a replacement for irmin/index (https://github.com/mirage/index)

The original index code implements a key-value store. New key-values are written first to a log, and then when the log is large it is merged into the main data store, and a new log is started. The performance is good initially, but deteriorates over time (essentially because the entire store needs to be written whenever the log is merged into the store). 

kv-hash is an alternative, where the performance remains constant over time, and where the merge duration in particular is fast and constant. In our tests, this avoids various issues with off-the-shelf solutions such as LMDB, RocksDB, SQLite etc.

  • LMDB is great, providing the active set of keys fits in memory; if it doesn't, the use of an mmap means that performance degrades quite significantly
  • RocksDB has amazing write performance, but the relatively poor read performance meant that overall RocksDB was not competitive with the existing index during our tests
  • SQLite seems to suffer from deteriorating write performance: inserts into a table seem to take time that is proportional to the table size, whereas we would hope for (at least) performance to degrade as the logarithm of the size; this means that the performance of an SQLite solution would not be satisfactory.
Further documentation about kv-hash can be found in the "Documentation.md" file in the github repository.

Comments

Popular posts from this blog

The Economics of Writing (Good) Code Documentation

A model of file update

What is so special about cross-directory rename of a directory?