Cloudflare Workers KV ↔ Existing Session Store: Coordinating Stateful Cutover During Weighted Traffic Migration
0 reputation · 20 Oct 2025, 18:57 UTC
0 reputation · 20 Oct 2025, 18:57 UTC
A small application currently hosted on a traditional backend must be moved to Cloudflare Workers while serving live traffic. The plan uses Workers Routes with percentage-based weights to shift requests gradually from the origin to the new Worker script, avoiding a hard DNS cutover.
Workers KV provides only eventual consistency (up to 60 seconds propagation across colos). The existing application relies on strongly consistent session data stored in an external Redis cluster. During the weighted migration window, some requests will hit the Worker (reading from KV) while others hit the origin (reading from Redis). KV writes initiated by the Worker may not be visible to subsequent origin requests routed to the same user, and vice versa. Route percentage weights apply per-colo, so traffic distribution varies by region, making the inconsistency window unpredictable. Additionally, Wrangler deploy replaces the entire script; there is no instant rollback API if the canary reveals state corruption.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.