wangtengchuan / swapdb

https://github.com/JingchengLi/swapdb/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swapdb

A redis compatiable storage which support data exchange between memory and disk, so you can save a lot of memory cost by using swapdb compared to redis. the main thought of swapdb is, keep hot keys in redis and cold keys in disk, when a key in disk becomes hot, will load it to redis, when a key in memory becomes cold, will transfter it to disk. by using swapdb, you can have both a high preformance cache and high capacity KV storage.

Documentation

中文文档

Fundamental

fundamental

Features

  • Heat statistics of keys(LFU)
  • Configurable threshold of RAM/FLASH capacity
  • Redis API compatiable(99%). supports data structures such as strings, hashes, lists, sets, sorted sets
  • Cluster management(redis cluster)
  • Multiple replica nodes and data replication support(RDB+Snapshot)
  • Data persistency support
  • High performance and high capacity redis-like storage

Compile

requirements:

CMake >= 3.1
GCC >= 4.8

Get the source code

git clone https://github.com/JRHZRD/swapdb.git --recursive

Let's build

(you can skip this step if you add '--recursive' option when 'git clone'.) for submodules update process.

git submodule update --init --recursive
cmake . && make -j8

Quick start

you can quickly start a swap-redis and swap-ssdb instance like this:

cd utils
# this will use the default "6379" port for swap-redis and "26379" port for swap-ssdb.
./deploy_redis.sh
# or you can specify a specific port like this, for example, use "6380" port
# ./deploy_redis.sh 6380

redis-cli -p 6379
127.0.0.1:6379> set a b
OK
127.0.0.1:6379> locatekey a
"redis"
127.0.0.1:6379> storetossdb a
OK
127.0.0.1:6379> locatekey a
"ssdb"
127.0.0.1:6379> get a
"b"
127.0.0.1:6379> dumpfromssdb a
OK
127.0.0.1:6379> locatekey a
"redis"

Applicable scenes

  • cache

swapdb support LFU based heat statistics, hot keys are kept in redis,so you can use swapdb as cache, which has the same performance as redis when access hot keys.

  • High capacity redis-like KV storage

By configuring a low threshold of RAM/FLASH capacity, most of the data will be stored in disk and only the hottest data stored in redis.

About

https://github.com/JingchengLi/swapdb/wiki

License:BSD 2-Clause "Simplified" License


Languages

Language:C 40.3%Language:C++ 30.8%Language:Tcl 11.8%Language:Python 8.9%Language:HTML 2.9%Language:Perl 1.2%Language:Makefile 0.8%Language:Shell 0.7%Language:M4 0.6%Language:Ruby 0.5%Language:CMake 0.3%Language:COBOL 0.3%Language:Roff 0.2%Language:Objective-C 0.2%Language:PHP 0.1%Language:GAP 0.1%Language:XSLT 0.1%Language:Lua 0.1%Language:CSS 0.0%Language:Batchfile 0.0%Language:Smarty 0.0%