Ultra fast, persistent database supporting Redis API

Related tags

Database sabledb
Overview

ubuntu-latest-build-and-test macOS-latest

What is SableDb?

SableDb is a key-value NoSQL database that utilizes RocksDb as its storage engine and is compatible with the Redis protocol. It aims to reduce memory costs and increase capacity compared to Redis. SableDb features include Redis-compatible access via any Redis client, up to 64K databases support, asynchronous replication using transaction log tailing and TLS connectivity support.

Oh, and it's written in Rust :)

Building

SableDb is supported on all major OS: Linux, macOS and Windows

Linux /macOS

git clone https://github.com/sabledb-io/sabledb.git
cd sabledb
cargo build --release
cargo test --release

Windows

On Windows, we require MSYS2 terminal for building SableDb.

First, ensure that you have the required toolchain (beside Rust):

pacman -Sy git                                  \
           mingw-w64-clang-x86_64-toolchain     \
           mingw-w64-clang-x86_64-python3       \
           mingw-w64-clang-x86_64-cmake         \
           mingw-w64-clang-x86_64-libffi        \
           unzip                                \
           mingw-w64-clang-x86_64-gcc-compat
git clone https://github.com/sabledb-io/sabledb.git
cd sabledb
CFLAGS="-D_ISOC11_SOURCE" cargo build --release
cargo test --release

Running SableDb

./target/release/sabledb

Usage:

$target/release/sabledb [sabledb.ini]

Docker

docker build -t sabledb:latest .
docker run -p 6379:6379 sabledb:latest

Docker compose

If you prefer to use docker-compose, you can use the following command:

docker compose up --build

Tail logs

To tail the logs, use the below command:

docker exec -it sabledb-sabledb-1 /bin/bash -c "tail -f /var/lib/sabledb/log/sabledb.log.*"

Note: the container name (in the above example: sabledb-sabledb-1) can be found using the command docker ps

Supported features

  • Persistent data using RocksDb - use SableDb as a persistent storage using Redis's API
  • TLS connections
  • Replication using tailing of the transaction log
  • Highly configurable, but comes with sensible default values
  • Use the sb command line utility (target/release/sb) for performance testing
  • Transactions ( MULTI / EXEC )

Benchmark tool - sb

SableDb uses its own benchmarking tool named sb ("SableDb Benchmark"). sb supports the following commands:

  • set
  • get
  • lpush
  • lpop
  • rpush
  • rpop
  • incr
  • ping
  • hset

Run sb --help to get the full help message.

Below is a simple ( ping ) test conducted locally using WSL2 on Windows 10 (same machine is running both SableDb and sb...):

sb progress demo

set test, on the same set-up (local machine, WSL2 on Windows 10):

sb set progress demo

Supported commands

IMPORTANT

SableDb is under constant development, if you are missing a command, feel free to open an issue and visit this page again in couple of days


String commands

Command Supported Fully supported? Comment
append
decr
decrby
get
getdel
getex
getrange
getset
incr
incrby
incrbyfloat
lcs x Does not support: IDX, MINMATCHLEN and WITHMATCHLEN
mget
mset
msetnx
psetex
set
setex
setnx
setrange
strlen
substr

List commands

Command Supported Fully supported? Comment
blmove
blmpop
blpop
brpop
brpoplpush
lindex
linsert
llen
lmove
lmpop
lpop
lpos
lpush
lpushx
lrange
lrem
lset
ltrim
rpop
rpoplpush
rpush
rpushx

Hash commands

Command Supported Fully supported? Comment
hset
hget
hmget
hmset
hgetall
hdel
hlen
hexists
hincrby
hincrbyfloat
hkeys
hvals
hrandfield
hscan
hsetnx
hstrlen

Sorted Set (ZSET) commands

Command Supported Fully supported? Comment
bzmpop
bzpopmax
bzpopmin
zadd
zcard
zincrby
zcount
zdiff
zdiffstore
zinter
zintercard
zinterstore
zlexcount
zmpop
zmscore
zpopmax
zpopmin
zrandmember
zrangebyscore
zrevrangebyscore
zrangebylex
zrevrangebylex
zrange
zrangestore
zrank
zrem
zremrangebylex
zremrangebyrank
zremrangebyscore
zrevrange
zrevrank
zunion
zunionstore
zscore
zscan

Set commands

Command Supported Fully supported? Comment
sadd
scard
sdiff
sdiffstore
sinter
sintercard
sinterstore
sismember
smismember
smembers

Generic commands

Command Supported Fully supported? Comment
del
ttl
exists
expire
keys x Pattern uses wildcard match ( ? and * )

Server management commands

Command Supported Fully supported? Comment
info SableDb has its own INFO output format
ping
replicaof
slaveof
command
command docs x
flushall
flushdb
dbsize Data is accurate for the last scan performed on the storage

Transaction

Command Supported Fully supported? Comment
multi
exec
discard
watch
unwatch

Connection management commands

Command Supported Fully supported? Comment
client id
client kill x supports: client kill ID <client-id>
select
ping

Benchmarks

Command set

Payload size (bytes) rps p50 (ms) p90 (ms) p99 (ms)
64 448K 1.127 1.279 1.423
128 420K 1.199 1.375 1.551
256 363K 1.375 1.567 1.799

Command get

Payload size (bytes) rps p50 (ms) p90 (ms) p99 (ms)
64 950K 0.495 0.671 1.087
128 907K 0.511 0.695 1.111
256 905K 0.519 0.711 1.119

Command mset

Note: Each mset command is equivalent of 10 set commands

Payload size (bytes) rps p50 (ms) p90 (ms) p99 (ms)
64 116K 3.8 4.6 6.3
128 72K 6.375 7.039 54.111
256 41.5K 0.432 7.279 226.943

Command incr

The increment command is unique because it uses a "read-modify-update" in order to ensure the atomicity of the action which in a multi-threaded environment causes a challenge

Payload size (bytes) rps p50 (ms) p90 (ms) p99 (ms)
N/A 443K 1.127 1.295 1.383

Network only (ping command)

Command rps pipeline p50 (ms) p90 (ms) p99 (ms)
ping_inline 1.05M 1 0.407 0.775 1.143
ping_inline 6.65M 20 0.855 1.551 1.815
ping_mbulk 1.05M 1 0.399 0.727 1.127
ping_mbulk 7.96M 20 0.807 1.471 1.711

Command executions can be seen here

You might also like...
Basic Redis Protocol specification in Rust

Basic Redis Protocol specification in Rust

Rewrite Redis in Rust for evaluation and learning.

Drill-Redis This library has been created for the purpose of evaluating Rust functionality and performance. As such, it has not been fully tested. The

Redis compatible server framework for Rust
Redis compatible server framework for Rust

Redis compatible server framework for Rust Features Create a fast custom Redis compatible server in Rust Simple API. Support for pipelining and telnet

A port of `java.util.*SummaryStatistics` as a Redis Module

RedisNumbersStats RedisNumbersStats is a Redis module that implements a Redis version of the Java Util *SummaryStatistics classes, such as DoubleSumma

An intentionally-limited Rust implementation of the Redis server with no external dependencies.

lil-redis An intentionally-limited Rust implementation of the Redis server. lil redis is an accessible implementation of a very basic Redis server (wi

Macros for redis-rs to serialize and deserialize structs automatically

redis-macros Simple macros and wrappers to redis-rs to automatically serialize and deserialize structs with serde. Installation To install it, simply

A cross-platform redis gui client

Redis-Manager A cross-platform redis gui client started developing with Tauri, React and Typescript in Vite. Get Started Prerequisites Install Node.js

📺 Netflix in Rust/ React-TS/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Kafka, Redis, Tokio, Actix, Elasticsearch, Influxdb Iox, Tensorflow, AWS
📺 Netflix in Rust/ React-TS/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Kafka, Redis, Tokio, Actix, Elasticsearch, Influxdb Iox, Tensorflow, AWS

Fullstack Movie Streaming Platform 📺 Netflix in RUST/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Spark, Kafka, Redis,

Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe
Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe

redi-rs (or redirs) redi-rs is a Lightweight Redis client with connection pooling written in Rust and 100% memory safe redi-rs is a Redis client writt

Comments
  • Support for hashes, sets, and sorted sets

    Support for hashes, sets, and sorted sets

    Please support hash commands, sorted sets, and sets. I personally use hashes more than lists in my apps, and would be nice to have an alternative to ssdb since that project has stalled.

    Missing commands 
    opened by alanhamlett 14
  • Build Errors: Release: redis::Value scope

    Build Errors: Release: redis::Value scope

    Building the release version produced the following errors ...

    error[E0599]: no variant or associated item named `Data` found for enum `redis::Value` in the current scope
       --> sdb-cli/src/main.rs:177:16
        |
    177 |         Value::Data(ref val) => {
        |                ^^^^ variant or associated item not found in `Value`
    
    error[E0599]: no variant or associated item named `Bulk` found for enum `redis::Value` in the current scope
       --> sdb-cli/src/main.rs:182:16
        |
    182 |         Value::Bulk(ref values) => {
        |                ^^^^ variant or associated item not found in `Value`
    
    error[E0599]: no variant or associated item named `Status` found for enum `redis::Value` in the current scope
       --> sdb-cli/src/main.rs:201:16
        |
    201 |         Value::Status(ref s) => {
        |                ^^^^^^ variant or associated item not found in `Value`
    
    For more information about this error, try `rustc --explain E0599`.
    error: could not compile `sdb-cli` (bin "sdb-cli") due to 3 previous errors
    

    cargo & rustc v1.79.0

    opened by cenote-dev 3
A simplified version of a Redis server supporting SET/GET commands

This is a starting point for Rust solutions to the "Build Your Own Redis" Challenge. In this challenge, you'll build a toy Redis clone that's capable

Patrick Neilson 2 Nov 15, 2022
A Redis module that provides rate limiting in Redis as a single command.

redis-cell A Redis module that provides rate limiting in Redis as a single command. Implements the fairly sophisticated generic cell rate algorithm (G

Brandur Leach 1.1k Jan 6, 2023
A Distributed SQL Database - Building the Database in the Public to Learn Database Internals

Table of Contents Overview Usage TODO MVCC in entangleDB SQL Query Execution in entangleDB entangleDB Raft Consensus Engine What I am trying to build

Sarthak Dalabehera 38 Jan 2, 2024
RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

Qovery 145 Nov 23, 2022
Redis re-implemented in Rust.

rsedis Redis re-implemented in Rust. Why? To learn Rust. Use Cases rsedis does not rely on UNIX-specific features. Windows users can run it as a repla

Sebastian Waisbrot 1.6k Jan 6, 2023
Redis library for rust

redis-rs Redis-rs is a high level redis library for Rust. It provides convenient access to all Redis functionality through a very flexible but low-lev

Armin Ronacher 2.8k Jan 8, 2023
RedisJSON - a JSON data type for Redis

RedisJSON RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating a

null 3.4k Jan 1, 2023
A rust Key-Value store based on Redis.

Key-Value Store A Key-Value store that uses Redis to store data. Built using an async web framework in Rust with a full Command-Line interface and log

Miguel David Salcedo 0 Jan 14, 2022
[POC] Redis Module for TiKV

RedisTikvPoc [POC] Redis Module for TiKV This is a POC repository. This Redis Module will add branch new Redis commands to operate TiKV data. After bu

Rain Li 6 Jun 25, 2022
Incomplete Redis client and server implementation using Tokio - for learning purposes only

mini-redis mini-redis is an incomplete, idiomatic implementation of a Redis client and server built with Tokio. The intent of this project is to provi

Tokio 2.3k Jan 4, 2023