tontinton/dbeel
tontinton/dbeel has 541 GitHub stars and 22 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-12 19:13 UTC. Last push 2023-12-15.
A distributed thread-per-core document database
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 更新延迟
- 1个月
- 更新延迟
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Introduction
dbeel is an attempt to learn modern database architecture.
The best one-liner to describe the db is: A distributed thread-per-core document database written in rust.
So basically it has a document API like in MongoDB with leaderless replication like in Cassandra and thread-per-core architecture like in ScyllaDB.
It's not production ready at all, but that doesn't mean there is no value in the project. If you ever wanted to read database code without getting overwhelmed by massive amounts of code, dbeel is for you.
You can try it out by running cargo install dbeel.
I've also posted a blog post as a summary of what I've learned working on this project.
Traits
- Documents + API in msgpack format
- LSM Tree
- Memtable is a red black tree
- Thread per core (thanks
glommio) - io_uring (thanks again
glommio) - Direct I/O
- Page cache implemented using WTiny-LFU eviction algorithm
- Load balanced via consistent hashing
- Each shard (core) is placed on the ring
- Metadata events sent using gossip dissemination
- Leaderless replication with tunable consistency
replication_factor(parameter increate_collectioncommand) - Number of nodes that will store a copy of data- Write
consistency(parameter insetcommand) - Number of nodes that will acknowledge a write for it to succeed - Read
consistency(parameter ingetcommand) - Number of nodes that have to respond to a read operation for it to succeed- Max timestamp conflict resolution
Performance
Running the benchmark on my machine (System76 lemp11) with no fdatasync results in the following output:
Set:
total: 54.424290449s, min: 80.219µs, p50: 446.851µs, p90: 905.422µs, p99: 1.806261ms, p999: 7.463916ms, max: 35.385961ms
Get:
total: 29.281556369s, min: 36.577µs, p50: 231.464µs, p90: 479.929µs, p99: 1.222589ms, p999: 3.269881ms, max: 6.242454ms
Running with --wal-sync (calls fdatasync after each write to the WAL file) results in the following output for Set (note that fdatasync on my machine takes 6-10ms):
Set:
total: 1253.611595658s, min: 6.625024ms, p50: 12.57609ms, p90: 12.858347ms, p99: 13.4931ms, p999: 19.062725ms, max: 31.880792ms
You can always configure --wal-sync to achieve better throughput, with worse tail latencies, by setting --wal-sync-delay (try setting half the time it takes to fdatasync a file on average in your setup).
How to use
The only implemented client is in async rust, and can work on either glommio or tokio (select which using cargo features).
Documents are formatted in msgpack and the best crate I found for it is rmpv, so the client makes heavy use of it.
Example (mostly copied from tokio_example/):
// When connecting to a cluster, you provide nodes to request cluster metadata from.
let seed_nodes = [("127.0.0.1", 10000)];
let client = DbeelClient::from_seed_nodes(&seed_nodes).await?;
// Create a collection with replication of 3 (meaning 3 copies for each document).
let collection = client.create_collection_with_replication(COLLECTION_NAME, 3).await?;
// Create key and document using rmpv.
let key = Value::String("key".into());
let document = Value::Map(vec![
(Value::String("is_best_db".into()), Value::Boolean(true)),
(Value::String("owner".into()), Value::String("tontinton".into())),
]);
// Write document using quorum consistency.
collection.set_consistent(key.clone(), value.clone(), Consistency::Quorum).await?;
// Read document using quorum consistency.
let response = collection.get_consistent(key, Consistency::Quorum).await?;
assert_eq!(response, value);
// Drop collection.
collection.drop().await?;
Try out the benchmarks yourself
To compile the DB (you can skip building the db by running cargo install dbeel):
cargo build --release
./target/release/dbeel --help
To compile the blackbox benchmarks:
cd blackbox_bench
cargo build --release
To run the benchmarks:
# If you installed using cargo instead of building, dbeel should be in your PATH.
./target/release/dbeel # On first terminal
./target/release/blackbox-bench # On second terminal
探索相关项目
Asabeneh/30-Days-Of-Python
30 Days of Python 编程挑战是一份循序渐进的指南,用于在 30 天内学习 Python 编程语言。这项挑战可能需要超过 100 天。请按自己的节奏进行。这些视频或许也有帮助:https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,618 星标grafana/grafana
开放且可组合的可观测性与数据可视化平台。可对来自 Prometheus、Loki、Elasticsearch、InfluxDB、Postgres 等众多数据源的指标、日志和追踪进行可视化。
77,859 星标redis/redis
对于正在构建实时数据驱动应用的开发者而言,Redis 是首选、速度最快且功能最丰富的缓存、数据结构服务器和文档与向量查询引擎。
77,472 星标apache/superset
Apache Superset 是一个数据可视化与数据探索平台
75,495 星标