fansehep / ShaunDB

ShaunDB is a distributed key-value database by myself design.It is intended to satisfy my thesis implementation of the lsm tree, and to give me the ability to design a kv system, on which I would implement the raft protocol if I had the time. It also has simple support for redis commands.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ShaunDB

ShaunDB 是一款简单支持 Redis协议的KV数据库, 该项目旨在满足我对于一些 lsm tree 论文的复现及优化. 及结合我此前学过的一些知识, 简单构建一个kv系统.

Shaun 该名字来源于<<Shaun the Sheep>> (小羊肖恩) 该动画中主角名字.

单机架构

Raft多副本架构

设计

  • 日志设计:

    ShaunDB 内部拥有日志系统, 详情请见 shaundb_log_design.

  • 网络部分:

    ShaunDB 由于需要兼容 Redis 协议, 所以做了简单的 网络部分实现, 详情请见 shaundb_net_design.

  • kv 引擎:

    lsm tree 这种架构固然可以带来较好的写性能, 但为了减少空间放大的Compaction 常常被人诟病, 以及较弱的读性能也是优化的重点之一. 详情请见 shaundb_kvengine_design.

  • cache 设计:

    ShaunDB 有独特的缓存设计, 详情请见 shaundb_klrucache_design.

  • Raft 设计

    ShaunDB 节点之间通信使用 gRPC, 使用 boost::fiber 协程库来提高并发, 实现位于 shaundb_raft_module, 详见 shaundb_raft_design.

构建

ShaunDB 目前只支持 Bazel 构建, 需要兼容5.3.2的Bazel版本.

  • 默认使用 clang 进行编译, 需要支持 C++20 以上的编译器.
  • 依赖, 一些测试依赖于 tcmalloc, 及静态依赖了 libevent, 后续有空将其加入到Bazel 构建中.
  • 目前由于使用 iouring 做 compact, 只支持 linux kernel version >= 5.1 的发行版.
git submodule init
git submodule update
bazel build "..."

Countribute

ShaunDB 目前仍然处于开发阶段.

LICENSE

ShaunDB 以GNU GENERAL PUBLIC LICENSE 3.0 进行许可.

About

ShaunDB is a distributed key-value database by myself design.It is intended to satisfy my thesis implementation of the lsm tree, and to give me the ability to design a kv system, on which I would implement the raft protocol if I had the time. It also has simple support for redis commands.

License:GNU General Public License v3.0


Languages

Language:C++ 96.7%Language:Starlark 3.3%Language:Shell 0.0%