pingcap / community

TiDB community content
Apache License 2.0
263 stars 153 forks source link

SHAREdis, a redis protocol compatible layer for TiKV #628

Open vortex0305 opened 2 years ago

vortex0305 commented 2 years ago

Project Incubating Request

Summary

As a caching service, Redis has become the first choice for most companies with its efficient performance, rich data types, and comprehensive interfaces. However, since all data in Redis is in memory, when the amount of data is huge, the cost will be very expensive. Therefore, many companies have developed their own caching services based on open source frameworks such as RocksDB. With the high-efficiency performance of SSD disks and the append log mode of the LSM tree, the service cost is greatly reduced at the cost of a certain loss of read and write efficiency.

Because self-developed kv store often requires large R&D and time costs, TiKV, as an excellent open source KV storage service, has powerful cluster management and data synchronization functions, making it a suitable choice. But firstly, TiKV only supports reading and writing of key-value type data, which greatly limits business application scenarios. Secondly, TiKV uses a unique client protocol. If the business is switched from Redis, the sdk needs to be changed, and the service migration cost is high.

This project hopes to encapsulate and expand the key-value interface of TiKV on top of the advantages of TiKV, and use the Redis client protocol to implement Redis data types and interface operations, while shielding the complex cluster management inside the distributed system and data synchronization operation, thereby providing a distributed SSD cache computing layer service that can replace/supplement Redis.

Motivation

This proposal mainly solves the following problems:

  1. TiKV only supports reading and writing of key-value type data, which greatly limits business application scenarios
  2. TiKV uses a unique client protocol. If the business is switched from Redis, the sdk needs to be changed, which needs high R&D costs.
  3. Storage and computing are not separated and do not have elastic scalability

Current Situation

  1. Redis data type & interface support: implements some commonly used types, such as kv, set, hash.
  2. The proxy layer is developed using Go, the client-service interaction protocol is thrift, and currently supports c++, java, go and python
  3. The existing design and code will inevitably have potential deficiencies and bugs

Targets

  1. The support of Redis protocol, aiming to realize all common types & interfaces
  2. The client can use the unified SDK to call Redis & TiKV
  3. The identification and separate storage of cold and hot data can be automatically derived based on statistical analysis of calls. Users can manually or automatically put cold data in kv store and hot data in redis without additional development costs

Architecture diagram

SHAREdis

Estimated Time

zz-jason commented 2 years ago

LGTM

winkyao commented 2 years ago

LGTM

winkyao commented 2 years ago

Repo:https://github.com/tidb-incubator/SHAREdis have created, please accept the pending invitation.

vortex0305 commented 2 years ago

There is one problem left: the name SHAREdis we used has a company identify, we don't know is this a good choice ? And any other names to recommend?Or that it's even not a problem.

winkyao commented 2 years ago

You can change the name by yourself, that's ok, you have admin privilege. But we don't think SHAREdis has any problem.

vortex0305 commented 2 years ago

ok thx