The temptation to self-host load balancers
When distributing traffic across multiple servers, the instinct is setting up own load balancers. HAProxy, Nginx, or Traefik on dedicated VPS.
It works. But should you do it?
Problems with self-hosted load balancers
Adding load balancers means adding infrastructure layers:
Another server to maintain
- Security patches and updates
- Monitoring and alerting
- Backup and disaster recovery
- SSL certificate management
Load balancers become critical single points of failure. If they go down, everything behind them is unreachable.
High availability requires complexity
Single load balancers defeat the purpose. You need:
- Two load balancers for redundancy
- Keepalived or similar for failover
- Floating IPs or DNS failover
Now you’re maintaining multiple servers just to route traffic.
Geographic limitations
Self-hosted load balancers sit in one location. Users on the other side of the world route through that single point, adding latency.
The Cloudflare alternative
Cloudflare offers load balancing as a service:
Global anycast network
Cloudflare has data centers in 300+ cities worldwide. Users connect to nearest ones automatically.
Health checks and automatic failover
Cloudflare monitors origin servers and routes around failures automatically. If servers go down, traffic shifts to healthy servers within seconds.
Geographic steering
Route users to closest servers:
- European users → Amsterdam server
- US users → Las Vegas or Dallas server
- Asian users → Singapore server
This happens automatically based on user location.
Simple configuration
No HAProxy configs. No Nginx upstream blocks. Just a web dashboard:
- Add origin servers
- Configure health checks
- Set routing rules
What it costs
Cloudflare’s load balancing pricing:
- Load Balancing: Starts at $5/month for basic features
- Additional origins: Small additional cost per origin server
- Health checks: Included
Compare to:
- Two VPS instances for redundant load balancers: $10-40/month
- Your time maintaining them: significant
Setting it up
Step 1: Add domain to Cloudflare
If not already done, add domain to Cloudflare and point nameservers to them.
Step 2: Create load balancer
In Cloudflare dashboard:
- Go to Traffic → Load Balancing
- Click Create Load Balancer
- Enter hostname (e.g.,
app.yourdomain.com)
Step 3: Create origin pools
Origin pools are server groups. Create one or more:
Example: Geographic pools
- Pool
us-servers: Dallas and Las Vegas VPS - Pool
eu-servers: Amsterdam VPS - Pool
asia-servers: Singapore VPS
Step 4: Configure health checks
Set up health checks:
- Type: HTTP or HTTPS
- Path:
/healthor any endpoint returning 200 OK - Interval: How often to check
Step 5: Set traffic steering
Choose traffic distribution:
- Geo Steering: Route to nearest pool based on user location
- Dynamic Steering: Route based on latency measurements
- Proximity Steering: Route to geographically closest pool
The bottom line
Every infrastructure layer added is a layer to maintain. Load balancers are critical. If they fail, everything fails.
Cloudflare gives:
- Global presence you couldn’t build yourself
- Automatic failover without complex configuration
- Geographic routing out of the box
- Less to maintain so focus on applications
For a few dollars monthly, enterprise-grade load balancing without enterprise complexity.
Explore VPS plans across multiple data centers for geographic redundancy.