Say I have two servers (droplets in case of DigitalOcean). I want to run a load balancer infornt of the two. So should I spawn a new droplet for the load balancer? If so, how can I utilize the third server for any other purpose as it does only load balancing which couldn't be that resource intensive right?
Generally your load balancer needs to in a position where it has the ability to terminate connections to your public IPs (assuming you are load-balancing a public-facing site).
Your servers can then be hosted using private IP addresses, reachable directly only from the load-balancer.
Your load-balancer should definitely be a completely independent system (droplet in your case) - there are a number of reasons for this:
- While straight load-balancing is not particularly processor intensive, if you opt to perform things like SSL offload, caching, URL re-writing/filtering at your load-balancer, you may find this does have a significant load as your traffic levels scale.
- Load-balancers act as a fail-over mechanism too, so if one of your back-end servers needs maintenance, you can remove it from the pool, or reboot it without affecting overall availability - if that same droplet hosts the load-balancer and you reboot it, your whole site will become unavailable (unless you have HA load-balancers and can fail between them seamlessly)
- Separate components can be easily swapped out in future without too much inter-dependency