Overview
Run more than one SBproxy replica and per-key state has to stay coherent: a key minted on one node must work on the others, a revoke on one must be seen by all, and per-key spend and rate counters must add up across the fleet. The usual answer is to stand up an external Redis. SBproxy ships a mesh tier that does the coordination itself.
How it works
- Membership: a SWIM gossip protocol tracks which replicas are alive and feeds a consistent-hash ring.
- Distributed cache: reads and writes route by consistent hash to the replica that owns a key, so a record cached on one node is reachable from the others.
- CRDT counters: per-key spend uses a G-Counter and per-key rate uses a sliding window, both conflict-free, so counters merge across replicas without a lock or a coordinator.
The resolution order is L1 in-memory cache, then the mesh cache, then the store. A durable shared store still sits behind the mesh as the source of truth: Redis, or a secrets manager for a fully Redis-free fleet.
Configuration
Set the cache tier to mesh and give each replica a distinct identity and a seed peer:
proxy:
key_management:
cache:
tier: mesh
mesh_node_id: node-a # unique per replica
mesh:
seeds: ["node-b:7946"] # another replica's gossip endpoint
gossip_port: 7946
transport_port: 8946
advertise_addr: node-a:7946
Each replica takes its identity from the environment, so one config file boots the whole fleet. Replicas gossip over the membership and transport ports, which stay internal to the cluster network.
Why this beats an external Redis
- No separate Redis cluster to provision, secure, and operate for cross-instance state.
- Per-key verdicts stay warm in each replica's local cache; the ring resolves ownership without a round trip to a central store.
- Membership and failure detection are built in through gossip, not bolted on with external health checks.
- A single binary and a Kubernetes fleet run the same code path.