A WordPress site serves a Canadian publisher with 60% Canadian traffic, 30% US, 10% EU. p95 TTFB from Toronto is 220ms; from Frankfurt it’s 1.2s. The team wants a European edge. “Just put it behind a CDN” is the wrong answer — the dynamic surface (logged-in editors, WooCommerce checkout, the WP REST API) is what’s slow, and the CDN doesn’t help it. The right answer is multi-region, but a literal multi-region WordPress is a database problem first, a session problem second, and a content problem third. Most teams who try it discover the second and third problems six weeks into the project.
What’s happening
Single-region WordPress is straightforward: one MySQL primary, one Redis, one filesystem (or one S3 bucket for uploads), N PHP workers in front. Going multi-region breaks every singular noun in that sentence.
The database. MySQL replication can be asynchronous (primary writes, replicas catch up with sub-second lag in normal conditions) or semi-synchronous (primary waits for at least one replica to ack before committing). For WordPress, async replication is the only realistic shape across regions — semi-sync over a cross-Atlantic link adds 80-120ms to every write. The implication: writes go to one region, reads can serve from any region with the awareness that a write in region A might not be visible in region B for 50-500ms. WordPress’s application code does not handle this gracefully by default. A POST that creates a comment, then a redirect to the same page that re-reads the comment list, can show the post without the comment if the replica hasn’t caught up.
Sessions and the logged-in surface. WordPress logged-in users carry an auth cookie. The session itself is in the database (wp_usermeta for the session_tokens row). A logged-in editor’s saves, autosaves, and revisions are all writes. If the editor lands on a region with a read-only replica, the saves fail or trigger an unintended round-trip to the primary. The pattern that holds is sticky-session routing for any request bearing a wordpress_logged_in_* cookie — route it to the region with the write primary. Anonymous traffic can land anywhere.
Content replication. Uploads, plugins, themes, and the wp-content directory state must be identical across regions for a serving WordPress instance to produce identical responses. Three replication options exist:
- Shared object storage as the source of truth. Uploads in S3 (or a compatible like Wasabi or Backblaze B2) with the WordPress media-offload plugin, fronted by a media CDN. Plugins and themes deployed by the same CI pipeline to both regions. Filesystem on the PHP nodes holds only code, not user content.
- Filesystem replication (Syncthing, rsync, or block-level). Works for small media volumes; falls over at multi-TB scale.
- Region-pinned content with a global metadata layer. Used by very large publishers — content is created in the region of its primary audience, replicated to others on a schedule, and metadata indexes are queried globally. This is a custom build, not a stock WordPress pattern.
For most multi-region WordPress, option 1 is the only sane choice.
How to verify
Before designing a multi-region topology, measure where the real latency is for the segments that matter. From a synthetic node in each target region:
# TTFB from each region, broken down by URL class
for region in toronto montreal frankfurt; do
echo "=== $region ==="
curl -o /dev/null -s -w "anon home: %{time_starttransfer}s\n" \
--resolve example.com:443:$REGION_PROXY \
https://example.com/
curl -o /dev/null -s -w "logged-in admin: %{time_starttransfer}s\n" \
--resolve example.com:443:$REGION_PROXY \
-b "wordpress_logged_in_xyz=fakecookie" \
https://example.com/wp-admin/
curl -o /dev/null -s -w "REST API: %{time_starttransfer}s\n" \
--resolve example.com:443:$REGION_PROXY \
https://example.com/wp-json/wp/v2/posts?per_page=10
done
If anonymous TTFB is fast everywhere (CDN doing its job) but logged-in and REST traffic is slow only in the far region, you have a multi-region problem to solve. If everything is slow in the far region, you may have a simpler edge or origin-shield problem first.
Measure replication lag on your existing MySQL if you already have a cross-region replica:
mysql -h $REPLICA_HOST -e "SHOW REPLICA STATUS\G" | grep -E "Seconds_Behind_Source|Replica_IO_Running|Replica_SQL_Running|Source_Log_File"
Seconds_Behind_Source is misleading on idle replicas — it shows 0 when the replica has nothing to do, not when it’s caught up. The more reliable signal is the diff between the source’s current binlog position and the replica’s last applied position, in bytes:
SRC=$(mysql -h $PRIMARY_HOST -e "SHOW MASTER STATUS\G" | grep Position | awk '{print $2}')
RPL=$(mysql -h $REPLICA_HOST -e "SHOW REPLICA STATUS\G" | grep Exec_Source_Log_Pos | awk '{print $2}')
echo "lag bytes: $((SRC - RPL))"
The fix
The reference topology that holds for most WordPress multi-region deployments looks like this:
Geo-DNS or CDN routing
|
+---------------------------+---------------------------+
| |
Region A (write primary) Region B (read replica)
+--------------------+ +--------------------+
| Cloudflare/Fastly | | Cloudflare/Fastly |
| Edge cache | | Edge cache |
+---------+----------+ +---------+----------+
| |
+---------v----------+ +---------v----------+
| PHP-FPM pool | | PHP-FPM pool |
| (auto-scaled) | | (auto-scaled) |
+---------+----------+ +---------+----------+
| |
+---------v----------+ +---------v----------+
| Redis Sentinel / | <-- replicated -- | Redis Sentinel / |
| Cluster | | Cluster (replica) |
+---------+----------+ +---------+----------+
| |
+---------v----------+ async repl +-------------v----------+
| MySQL primary | --------------> | MySQL replica |
| (writes only) | | (reads only, RO mode) |
+--------------------+ +------------------------+
\_________________________________________/
|
S3 / object storage (uploads)
fronted by media CDN
The routing decisions are the load-bearing ones:
1. Route on cookie, not just on geography. A logged-in editor in Frankfurt should still land on Region A (write primary). The Cloudflare Worker or Fastly VCL rule:
// Cloudflare Worker — sticky to primary region for writes
addEventListener('fetch', event => {
const req = event.request
const cookies = req.headers.get('Cookie') || ''
const isWriter = /wordpress_logged_in_|wp-admin|woocommerce_(items_in_cart|cart_hash)/.test(cookies)
|| /\/(wp-admin|wp-json|xmlrpc\.php)/.test(new URL(req.url).pathname)
const origin = isWriter ? 'origin-a.example.com' : nearestReplica(req)
const upstream = new URL(req.url)
upstream.hostname = origin
event.respondWith(fetch(upstream, req))
})
2. Use HyperDB or LudicrousDB (or a similar drop-in) to route reads to local replicas. Stock WordPress sends all queries to DB_HOST. The drop-ins let you declare “writes to primary, reads to nearest replica, with a fallback for replica failures.” Critically, they have a “post-write read-after-write” mode — for N seconds after a write, reads from the same user go to the primary, avoiding the stale-replica problem on the comment-then-redirect flow.
// db-config.php — LudicrousDB-style configuration
$wpdb->add_database([
'host' => 'mysql-primary-region-a.internal:3306',
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => DB_NAME,
'write' => 1,
'read' => 1,
]);
$wpdb->add_database([
'host' => 'mysql-replica-region-b.internal:3306',
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => DB_NAME,
'write' => 0,
'read' => 1,
'datacenter' => 'region-b',
]);
// only route reads from region-b PHP nodes to the replica
$wpdb->add_callback(function ($query, $wpdb) {
$current_dc = getenv('DEPLOY_REGION');
if (str_starts_with(trim(strtolower($query)), 'select') && $current_dc === 'region-b') {
return ['datacenter' => 'region-b'];
}
return null; // default routing
});
3. Pin uploads to object storage. With WP Offload Media or a similar plugin, every wp-content/uploads/* request goes to S3 and is fronted by a media CDN. This eliminates the filesystem replication problem entirely.
4. Cache invalidation across regions. When a post is updated in Region A, the Redis cluster in Region B must invalidate its cache for that post. The patterns that work:
- A Redis pub/sub channel that both regions subscribe to. WordPress hooks (
save_post,clean_post_cache) publish invalidation messages; both regions’ Redis clients consume and flush local keys. - Replicated Redis (Redis Enterprise active-active, or Dragonfly with replication) — same store, replicated. Higher cost, simpler app code.
- Short TTL on cached objects in the non-primary region (60-120s) and accept the staleness. Cheapest, works for content sites where 60s of staleness is not a P1.
The mistake to avoid: trying to make region-B writable as a “just in case.” Active-active WordPress is not a stock pattern — it requires conflict resolution on user actions, multisite ID space coordination, and a level of database engineering that exceeds what most teams have headroom for. Active-passive with a failover runbook is the pattern that actually ships.
Stack Harbor designs and operates multi-region WordPress topologies under the Enterprise WordPress operating model, including the DB drop-in, the routing rules, and the failover runbook. If you’re scoping a second-region build, we can size the architecture and run the migration.