Skip to content
Database server based on leveldb storage engine
Latest commit 95edbfd Feb 11, 2016 @srinikom Update README.textile
Failed to load latest commit information.
clients/py 0.1.0 commit Nov 22, 2011
.gitignore ignore more stuff Nov 23, 2011
README.textile Update README.textile Feb 11, 2016 attempt to shut the workers down gracefully Nov 23, 2011
license.txt 0.1.0 commit Nov 22, 2011



  • Async leveldb server and client based on zeromq
  • Storage engine leveldb
  • Networking library zeromq
  • We use leveldb-server at Safebox


New BSD license. Please see license.txt for more details.


  • Very simple key-value storage
  • Data is sorted by key – allows range queries
  • Data is automatically compressed
  • Can act as persistent cache
  • For our use at Safebox it replaced memcached+mysql
  • Simple backups cp -rf level.db backup.db
  • Networking/wiring from zeromq messaging library – allows many topologies
  • Async server for scalability and capacity
  • Sync client for easy coding
  • Easy polyglot client bindings. See zmq bindings
>>> db.put("k3", "v3")
>>> db.get("k3")
>>> db.range()
'[{"k1": "v1"}, {"k2": "v2"}, {"k3": "v3"}]'
>>> db.range("k1", "k2")
'[{"k1": "v1"}, {"k2": "v2"}]'
>>> db.delete('k1')

Will be adding high availability, replication and autosharding using the same zeromq framework.


python 2.6+ (older versions with simplejson)

Getting Started

Instructions for an EC2 Ubuntu box.

Installing zeromq

tar xvfz zeromq-2.1.10.tar.gz
cd zeromq-2.1.10
sudo ./configure
sudo make
sudo make install

Installing pyzmq

tar xvfz pyzmq-2.1.10.tar.gz
cd pyzmq-2.1.10/
sudo python configure --zmq=/usr/local/lib/
sudo python install

Installing leveldb and pyleveldb

svn checkout py-leveldb-read-only
cd py-leveldb-read-only
sudo python install

Starting the leveldb-server

> python -h
	-p [port and host settings] Default: tcp://
	-f [database file name] Default: level.db


  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -p HOST, --host=HOST  
  -d DBFILE, --dbfile=DBFILE
> python

Using the leveldb-client-py

> cd clients/py/
> sudo python install
> python 
>>> from leveldbClient import database
>>> db = database.leveldb()
>>> db.get("Key")
>>> db.put("K", "V")
>>> db.range()
>>> db.range(start, end)
>>> db.delete("K")


> cp -rpf level.db backup.db

Known issues and work in progress

Would love your pull requests on

  • Benchmarking and performance analysis
  • client libraries for other languages
  • [issue] zeromq performance issues with 1M+ inserts at a time
  • [feature] timeouts in client library
  • [feature] support for counters
  • [feature] limit support in range queries
  • Serializing and seperate threads for get/put/range in leveldb-server
  • HA/replication/autosharding and possibly pub-sub for replication


Thanks to all the folks who have contributed to all the dependencies. Special thanks to pyzmq/examples/mongo* author for inspiration.

Something went wrong with that request. Please try again.