Fly.ioProblem & solution
Last Mile Redis
Summary
Last Mile Redis presents a globally distributed caching design aimed at keeping backend responses under the 100-millisecond threshold by placing Redis near users. It argues that regional datasets overlap less than expected, making one Redis server per region a practical alternative to centralized sharding. The design combines standalone regional caches with a Dallas primary Redis and writable replicas configured with replica-read-only no, allowing local writes while replication distributes global changes. A DEL issued at the primary can therefore purge bad cache data across regions, while timestamped keys and expiration handle ordinary freshness; the same mechanism can also broadcast content or fan out queue messages.
Context
Backend applications often need to reduce request latency, and database optimization is painful; caching can remove tens of milliseconds from queries. The post argues that placing cached data close to end users can save hundreds of milliseconds compared with routing requests to a distant centralized server, while regional data usually overlaps relatively little.
Approach / What changed
Run Redis and application servers in multiple geographic regions, using one independent cache per region. Configure a Dallas Redis as the primary and regional replicas with replica-read-only no, so replicas accept local writes while continuing to receive replicated changes. Use key-based invalidation, primary-issued DEL commands, global SET operations, and Redis lists with LPUSH and BRPOP for propagation and fan-out.
Takeaways
Geographic cache locality means regional datasets often have limited overlap, so one Redis instance per region can avoid explicit application sharding.
Setting replica-read-only no lets regional Redis replicas accept local writes while continuing to sync changes from a primary.
Deleting a bad key on the primary propagates through replicas for an “instant” global purge; the design also supports global SET values and list-based fan-out with LPUSH and BRPOP.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.