Skip to content

hocestnonsatis/takyonic

Repository files navigation

Takyonic

CI License: MIT OR Apache-2.0 crates.io Rust

Distributed SQL database written in pure Rust (std + libc only) with a native wire protocol.

Status: Phase 24 complete — SQL compatibility hardened, txn/auth, ops assets, chaos partition gate.

Features

  • Native LSM storagetakyonic-kv (WAL, skiplist, SSTable, bloom, leveled compaction)
  • Percolator MVCCtakyonic-txn with timestamp oracle
  • Raft consensus — hand-written multi-region Raft in takyonic-raft
  • Native RPC — epoll/kqueue reactor in takyonic-grpc (no tonic/gRPC)
  • SQL engine — parser, binder, planner, vectorized query engine in takyonic-server
  • SCRAM-SHA-256 — wire authentication
  • Optional wire TLS — rustls on SQL (takyonic-server) and native RPC mesh (takyonic-grpc + takyonic-tls)

Quick Start

git clone https://github.com/hocestnonsatis/takyonic.git
cd takyonic
cargo build --release
./scripts/dev-cluster.sh

In another terminal:

cargo run -p takyonic-cli -- -H 127.0.0.1 -p 26257
CREATE TABLE users (id INT PRIMARY KEY, name TEXT NOT NULL);
INSERT INTO users (id, name) VALUES (1, 'alice');
SELECT * FROM users;

Manual cluster startup

cargo run -p takyonic-metad -- --addr 127.0.0.1:26259 --data-dir ./data/meta
cargo run -p takyonic-stored -- --store-id 1 --addr 127.0.0.1:26258 --metad 127.0.0.1:26259 --data-dir ./data/store1
cargo run -p takyonic-server -- --addr 127.0.0.1:26257 --metad 127.0.0.1:26259
cargo run -p takyonic-cli -- -H 127.0.0.1 -p 26257

Docker

docker compose up --build

Gateway on port 26257, meta on 26259, storage on 26258.

Architecture

Client (takyonic-cli / takyonic-rs)
        │  native wire (SCRAM + optional TLS)
        ▼
   takyonic-server  (SQL gateway + query engine)
        │  native RPC (TLV)
        ├──────────► takyonic-metad  (PD + TSO)
        └──────────► takyonic-stored  (Raft + takyonic-kv LSM)
Binary Role
takyonic-server SQL gateway
takyonic-metad Placement driver + timestamp oracle
takyonic-stored Storage node (Raft + LSM)
takyonic-cli Interactive SQL shell
takyonic-soak Long-running chaos/soak harness

See docs/architecture.md and docs/protocol.md.

Workspace Crates

Crate Purpose
takyonic-kv Native LSM engine
takyonic-protocol TLV wire codec + SCRAM
takyonic-grpc epoll/kqueue RPC + TLS primitives
takyonic-sql SQL parser
takyonic-catalog Schema + binder
takyonic-planner Rule-based planner
takyonic-server Gateway + query engine
takyonic-txn Percolator MVCC
takyonic-tso Timestamp oracle
takyonic-raft Raft consensus
takyonic-region Region management
takyonic-meta Placement driver
takyonic-rs Rust client library

Production soak gate

cargo run --release -p takyonic-soak --features jemalloc -- --hours 1

Pass criteria: any 30s window after 45s warmup ≥ 30k INSERT rows/sec (min_ops_sec_window), periodic COUNT(*) OK.

Diagnostic mode: cargo run --release -p takyonic-soak --features jemalloc -- --seconds 600 --diagnose

Development

Clone the repo, then install git hooks once (runs rustfmt on commit and blocks push if CI would fail):

./scripts/install-git-hooks.sh
./scripts/rustfmt-all.sh          # format (same as CI)
./scripts/rustfmt-all.sh --check  # verify only
./scripts/clippy-check.sh         # clippy -D warnings (same as CI)
cargo test --workspace --bins -- --test-threads=2

Integration tests:

cargo test -p takyonic-integration-tests

License

Licensed under either of Apache-2.0 (LICENSE-APACHE) or MIT (LICENSE-MIT).

About

Distributed SQL database in Rust with a native wire protocol

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages