8

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?

Simon East
  • 1,484
  • 1
  • 14
  • 18
Masum
  • 208
  • 1
  • 2
  • 5

2 Answers2

8

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.

Elliot B.
  • 1,316
  • 2
  • 18
  • 28
madflojo
  • 310
  • 2
  • 5
  • 3
    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
  • 4
    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) https://www.cloudflare.com/load-balancing/ – Boardy Dec 05 '17 at 21:40
  • 2
    Now yes! Have olso sticky session! https://support.cloudflare.com/hc/en-us/articles/115001771451-Load-Balancing-Session-Affinity – Cornac Oct 02 '18 at 22:14
  • 2
    This answer is outdated: Cloudflare now supports both *sticky sessions* and *automatic failover*. – collimarco Mar 12 '19 at 14:15
0

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.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58
  • 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 03 '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 03 '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 03 '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 00:17