DNS Load Balancing
WordPress DNS Load Balancing
Why Use DNS Load Balancing
When a WordPress custom domain has several A records, standard DNS Round-Robin can return every registered IP address, including one that is temporarily unavailable. A DNS load-balancing service can actively check endpoint health and exclude failed destinations from DNS responses.
- Perform health checks for each WordPress endpoint.
- Route users according to geographic location when supported.
- Compare endpoint latency and direct traffic to faster locations.
- Provide automatic failover when an origin becomes unhealthy.
The workflow below uses Cloudflare DNS Load Balancing as an example. The same overall approach can be implemented with another DNS provider that supports origin pools, health checks, and DNS traffic steering.
Create the DNS Load Balancer
1Open Load Balancing
In the Cloudflare dashboard, navigate to Traffic > Load Balancing and click Create Load Balancer.
2Enter the WordPress custom domain
Specify the custom domain that already has A records pointing to the WordPress load-balancer endpoints.
Create Origin Pools
Create one origin pool for each WordPress entry point that should participate in DNS balancing. In the example architecture, the WordPress cluster contains two load balancers, so two origin pools are created.
1Create the first pool
Enter a pool name and origin name, then use the public IP address of one WordPress load balancer as the Origin Address.
2Set origin weight
If both WordPress load balancers are intended to be treated equally, use the same weight for each origin. The source example assigns a weight of 1.
3Add notification email
Specify an email address if you want to receive health-check and origin-status notifications.
Save the pool and repeat the same procedure for every additional WordPress load-balancer endpoint.
Configure Health Monitoring
1Create a monitor
For the first origin pool, click Attach monitor > Create a Monitor.
Configure the monitor parameters according to the WordPress endpoint. A typical HTTPS health check can use the root path and expect a successful HTTP response.
/ or another reliable application-health path.
2xx response as healthy.
2Attach the monitor
Save the monitor and attach it to the first origin pool. Add a notification address if required.
3Monitor every origin
Attach the same monitor to the remaining origin pools and verify that all configured origins report a healthy state before continuing.
Select Traffic Steering
Traffic Steering controls how DNS responses choose among the available healthy origin pools.
- Off / Standard Failover — use the next healthy pool when the preferred pool becomes unavailable.
- Random — select a healthy pool randomly.
- Dynamic Steering — favor the fastest healthy pool using measured latency.
- Geo Steering — route clients to pools according to region or point of presence, with failover ordering where supported.
Review and Deploy
1Review the configuration
Verify the hostname, origin pools, attached monitors, failover order, and selected Traffic Steering mode.
2Deploy the load balancer
Click Save and Deploy. The WordPress custom domain will now be resolved through the configured DNS load-balancing policy.
Test DNS Failover
After deployment, simulate a load-balancer failure to confirm that DNS resolution removes the unhealthy origin and keeps the WordPress website reachable.
1Check current DNS resolution
Connect to a WordPress load-balancer node through Web SSH and verify that the domain initially resolves to all healthy endpoints.
dig wordpress-enterprise.jele.website +short
2Simulate an endpoint failure
Stop the load-balancer service on one node.
sudo jem service stop
3Wait for the health check
Wait approximately one health-check interval. In the source example this is 60 seconds.
- Open the WordPress website and confirm it is still available.
- Resolve the custom domain again and verify that only the healthy endpoint is returned.
- Check the DNS-provider dashboard and confirm that the failed pool is marked unhealthy or degraded.
- If notifications are enabled, verify that the failure alert was received.
4Restore the endpoint
Start the load-balancer service again after the failover test.
sudo jem service start
Wait for the next health-check cycle and verify that the restored origin returns to a healthy state and becomes available for DNS routing again.
Adjust Load Balancer Features
After testing, review the available DNS load-balancing features and tune them according to the application architecture, required recovery time, and service plan.
- Origin Servers — increase or reduce the number of backend endpoints.
- Faster Checks — modify how frequently health checks are performed.
- Check From — select how many regions perform health checks.
- Traffic Steering — change the routing algorithm as the WordPress deployment evolves.
