Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

Tellstone

> 数据库
Open source

Tellstone is a high-performance in-memory database and drop-in replacement for Redis; Join https://discord.gg/kEf78DUFX

186 stars0 likes1 views
WebsiteGitHub

About

Tellstone is a high-performance in-memory database and drop-in replacement for Redis; Join https://discord.gg/kEf78DUFX

Tellstone is an ultra‑high‑performance, cloud‑native in‑memory key/value store written entirely in Go. It speaks two protocols over TCP — a compact custom binary protocol and a Redis‑compatible (RESP2) protocol — on top of a shared-nothing (SN) storage engine with optional TTL eviction, at‑rest encryption, and write-ahead log persistence.

…

Why Tellstone?

Many managed databases (PostgreSQL, MySQL, …) become bottlenecks under high‑frequency workloads. Tellstone offers a lean, modern, memory‑efficient buffer that:

  • Zero‑Copy Binary Protocol – Direct binary messages avoid text parsing / Protobuf overhead.
  • Redis‑Compatible – An optional RESP2 listener lets you drive Tellstone with redis-cli, redis-benchmark, memtier_benchmark, and existing Redis client libraries (GET/SET/PING/DEL).
  • Shared-Nothing Engine – N independent shards, each containing one map[string]Item plus a sync.RWMutex. Keys are pinned to a shard via FNV-1a hashing so the lock is almost never contended. No cross-shard coordination, no channel round-trips, no per-request allocations.
  • Configurable TTL Eviction – An active timing‑wheel (chronometer) evicts expired keys in O(1); lazy eviction on read backs it up.
  • Optional At‑Rest Encryption – ChaCha20‑Poly1305, off by default.
  • Write-Ahead Log Persistence – Per-shard append-only WAL for crash recovery. SET and DEL operations are persisted (deletes as tombstones) and replayed on restart. Zero-allocation on the hot path (Write = 0 allocs/op). Disabled by default.
  • Metrics, Tracing & Audit Logging – Built‑in Prometheus exporter, optional OpenTelemetry tracing, and an opt-in structured audit trail for security events.

Core Architecture

For a detailed description of the package structure, request flow, and design decisions, see ARCHITECTURE.md.

Layer Package Notes
Binary protocol internal/network MsgRequest/MsgResponse frames (GET/SET/DEL, TTL, key, value)
RESP2 protocol internal/resp Redis‑compatible listener reusing the same engine
Request router internal/router FNV‑1a hash → O(1) shard dispatch
Shard runner internal/shard Shared‑nothing shard: synchronous Execute(), per‑shard sync.RWMutex
Storage engine internal/storage Single‑map engine, TTL eviction via timing wheel
Persistence internal/persistence Per‑shard append‑only WAL, zero‑alloc write path
Crypto internal/crypto Optional ChaCha20‑Poly1305
Audit internal/audit Structured JSON security events (connect, disconnect, auth_*, acl_deny, command); rotating file writer, optional encryption
Metrics / tracing internal/metrics, internal/trace Prometheus text exporter, OTLP/gRPC tracing

Getting Started

Install

Debian / Ubuntu (APT)

bash
curl -fsSL https://saxy.github.io/tellstone-apt/saxy-keyring.gpg \
  | sudo gpg --dearmor -o /usr/share/keyrings/saxy-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/saxy-keyring.gpg] \
  https://saxy.github.io/tellstone-apt stable main" \
  | sudo tee /etc/apt/sources.list.d/saxy-tellstone.list > /dev/null

sudo apt update && sudo apt install tellstone

macOS (Homebrew)

bash
brew tap Saxy/tellstone-tap
brew install --cask Saxy/tellstone-tap/tellstone

Binary Downloads

Pre-built binaries are available on the Releases page for Linux, macOS, and Windows (amd64 and arm64).

Build from Source

Requires Go 1.26+ and optionally task (go‑task):

bash
task build          # → ./bin/tellstone   (or: go build -o bin/tellstone ./cmd/tellstone)

Run

bash
task run            # binary protocol on 127.0.0.1:9988
task run:resp       # binary on :9988  +  Redis-compatible RESP on :6379

Or run the binary directly with flags / environment variables:

bash
./bin/tellstone --addr 127.0.0.1:9988 --enable-resp --resp-addr 127.0.0.1:6379
TSD_ADDR=127.0.0.1:9988 TSD_ENABLE_RESP=true ./bin/tellstone

If a previous run got killed uncleanly and left a server stuck on a port (address already in use), find and stop it with:

bash
task kill                          # checks :19988, :6379, :6060 and any bin/tellstone process
task kill PORTS="9988" NAME=myapp  # override the ports/name to search for

Works on Linux and macOS (lsof/pgrep/pkill, no OS-specific tooling).

Configuration

Every option is available as a flag and an environment variable.

Flag Env Default Description
--addr TSD_ADDR 127.0.0.1:9988 Binary‑protocol listen address
--enable-resp TSD_ENABLE_RESP false Enable the Redis‑compatible RESP listener
--resp-addr TSD_RESP_ADDR 127.0.0.1:6379 RESP listen address
--resp-starttls TSD_RESP_STARTTLS false Allow RESP plaintext connections to upgrade with TLS
--shards TSD_NUM_SHARDS 0 (auto = CPU) Number of shared-nothing shards
--max-msg-size TSD_MAX_MSG_SIZE 16MiB Per‑message size limit
--max-mem-bytes TSD_MAX_MEM_BYTES 0 (unlimited) Total engine memory ceiling
--evict-interval TSD_EVICT_INTERVAL 1s Chronometer tick interval (0 disables active eviction)
--evict-slots TSD_EVICT_SLOTS 256 Timing‑wheel slot count
--enable-encryption TSD_ENABLE_ENCRYPTION false Enable ChaCha20‑Poly1305 at‑rest encryption
--encryption-key TSD_ENCRYPTION_KEY (none) Base‑64 encoded 32‑byte key (one key source is required when encryption is on)
--encryption-key-file TSD_ENCRYPTION_KEY_FILE (none) Path to a file holding the raw 32‑byte key; mutually exclusive with --encryption-key
--enable-metrics TSD_ENABLE_METRICS false Enable the Prometheus exporter
--metrics-addr TSD_METRICS_ADDR :9100 Prometheus exporter address (/metrics)
--trace-ratio TSD_TRACE_RATIO 0.0 OpenTelemetry sample ratio (0 disables)
--enable-persistence TSD_ENABLE_PERSISTENCE false Enable write-ahead log persistence for crash recovery
--persistence-dir TSD_PERSISTENCE_DIR (platform) Directory for WAL data files
--snapshot-interval TSD_SNAPSHOT_INTERVAL 0 (disabled) Time between periodic snapshots (e.g. 5m); requires --enable-persistence
--snapshot-bytes TSD_SNAPSHOT_BYTES 64MiB WAL size threshold that triggers a snapshot; requires --enable-persistence
--tls-cert TSD_TLS_CERT (none) TLS certificate path; watched for automatic rotation
--tls-key TSD_TLS_KEY (none) TLS private key path; watched for automatic rotation
--tls-ca TSD_TLS_CA (none) Client CA path for mTLS; watched for automatic rotation
--require-pass TSD_REQUIRE_PASS (none) Single password required via AUTH; empty disables it
--rbac-config TSD_RBAC_CONFIG (none) YAML/JSON RBAC policy file (roles, users, default role); hot-reloaded on SIGHUP
--oauth-provider TSD_OAUTH_PROVIDER (none) OAuth preset (google|stackit); empty + --oauth-issuer → generic OIDC
--oauth-issuer TSD_OAUTH_ISSUER (none) OIDC issuer / discovery base URL of the identity provider
--oauth-client-id TSD_OAUTH_CLIENT_ID (none) OAuth2 client ID used as the expected token audience
--enable-audit TSD_ENABLE_AUDIT false Enable structured audit logging
--audit-log-path TSD_AUDIT_LOG_PATH stdout Audit destination: a directory (rotated 0600 files) or stdout
--audit-events TSD_AUDIT_EVENTS auth,acl Comma-separated event types: auth, acl, connect, disconnect, command, or all
--shutdown-timeout TSD_SHUTDOWN_TIMEOUT 10s Max wait for graceful shutdown on SIGINT/SIGTERM

Runtime tuning (environment only): TSD_GC_PERCENT (default -1, GC off for a zero‑GC hot path), TSD_MEM_LIMIT_BYTES (soft heap ceiling), TSD_ENABLE_PROFILING (serves pprof on 127.0.0.1:6060).

At-rest encryption takes its 32-byte key from exactly one source. --encryption-key carries it base64-encoded, because process arguments and environment variables are NUL-terminated and roughly 1 in 8 random 32-byte keys contains a 0x00 byte that cannot survive them:

bash
tellstone --enable-encryption --encryption-key "$(openssl rand -base64 32)"

--encryption-key-file carries the same key as raw, unencoded bytes, which suits a mounted Kubernetes Secret or a vault-agent-rendered file. Every byte of the file is significant, so it must be exactly 32 bytes with no trailing newline:

bash
# umask 077 in a subshell so the file is created 0600; a later chmod would leave
# the key world-readable in between.
(umask 077; head -c 32 /dev/urandom > /etc/tellstone/key)
tellstone --enable-encryption --encryption-key-file /etc/tellstone/key

The key is read once at startup; rotating it requires a restart. Enabling encryption without either source is refused at startup rather than silently falling back to plaintext.

Deprecated: --encryption-key previously used the value as raw text, so a literal 32-character key such as 0123456789abcdef0123456789abcdef was accepted. That form still works and logs a warning at startup, but it is insecure and will be removed in the next major release. Re-encode an existing key with base64 , or move it to --encryption-key-file. The two forms are never ambiguous: a base64 key is 44 characters (43 unpadded), while a 32-character value can only decode to 24 bytes.

When TLS is enabled, Tellstone watches the parent directories of the certificate, key, and optional client CA. Valid replacements are applied after a 500 ms debounce; existing TLS connections continue unint

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Godatabasesdbmemorymemory-database

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库