yowcow / goromdb

Yet another single process KVS server implemented over file-based database
The Unlicense
12 stars 5 forks source link
berkeley-db boltdb golang

Build Status Go Report Card

GOROMDB

Yet another single process KVS server implemented over file-based database.

GOROMDB is a datastore that:

STRUCTURE

                     .---------.
                     | watcher |
                     '----+----'
                          |
        .--------.   .----+----.   .---------.
TCP --> | server +---+ handler +---+ storage |-.
        '----+---'   '----+----'   '---------' | <-- Replacable database
             |            |          '---------'
       .-----+----.   .---+----.
       | protocol |   | loader |
       '----------'   '--------'

HOW TO USE

GOROMDB can be used as an executable binary, or a collection of simple libraries.

Executable Binary

Just do:

go install github.com/yowcow/goromdb

An example of booting GOROMDB with BerkeleyDB database is:

goromdb -addr :11211 -storage bdb -file path/to/bdb-data.db -basedir path/to/store

Note that default compilation of the binary only covers basic features of GOROMDB. If full capability, like namespaced database, and/or multiple database file deployment, is required, craft libraries and build GOROMDB for your own.

GOROMDB does not daemonize itself. Look of other tools to daemonize GOROMDB.

Libraries

Just do:

go get github.com/yowcow/goromdb

and import whatever package into your source code.

BENCHMARK AND PERFORMANCE

GOROMDB should serve fast but maybe not quite as fast as pure memcached. Detailed benchmark is comming up.

DIRECTORY STRUCTURE

When -basedir of /tmp/path/to/dir is specified at boot, GOROMDB creates subdirectories data00 and data01 under /tmp/path/to/dir:

/tmp/path/to/dir
├── db00
└── db01

When -file of /tmp/path/to/dir/data.db is specified at boot, GOROMDB will watch for database file /tmp/path/to/dir/data.db and its MD5 sum file /tmp/path/to/dir/data.db.md5.

When database and MD5 files are placed in directory /tmp/path/to/dir, GOROMDB will verify MD5 sum.

/tmp/path/to/dir
├── data00
├── data01
├── data.db
└── data.db.md5

Once MD5 sum verification succeeds, GOROMDB will move data file into subdirectory either data00 or data01, and load the database into running server.

/tmp/path/to/dir
├── data00
│   └── data.db
└── data01

Placing database and MD5 sum files again will load database into next subdirectory data01 vice versa.