DEV Community

Chaimaa Zegoumou
Chaimaa Zegoumou

Posted on

KVS implementation in C++ : A series - Finding inspo (1)

Since a lot of KVS (key-value stores, settling on this acronym) already exist, It’d be interesting to look at previously developed models, to get some inspiration.

Examples of KVS :

DBM
Berkeley DB
Kyoto Cabinet
Memcached and MemcacheDB
LevelDB
MongoDB
Redis
OpenLDAP
SQLite

Requirements for our KVS :

  • KVS designed for OOP
  • everything will be on-disk
  • network access to data store
  • no ACID properties necessarily
  • no need for a query engine

Small intros to available KVS :

Berkeley DB : implemented in C, is an open source embedded (runs in the same address as the app, no inter-process comm for database operations) database library for scalable, high-performance, transaction-protected data management services to apps.

Kyoto Cabinet : implemented in C++, implements a hash table a B+ tree and other DS,but performance changes if the database’s size goes above a limit (ooooof course).

LevelDB: implemented in C++, implements a LSM (log-structured merge tree, which are optimized for SSD drives). For more than one million entries, performance drops. Clear source code though, and for a personal project, we don’t require a heavy load so that’s fine.

Redis : implemented in C, it supports different types of values, not just string values. It’s implemented using hash tables for big sets, for smaller ones however, arrays are used. Its code is very clear and it’s well documented (see github repo)

Top comments (0)