Cloudflare load balancing
Besides using the Cloudflare DNS setup to fail over to another server, you can also implement load-balancing for your machines.
Option 1: DNS round-robin
You can use round-robin DNS entries to balance load between the servers.
DNS entries in Cloudflare look like this:
www.example.com 10.0.0.1
www.example.com 10.0.0.2
Cloudflare will use the other server on each request (when using the proxy / “cloud” mode).
If you only use Cloudflare for DNS (bypass Cloudflare), the browsers will round-robin select the entries for each request (depending on client implementation). This is definitely not recommended for failover setups, as client can cache the entries for minutes or longer.
+ simple setup
- no balancing control
- sticky sessions does not work
Note: We will support removing a failed server from the DNS config soon. Until then setting up a configuration like this in failover.cc will not work.
Option 2: dedicated load-balancer
Another option is to run a small load balancer instance on each of the servers (i.e. haproxy) to balance between each localhost and the other server. Or you run two dedicated load balancers in front of your webservers.
+ full balancing control
+ accurate balancing
+ works with sticky sessions
- no network load balancing
- setup takes some time
If you already have a saturated network, this setup will not help. All traffic still comes in to one node and, in case of failover, is switched to the other node.
Why do I need failover.cc ?
Failover.cc checks your servers health and changes the DNS-entries to only point to healthy servers. This is a simple and inexpensive failover method requiring only a minimum of setup effort.