LedisDB is a NoSQL database written in Go. It is similar to Redis and implements redis protocol. It can be used as a replacement of Redis. However, it uses RocksDB, LevelDB or goleveldb as storage engine. Therefore, unlike Redis, the storage is not limited by memory. The name LedisDB comes from Level-Redis-DB.[04][05]
- Website
- http://ledisdb.com[01]
- Source Code
- https://github.com/ledisdb/ledisdb[02]
- Developer
- Country of Origin
- CN
- Start Year
- 2014 [19]
- End Year
- 2020
- Project Type
- Open Source
- Written in
- Go
- Supported Languages
- C, Go, JavaScript, Lua, Python
- Inspired By
- SSDB
- Compatible With
- Redis
- License
- MIT License
LedisDB is a NoSQL database written in Go. It is similar to Redis and implements redis protocol. It can be used as a replacement of Redis. However, it uses RocksDB, LevelDB or goleveldb as storage engine. Therefore, unlike Redis, the storage is not limited by memory. The name LedisDB comes from Level-Redis-DB.[04][05]
History[06]
In 2014, Chinese programmer Siddon Tang was developing an application which depended on Redis heavily. He noticed that as the number of users of the application increased, the memory size was not enough for Redis. He found that SSDB could solve the problem. SSDB implements redis protocol using LevelDB as storage. This design inspired him. Finally, LedisDB, a database similar to SSDB but written in Go was developed.
The motivation for LedisDB was to (1) reimplement SSDB's idea in Go rather than C++ and (2) provide vehicle for learning LevelDB and Redis.
The project was last updated in 2020 and is considered abandoned.
Checkpoints[07]
LedisDB provides two command line tool: ledis-dump and ledis-load, for taking a checkpoint and restoring from a checkpoint, which depends on the storage engine's mechanism. LedisDB also uses that internally for synchronization between master and replica. No other way to access the checkpoint mechanism is found.
Compression[08][09]
Compression is disabled by default. The compression feature of the storage engine can be enabled via configuration. Data and index blocks are compressed individually. User can choose from a list of supported compression algorithms, like LZ4 and Snappy. Data are decompressed when LedisDB retrieves them from the underlying storage engine.
Concurrency Control[10]
There is no concurrency control protocol in LedisDB because it does not support transactions. Like Redis, LedisDB processes requests as command sequences. Each command is treated as a single atomic operation. However, LedisDB does not provide any mechanism to combine commands into transactions.
Data Model[11]
LedisDB is a key/value store but has rich data structures. In addition to simple key/value pair, it provides Hash, List, Set, ZSet. ZSets are sorted sets in Redis, every element is also associated with a score (a floating point value). They are ordered by score and use their own value to break the tie.
Indexes[07]
LedisDB does not make its own indexes, it just uses underlying storage engines' index data structure, which is the Log-Structured Merge Tree. They also use Skip List in the MemTable part.
Logging[12]
LedisDB has its own write-ahead log. It logs write operations in its log first, before committing the changes in the storage engine.
Query Execution[14]
For queries that involve multiple key-value pairs, LedisDB uses iterators to access and process key-value pairs one-by-one.
Query Interface[11][10]
LedisDB can be embedded in Go programs and programs can use its API to perform queries. LedisDB also provides a query interface in redis protocol called RESP(REdis Serialization Protocol), and can be queried via redis-cli. LedisDB has HTTP API support too.
Storage Architecture[07]
LedisDB uses RocksDB, LevelDB or goleveldb as storage engine and thus inherits their storage architecture. It also provides an option to use memory-backed storage (via goleveldb).
Storage Organization[07]
All storage engines of LedisDB use Log-structured storage organization, but LedisDB does not leverage anything specific for that.
Stored Procedures[15]
LedisDB does not support stored procedures, but like Redis, it provides the capability to evaluate scripts using the bulit-in Lua interpreter. Scripts will be cached by LedisDB and can be invoked from the cache later. However, they are just cached rather than stored.
System Architecture[16][17][18][12]
LedisDB can be embedded in Go programs.
It can also be used as an independent server.
Multiple LedisDB nodes and coordinator nodes can form a cluster with partition and Master-Replica replication.
Each server does not share anything with others and only communicates with each other through the network connection.
LedisDB provides a SLAVEOF command thus a LedisDB server can be configured as a master node or a replica of some master node on the fly.
It also provides a PING command for checking whether a server is alive. LedisDB cluster needs a group of dedicated coordinators (redis-failover)
that use this two commands to monitor and manage the Master-Replica groups. LedisDB is Active-Passive, logs are continuously streamed from master to replicas.
Both asynchronous and semi-synchronous propagation schemes are supported.
To support partition, another group of coordinators (xcodis) is needed, which serve as proxies that dispatch requests to different Master-Replica groups based on partition.
LedisDB does physical partition based on the hash of a key.
Unfortunately, in GitHub issue, the developer states that he will not maintain this part anymore, because he does not have enough time.
For more detail, you can see this article about LedisDB cluster written by the developer.
Citations
19 sources- http://ledisdb.com ledisdb.com
- GitHub - ledisdb/ledisdb: A high performance NoSQL Database Server powered by Go · GitHub github.com
- Home · ledisdb/ledisdb Wiki · GitHub github.com
- GitHub - ledisdb/ledisdb: A high performance NoSQL Database Server powered by Go · GitHub github.com
- 高性能nosql ledisdb设计与实现(1)_siddontang-CSDN博客 csdn.net
- 发布一个参考ssdb,用go实现的类似redis的高性能nosql:ledisdb_golang 类似redis-CSDN博客 csdn.net
- GitHub - ledisdb/ledisdb: A high performance NoSQL Database Server powered by Go · GitHub github.com
- ledisdb/etc/ledis.conf at master · ledisdb/ledisdb · GitHub github.com
- Compression · facebook/rocksdb Wiki · GitHub github.com
- Commands · ledisdb/ledisdb Wiki · GitHub github.com
- GitHub - ledisdb/ledisdb: A high performance NoSQL Database Server powered by Go · GitHub github.com
- https://medium.com/@siddontang/build-up-a-high-availability-distributed-key-value-store-b4e02bc46e9e medium.com
- ledisdb/ledis at master · ledisdb/ledisdb · GitHub github.com
- ledisdb/store/iterator.go at master · ledisdb/ledisdb · GitHub github.com
- Commands · ledisdb/ledisdb Wiki · GitHub github.com
- GitHub - ledisdb/ledisdb: A high performance NoSQL Database Server powered by Go · GitHub github.com
- GitHub - ledisdb/ledisdb: A high performance NoSQL Database Server powered by Go · GitHub github.com
- Replication · ledisdb/ledisdb Wiki · GitHub github.com
- Initial commit github.com