algo

Build a Distributed Timestamp Oracle with EzRaft

timestamp_oracle is a 200-line timestamp service on EzRaft. A background task reserves ranges through Raft; next_timestamp allocates from memory. Leader leases and term-scoped caches keep the sequence strictly increasing across failovers, with no Raft write on the request path.

EzRaft: Build a Distributed KV Store in 100 Lines

EzRaft builds on OpenRaft and hides the storage, networking, and service layers. Define just four things—Request, Response, apply, and read—and you have a fault-tolerant, three-node distributed KV store.

Histogram Done Right: 2KB Memory, 0.2% Error

A lightweight histogram that tracks latency distributions in 2KB of memory with sub-0.2% error. Uses a float-like encoding for O(1) bucket indexing and trapezoid interpolation for accurate percentile estimation — no floating-point math needed.

Raft Node Rejoin Bug

Analyzes a replication session isolation bug in Raft implementations. When a node rejoins the cluster within the same term, delayed AppendEntries responses can corrupt progress tracking, causing infinite retry loops. While data safety remains intact, it creates operational issues like resource exhaustion. Uses raft-rs as a case study to examine trigger conditions and solutions.

Raft IO Execution Order (Revised)

I got it wrong in my previous article. The IO ordering bug in Raft isn’t about the protocol design—it’s about the subtle trap that emerges when implementations split state into in-memory and persisted state. Here’s what actually happens.

The Hidden Danger in Raft: Why IO Ordering Matters

Writing logs before persisting term in Raft can silently destroy committed data. Here’s why production systems like TiKV and HashiCorp Raft carefully control IO order—and three battle-tested solutions.

Paxos 中 Ballot number 的重用机制

本文探讨 Paxos 协议中 Ballot number 的重用机制,分析何时可重复使用,以及为何只能使用系统中已存在的值而非提议新值

Multi-Master-Paxos: 3

小孩子才选master, 成年人只用multi-master

200行代码实现基于paxos的kv存储

用200行代码实现一个基于paxos的kv存储, 以最简洁的形式展示paxos如何运行, 作为 paxos的直观解释 这篇教程中的代码示例部分

后分布式时代: 多数派读写的’少数派’实现

通过减少多数派读写中参与者的数量, 可以实现分布式系统某些特定场景的优化, 以及介绍这些优化对系统可用性产生的影响, 根据什么标准来选择和调整这些参数.