I wanted to know more about the Load Balancing services. I’m interested to pay for the service.
My question is the “load balancing” is available by Cloudflare is only for static website/web app or what?
I have several servers running PHP/NGINX/Maria-DB that need load balancing for same Website.
How can cloudlfare load balancing service can handle my dynamic website (Php/Maria-DB) ?
Cloudflare Load Balancing operates at the DNS level and not at your server stack level for web server, PHP or MySQL server.
So essentially to utilise Cloudflare Load Balancer in the traditional sense, you would need to:
- have more than one origin server running your site i.e. IP address A and B. Each origin server A and B would need to have an operating web server, PHP and MySQL server and the same site data files/database data i.e. via distributed storage i.e. GlusterFS and MySQL cluster/replication of data between origin servers.
- Then create Cloudflare Load Balancer and create a load balancer pool and add both origin server A and B as origins within that load balancer pool with accompanying Load Balancer health monitors.
- Then you will configure how you want the CF Load Balancer to route traffic at DNS level to either origin pool server A or B. This will be done via both pool steering and origin steering options as well as based on the health of the origin servers https://developers.cloudflare.com/load-balancing/understand-basics/traffic-steering
You can see docs at https://developers.cloudflare.com/load-balancing/get-started
Of course there are other ways Cloudflare Load Balancer can be used. I use it for a single origin in the sense I set the fallback origin as a CF Worker serverless 503 static HTML maintenance page so if my site is unavailable or down at the origin, it shows the CF Worker HTML maintenance page to visitors which includes links to my social media accounts so folks can contact me or follow downtime/maintenance progress etc.
I also use CF Load Balancer for Geo Steering so I have 8-16x servers in up to 16 cities around the world and set them up as pool origins and geo steering them depending on the geographical location of the visitor’s request so they hit the closest CF data center which then talks with the closest server origin in that city locale.
Hello, Thanks for your reply.
If I understand your answer, I need to build a load balancer using Nginx ( I am using currently) load balancing to distribute the load between (server IP address A) and (server IP address B); then, I need to install and use the Galera cluster software ( you suggested GlusterFS) for Maria DB to keep synchronous replication of the Data Base between the server A and server B to create a load balancer HTTP/with DB synchronization. Then, I need to use the Cloudflare DNS load balancer on the top. It sounds like a double job to load balance with Cloudflare, the web load that is already load-balanced at the server level. Am I Correct?
Is there any other simple way to use the Cloudflare Load balancer and keep server A & B DataBase synchronized without GlusterFS and or Galeria Cluster?
you don’t need a Nginx load balancer in the mix, you can just use CF load balancer to route to each server A & B.
CF Load Balancer doesn’t do anything for your server disk storage layer, it’s purely operating at DNS level. You have to do that on origin servers’ side.
Means I need only data replication for the Database between the 2 servers with a software such as MariaDB Galera Cluster to create MariaDB Master-Slave Replication – I don’t use MySQL and have no access to GlusterFS or MySQL cluster/replication.
No need to use Nginx load balancer because the load balancing is made by Cloudflare at the DNS level.
Sounds more clear now.
Thank for your answer.
Do you have some kind of article about this topic on your website ? Would be interesting to look at it.
Topic? No I don’t personally myself. FYI, I don’t work for Cloudflare just a Cloudflare MVP basically a CF enthusiast with more insights to Cloudflare service/product offerings.
For Cloudflare Load Balancing https://developers.cloudflare.com/load-balancing/get-started for distributed storage and MySQL cluster/replication, if you Google search for guides + your choice of operating system i.e. Ubuntu, Debian, CentOS, Alma Linux, Rocky Linux etc, you should be able to find some guides and then just practise on test hourly billed VPS servers until you’re ready to do it on your live site.
Linode has one guide at Host a Website with High Availability | Linode
Galera is for unbutu. GlusterFS is for Debian/CentOs
My servers are build on Mac OS/Nginx/MariaDB
Do you think the (replication of data between origin servers that you mentioned earlier) replication Master/slave can be done this way ?
Thanks for your help.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.