SSDB

SSDB is a NoSQL database implemented in C++. The goal of SSDB is to substitute, or work together with Redis. It is compatible with Redis APIs, and has a larger storage space than Redis. SSDB supports multiple data structures, including key-value pairs, hashmap, sorted set, and list. Its low-level storage engine is based on Google LevelDB. SSDB supports a wide range of programming languages.

History

SSDB was originally an individual open-source project. It was started by Zuyang Wu in 2013, aiming to work as an alternative for Redis. Most of the features were implemented in 2013 and 2014. The last update to SSDB was one year ago. Currently, SSDB is used in many productive environments to replace Redis, including several well-known companies and startups.

Data Model

Key/Value

SSDB supports four main data types, which are key-value, hashmap, sorted set, and list. The key-value data type is used to store data with no strong relations. The hashmap is used to store data in different sets with counting and sorting based on the key value. Sorted set sorts all entries based on a score integer, and unlike key-value and hashmap, it cannot be used to store large data. List stores data in the queue structure.

Query Compilation

Not Supported

No query compilation is found in SSDB.

Storage Architecture

Disk-oriented

SSDB is a disk-oriented database. The key difference between Redis and SSDB is that Redis uses mainly in-memory storage while SSDB stores data in the disk. Therefore, SSDB can store 100 times data in Redis for each node.

Logging

Logical Logging

SSDB supports logical logging for its operations. It has multiple logging levels. The log file will change its name and create a new log file when exceeding the size limitation.

Stored Procedures

Not Supported

Indexes

Skip List Log-Structured Merge Tree

SSDB uses LevelDB as its storage engine. SSDB explicitly calls LevelDB's interfaces to insert, update, and delete data. In LevelDB, a Log-Structured Merge Tree is used for indexes. Log-Structured Merge Tree provides a higher write throughput than the B+ tree. For each write operation, it first writes to a data structure called memtable, which will be flushed to disk later. In a memtable, LevelDB uses Skip List to find a position.

Concurrency Control

Not Supported

SSDB does not support concurrency control, because operations are executed individually, and there is no transaction. However, unlike Redis, SSDB supports multi-threads to avoid write operations blocking read operations (since 1.5.2). All write operations are executed in a single thread while read operations are executed in other threads.

Joins

Not Supported

Join operations are not supported based on the document.

Compression

Dictionary Encoding

SSDB supports data compression using Snappy. Snappy is an open-source data compression library developed by Google. It is used in both Google's internal tools and several famous open-source databases, including Cassandra, MongoDB, and LevelDB. SSDB naturally supports Snappy as it uses LevelDB for low-level storage. In LevelDB, developers should explicitly set parameters to use Snappy in the compile time. Since version 1.6.2, SSDB has changed this feature by directly integrating the source code of Snappy to the project. By default, SSDB will use Snappy, but users can explicitly choose to use a non-compression version. SSDB with Snappy compression is compatible with non-compression data.

Storage Model

N-ary Storage Model (Row/Record)

SSDB uses the storage model in LevelDB, where data is saved in sorted key-value pairs.

Checkpoints

Non-Blocking

SSDB provides the ssdb-dump tool for checkpointing and recovery. It also supports export and import commands to save and restore the database from the client side.

System Architecture

Shared-Nothing

SSDB is a single-node database management system. Initially, the server does not share anything with other nodes. However, as SSDB supports Redis API, developers can directly use Twemproxy to manage a number of SSDB servers. Besides, it is also workable to use the combination of Redis and SSDB.

Query Execution

Tuple-at-a-Time Model

SSDB implements three separate iterator classes for key-value, hashmap, and sorted set.

Query Interface

Custom API Command-line / Shell

Firstly, SSDB supports a set of shell commands to execute queries. Secondly, SSDB provides custom APIs for a wide range of programming languages, including C#, C++, Erlang, Go, Java, Lua, PHP, Python, Ruby, and Swift. Besides, developers can use the Redis client to connect the server with Redis Serialization Protocol. The command set of SSDB is similar to that in Redis.

Storage Organization

Log-structured

SSDB uses the LevelDB storage, whose key organization is the log-structured merge tree.

SSDB Logo
Website

http://ssdb.io/

Source Code

https://github.com/ideawu/ssdb

Tech Docs

http://ssdb.io/docs/

Developer

Zuyang Wu

Country of Origin

CN

Start Year

2013

Project Type

Open Source

Written in

C++

Supported languages

C#, C++, Erlang, Go, Java, Lua, PHP, Python, Ruby, Swift

Embeds / Uses

LevelDB

Compatible With

Redis

Operating Systems

BSD, iOS, Linux, OS X, Windows

Licenses

BSD