7

Say I have 3 VPS nodes with Linode to serve traffic on a single website. Linode themselves provide a node balancing solution.

But I use CloudFlare and was wondering after I read their blog article on their architecture if it was necessary to use Linode's node balancer if CloudFlare's DNS load balancing can do that for me.

Is there any benefit in using Linode's load balancer instead of using the CloudFlare's DNS load balancer?

9

Yes, CloudFlare can load balance your traffic. However this opens up some issues that you have to be willing to deal with:

  1. CloudFlare does not automatically provide sticky sessions. This means anyone that goes to you site may land on one server for one request and another for another request. This has implications with any user logins or anything that requires server sessions. But there are other solutions for this, and if you are just serving up static content this is not a problem.

2. CloudFlare does not provide automatic failover nor monitor the origin servers, so if one goes down, web requests will still be directed to the dead server and users will see a CloudFlare error page. However, there are other ways to perform this monitoring and remove the failed server from your DNS, see Can CloudFlare perform automatic failover to a different backend?

As long as you can deal with the 2 items above then it works great. In fact I use this setup today for multiple sites that have survived the front page of HackerNews.

  • 1
    Why do you say cloudflare doesn't offer "automatic failover"? In the "Enable load balancing" section on their site it specifically says they do. "Safeguard from service disruptions with load balancing, automatic failover, geographic routing and active health checks against your origin servers." – Geesu May 25 '17 at 19:49
  • At the time of this question they didn't offer such a thing. – madflojo May 29 '17 at 20:49
  • 1
    I know this is an old answer but thought it might be worth a mention as I came across this from a Google search that Cloudflare do now support session stickiness (session affinity) cloudflare.com/load-balancing – Boardy Dec 5 '17 at 21:40
  • 1
    Now yes! Have olso sticky session! support.cloudflare.com/hc/en-us/articles/… – Cornac Oct 2 '18 at 22:14
  • 1
    This answer is outdated: Cloudflare now supports both sticky sessions and automatic failover. – collimarco Mar 12 at 14:15
1

If your web site has only static content, Cloudflare's load balancing is enough.

However, if your website has any dynamic content, which is served always by your servers, you need your own load balancing solution to distribute the requests to your own backend servers.

  • 2
    This depends on your setup really. If CloudFlare has n source (A/AAAA) addresses to pull from, you get load balancing in that manner from their side as well. Most don't fall under this many-external-addresses category, but it's definitely a valid setup, even more so as IPv6 setups make external addressing plentiful. – Nick Craver Jul 3 '14 at 10:47
  • Nick, CloudFlare does not execute your scripts, which task is expensive CPU wise. That's why having your own load balancing can be useful. – John Auld Jul 3 '14 at 15:52
  • 1
    Nick is right here. If you specify several A records for your origin servers in Cloudflare, I assume Cloudflare does DNS based load balancing with those entries. Then the OP can put the IP address of each of his origin servers to Cloudflare. – Tero Kilkanen Jul 3 '14 at 23:49
  • Having multiple DNS records will create a round robin scenario where traffic will be distributed across multiple servers however it does not support failover, so if one server goes down, I don't think CloudFlare is smart enough to redirect traffic to the remaining servers. (Of course, CloudFlare has great failover amongst their own servers, they just do not handle it across origin servers.) – Simon East Sep 11 '15 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.