hanoidb/README.md

105 lines
4 KiB
Markdown
Raw Permalink Normal View History

# HanoiDB Indexed Key/Value Storage
2012-01-07 16:54:35 +00:00
2014-11-20 22:11:51 +00:00
[![Build Status](https://travis-ci.org/krestenkrab/hanoidb.svg?branch=master)](https://travis-ci.org/krestenkrab/hanoidb)
HanoiDB implements an indexed, key/value storage engine. The primary index is
a log-structured merge tree (LSM-BTree) implemented using "doubling sizes"
persistent ordered sets of key/value pairs, similar is some regards to
[LevelDB](http://code.google.com/p/leveldb/). HanoiDB includes a visualizer
which when used to watch a living database resembles the "Towers of Hanoi"
puzzle game, which inspired the name of this database.
2012-01-05 23:02:00 +00:00
## Features
2012-05-07 15:22:55 +00:00
- Insert, Delete and Read all have worst case *O*(log<sub>2</sub>(*N*)) latency.
2012-04-26 15:12:37 +00:00
- Incremental space reclaimation: The cost of evicting stale key/values
is amortized into insertion
2012-04-24 14:37:45 +00:00
- you don't need a separate eviction thread to keep memory use low
- you don't need to schedule merges to happen at off-peak hours
- Operations-friendly "append-only" storage
- allows you to backup live system
- crash-recovery is very fast and the logic is straight forward
- all data subject to CRC32 checksums
- data can be compressed on disk to save space
- Efficient range queries
- Riak secondary indexing
- Fast key and bucket listing
2012-04-24 14:37:45 +00:00
- Uses bloom filters to avoid unnecessary lookups on disk
- Time-based expiry of data
- configure the database to expire data older than n seconds
- specify a lifetime in seconds for any particular key/value pair
2012-04-24 14:37:45 +00:00
- Efficient resource utilization
- doesn't store all keys in memory
- uses a modest number of file descriptors proportional to the number of levels
- I/O is generally balanced between random and sequential
- low CPU overhead
2012-04-24 14:37:45 +00:00
- ~2000 lines of pure Erlang code in src/*.erl
HanoiDB is developed by Trifork, a Riak expert solutions provider, and Basho
Technologies, makers of Riak. HanoiDB can be used in Riak via the
`riak_kv_tower_backend` repository.
2012-04-26 15:12:37 +00:00
2012-04-28 16:42:04 +00:00
### Configuration options
2012-05-07 15:22:55 +00:00
Put these values in your `app.config` in the `hanoidb` section
2012-04-28 16:42:04 +00:00
```erlang
2012-05-07 15:22:55 +00:00
{hanoidb, [
{data_root, "./data/hanoidb"},
%% Enable/disable on-disk compression.
%%
{compress, none | gzip},
2012-05-11 10:30:20 +00:00
%% Expire (automatically delete) entries after N seconds.
%% When this value is 0 (zero), entries never expire.
%%
{expiry_secs, 0},
2012-05-07 15:22:55 +00:00
%% Sync strategy `none' only syncs every time the
%% nursery runs full, which is currently hard coded
%% to be evert 256 inserts or deletes.
%%
%% Sync strategy `sync' will sync the nursery log
%% for every insert or delete operation.
%%
2012-04-28 16:42:04 +00:00
{sync_strategy, none | sync | {seconds, N}},
2012-05-07 15:22:55 +00:00
%% The page size is a minimum page size, when a page fills
%% up to beyond this size, it is written to disk.
%% Compression applies to such units of page size.
%%
{page_size, 8192},
2012-05-07 15:22:55 +00:00
%% Read/write buffer sizes apply to merge processes.
%% A merge process has two read buffers and a write
%% buffer, and there is a merge process *per level* in
%% the database.
%%
{write_buffer_size, 524288}, % 512kB
{read_buffer_size, 524288}, % 512kB
%% The merge strategy is one of `fast' or `predictable'.
%% Both have same log2(N) worst case, but `fast' is
%% sometimes faster; yielding latency fluctuations.
%%
{merge_strategy, fast | predictable},
%% "Level0" files has 2^N KVs in it, defaulting to 1024.
%% If the database is to contain very small KVs, this is
%% likely too small, and will result in many unnecessary
%% file operations. (Subsequent levels double in size).
{top_level, 10} % 1024 Key/Values
2012-04-28 16:42:04 +00:00
]},
```
2012-09-12 10:16:29 +00:00
### Contributors
- Kresten Krab Thorup @krestenkrab
- Greg Burd @gburd
- Jesper Louis Andersen @jlouis
- Steve Vinoski @vinoski
- Erik Søe Sørensen, @eriksoe
- Yamamoto Takashi @yamt
2012-09-25 09:31:27 +00:00
- Joseph Wayne Norton @norton