Why this matters
- A single Redis instance caps out around 100–200K ops/sec; VaultCommerce's peak cart traffic needs a clustered topology with consistent hashing.
- Client-side caching reduces network hops but introduces staleness across pods.
- Production interviews ask you to diagram L1/L2 cache layers and explain what happens when a node dies.
Client-side vs server-side caching
Two distribution models
- Client-side (embedded) — each app instance holds a local cache (Caffeine, Guava); zero network on hit.
- Server-side (remote) — dedicated Redis/Memcached cluster; all pods share one cache pool.
- Hybrid L1 + L2 — local cache in front of Redis; fastest hits, shared warmth on L2.
VaultCommerce hybrid stack:
Request → Caffeine L1 (5s TTL, per pod)
↓ miss
Redis L2 (10 min TTL, cluster)
↓ miss
Postgres (source of truth)
L1 catches repeated reads within a single pod during a burst. L2 shares warmth across the fleet. Invalidating L2 via pub/sub triggers L1 eviction in every pod.
Redis Cluster topology
VaultCommerce runs a 6-node Redis Cluster — 3 primaries, 3 replicas — with consistent hashing across 16,384 slots:
redis_cluster:
primaries: 3
replicas_per_primary: 1
hash_algorithm: crc16_slot
client: lettuce_cluster_aware
failover: automatic_promotion
When redis-2 fails, its replica promotes and serves slots previously owned by the failed primary — cart reads continue with sub-second failover.
| Topology | Pros | Cons |
|---|---|---|
| Single instance | Simplest ops | SPOF, memory ceiling |
| Primary + Sentinel | HA failover | No horizontal scale |
| Redis Cluster | Scale + HA | Multi-key ops need hash tags |
| Memcached pool | Multi-threaded blobs | No native HA — client reroutes |
Single instance
ProsSimplest opsConsSPOF, memory ceilingPrimary + Sentinel
ProsHA failoverConsNo horizontal scaleRedis Cluster
ProsScale + HAConsMulti-key ops need hash tagsMemcached pool
ProsMulti-threaded blobsConsNo native HA — client reroutes
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 3 sections
- Cache layers in production
- Hot key mitigation
- Observability and failure modes
Test yourself
Answer these before moving on — recall is what makes it stick.