Distributed WordPress: Anycast Edge + WireGuard Mesh

A technical deep dive into multi-region payment architecture: BGP anycast edge nodes, WireGuard mesh backhaul, why WooCommerce breaks caching, and the pivot to Medusa.js with CockroachDB.

What happens when you design a globally distributed WordPress architecture with BGP anycast, WireGuard mesh backhaul, and edge caching — then install WooCommerce?

This presentation walks through the full architecture journey: from a content-optimized edge network that delivers pages in 5–15ms, through the five specific mechanisms that make WooCommerce uncacheable, to evaluating CockroachDB as a distributed database replacement, and finally arriving at a headless commerce solution with Medusa.js and regional payment gateways.

Key Takeaways

  • Edge caching works brilliantly for content sites. BGP anycast + Caddy reverse proxy + WireGuard mesh delivers static pages in 5–15ms from the nearest PoP. Cache hit ratios above 90% make the architecture viable.
  • WooCommerce destroys edge caching. Five mechanisms — cart cookies, cart widgets, WP nonces, geo pricing, and the checkout flow — make nearly every response unique per session. Cache hit ratio drops to 5–15%, turning edge nodes into expensive reverse proxies that add latency.
  • CockroachDB fixes reads but breaks writes. Local read replicas cut query latency from 80–150ms to ~2ms, but Raft consensus adds 200–300ms to every write. Worse, WordPress speaks MySQL while CockroachDB speaks PostgreSQL — no production-grade adapter exists.
  • Headless commerce is the answer. Medusa.js with a Next.js storefront makes catalog pages 100% cacheable at the edge. Cart state moves to the client. Only mutations (add-to-cart, checkout) hit the origin API.
  • Regional payment gateways matter. Stripe handles global cards, but local methods (Bancontact, iDEAL, Konbini) require region-specific gateway configuration to minimize payment latency and maximize conversion.