Use cases
The coordination you'd otherwise build on Redis scripts or ZooKeeper.
Each one is a single slot. Every instance in the fleet talks to the same server, so they share one limit, one lease, one sequence, one channel.
Fleet-wide rate limiting
Twenty API instances, one upstream quota of 100 req/s. Each instance takes tokens from a shared bucket before it calls out, so the limit holds for the fleet instead of per process. tokens_per_req lets an instance take a batch and spend it locally, cutting the round trips.
token_bucketleaky_bucket
A read consumes tokens, so it isn't idempotent: don't retry it blindly.
Token bucket reference →
A lease for one active worker
The first connection to write the slot owns it. Everyone else gets e<slot>007 until the owner stops renewing for timeout seconds. That's leader election for a cron job, without running Raft.
owner10s
timeout_memory
Owned by the TCP connection and held in memory, with no fencing token. A Ghoti restart drops the lease, so holders can overlap. Good for deduplicating work, not for guarding correctness.
Timeout memory reference →
Sequences without collisions
Every read is an atomic increment-and-get, so concurrent workers never draw the same number. Even with every connection hammering one counter, it benchmarks as fast as a plain read.
1 2 3 4r002 → v0024
atomic
Volatile: the counter resets to 0 on restart. Monotonic for the life of the process, not unique forever.
Atomic counter reference →
Fan-out signals, all the way to the browser
Broadcast pushes a write to every open connection, with no subscription step. Multicast pushes only to connections that sent s. Over HTTP a broadcast slot is an SSE stream, so a browser tab can listen with a plain EventSource.
w003reload-config
api-1api-2worker-7browser (SSE)
broadcastmulticast
At-most-once, no replay. The writer gets a received/sent/errors count and decides whether that's good enough.