How does a DigitalOcean Load Balancer keep databases in sync?

Say I have a Wordpress blog that is getting so much traffic. So much so, that my Apache server cannot keep up with the requests. To mitigate these timeouts due to large numbers of requests, I look at a DigitalOcean load balancer.

What I would like clarification on, is if I have 3x $10 droplets of the same setup, and 1x Digitalocean load balancer distributing the traffic between the 3, - if I simply go to my website and write a blog, presumably my requests are handled by 1 of the 3 servers , my question is this: how does DigitalOcean’s load balancers ensure that the MySQL databases holding Wordpress post and user data, keep everything in sync?

If I write a post or create a new user on “LON1-001” server , does the loadbalancer update “LON1-002” and “LON1-003” servers? Apologies but I am new to load balancing.



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

moving mysql to another droplet will not increase latency and loading? becuase it’s another server with different IP

A load balancer would be setup to distribute the incoming request for your website to the three web servers that you mentioned.

In this kind of a setup, you would want to separate out your Database so that it isn’t running on any of the web servers and instead move it to a separate droplet, that is just running the DB alone.

Then each of your web servers would have their own credentials to connect to your MySQL instance running on the Database droplet.

This way when you distribute your HTTP traffic to each of the webservers, they are all accessing the same DB and that is where content is kept in sync, because it is a single database that is reading and writing data for the three web servers.