Skip to content

Road to NewSQL #54

Description

@Saxy

Vision & Strategic Pivot

Tellstone is evolving from a high-performance, single-node in-memory Key-Value store into a distributed, scale-out HTAP NewSQL In-Memory Engine. While disk-bound distributed databases (like CockroachDB and TiKV) incur significant I/O, NVMe flush, and compaction latencies, Tellstone leverages a pure in-memory core with zero-allocation FNV-1a sharded execution to deliver sub-millisecond, strongly consistent distributed transactions.

The core underlying storage engine remains a lock-free, in-memory KV architecture. However, to unlock ecosystem adoption, seamless ORM/BI-tool integration, and complex analytical capabilities, Tellstone is adopting the PostgreSQL Wire Protocol (PGWire) alongside its ultra-low latency native binary protocol.


Core Architectural Pillars

  1. Ecosystem & Protocol Layer (PGWire & Custom Binary)
  • PGWire Integration: Full support for the PostgreSQL wire protocol, enabling connection via standard psql clients, drivers (pgx, libpq), and ORMs without proprietary SDK locks.
  • Custom Multiplexed Binary Protocol: Retained for high-frequency point-lookups (GET/SET) requiring raw zero-allocation execution paths.
  1. Distributed Control Plane: Placement Driver (PD) & TSO
  • Embedded etcd Control Plane: Embedded HA ensemble acting as the cluster brain to manage region topology, health, and auto-balancing.
  • Centralized Timestamp Oracle (TSO): Provides strictly monotonic physical-logical timestamps required for distributed linearizability and Snapshot Isolation.
  1. Data Plane: Multi-Raft & Range-Based Region Splitting
  • 64MB Dynamic Region Splits: Monotonic key-space divided into 64MB range-based regions. Regions split automatically at the median key upon reaching capacity.
  • Multi-Raft Consensus: Each region operates as an independent Raft consensus group. Writes pass through Raft before being applied directly to the core-sharded in-memory engine.
  • Geo-Partitioning & Placement Rules: Region replicas can be pinned to specific geographic zones/nodes (e.g., --locality=country:de) for strict data residency (GDPR) and local read latencies.
  1. Transparent Routing & Execution Engine
  • Zero-Alloc In-Memory Lookup Table: Every node maintains an atomic, copy-on-write (atomic.Pointer[RegionTable]) mapping of key ranges to Raft leaders. Enables O(log N) binary search routing with zero heap allocations on the hot path.
  • "Read/Write Anywhere" Forwarding: Nodes transparently proxy requests to the appropriate region leader if the local node does not hold the active Raft leadership.
  • MVCC & 2PC Foundation: In-memory value layout pre-structured with 1-byte control flags and inverted timestamps to seamlessly support 2-Phase Commit (Percolator-style) distributed ACID transactions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions