@angldavd
I’d be happy to help :-).
When it comes to load balancing, there’s more that comes in to play than just the load balancer. You need to think more about how you want to go about separating things out.
Ideally, in a cluster, you’d separate NGINX + PHP, Database, and Storage in to their own clusters. The reason for this is because you won’t be able to deploy a load balancer, add your existing Droplet + a new one and things just work – there’s some degree of manual work required.
…
Ideally, you’d setup a load balancer and X number of web servers which will have NGINX and PHP installed (PHP-FPM). We’ll start with 2 in this example, which would look something like:
- Load Balancer
- - Web Server 01 (NGINX + PHP-FPM)
- - Web Server 02 (NGINX + PHP-FPM)
The next cluster we’d need to configure would be storage as we need somewhere to store data so we aren’t having to replicate data across the web servers. For this, most will recommend GlusterFS.
GlusterFS is setup with a client and then Y number of storage servers. It all depends on what you’ll need for your installation. The client is the one you connect to and mount on the Web Servers – it then serves data from the storage servers in the cluster.
So our modified cluster might look something like:
- Load Balancer
- - Web Server 01 (NGINX + PHP-FPM)
- - Web Server 02 (NGINX + PHP-FPM)
- - - GlusterFS Client
- - - - GlusterFS Storage Node
- - - - GlusterFS Storage Node
You would, for example, mount the GlusterFS client on /home
on the web servers and that’s how NGINX would pull data to serve requests. It works just like /home
does now, except it’s being served from the GlusterFS cluster instead of the physical web server.
The last thing you’d want to setup is a database server. You could set MySQL/MariaDB up on one of the web servers, though it’s generally recommended that you setup a database only server and then connect over the private network from your application.
…
As you can see, it can get a little complex and this is certainly just one example, though it’s more so tailored to WordPress and database driven applications.
You could certainly run fewer GlusterFS servers, though generally you want to at least run one client and one storage node.
…
That said, whether or not I’d go this route depends on your traffic. If you’re not at least half way to the point of needing a load balanced solution, I’d start small and work your way up.
There’s a lot that can happen and you would need to be able to troubleshoot – or ask questions here in the community / submit a support ticket for guidance.
If you’re not sure how to go about setting everything up properly, I would definitely recommend hiring a sysadmin to do it for you as a load balanced solution won’t perform any better if it’s not configured properly. It could potentially perform worse or not at all.
Let me know if you have any other questions, always happy to help :-).