Load balancers are incredibly useful when a single server isn’t capable of handling the load or if you wan’t greater reliability. But what if bandwidth is the limiting factor, what do you do then? And what tools from the Digital Ocean toolbox can you use?
In a recent project I had to make sure our cloud setup could handle enormous amounts of traffic. Since caching was on the table, the most likely issue was going to be bandwidth. If your server can handle the traffic, but the traffic itself surpasses the connection the server has to the internet you have a problem. So the question is, can a load balancer help?
The answer is yes, a load balancer can help, but the Digital Ocean load balancer can’t. You see, the Digital Ocean load balancer does not have significantly more bandwidth speeds available than a regular droplet. In fact, in my performance testing, my own nginx service outperformed the load balancer significantly.
That is not to say that the Digital Ocean load balancer is useless in this case. One of your options is to run a round robin DNS setup to several load balancers. Preferably in multiple data centers if possible. This will land you between the regular Round Robin setup in which you are pretty much blind to what is going on, and the setup with a single load balancer.
If bandwidth is an issue, a good first step is to offload all static assets, to reduce the bandwidth usage as much as possible. Digital Ocean Spaces is good for this, as it has a CDN option. It is S3 compatible, but does have some drawbacks. One is that it does not have a pull zone functionality built in. This means, you have to actively deploy your assets to cloud. Another issue is that if you want to cache the page-content, that is also off the table with Digital Ocean Spaces.
Note: Go outside the Digital Ocean universe, and you can have this issue solved for you – like by using CloudFlare. However, this post is meant for those wondering about the Load Balancer services by Digital Ocean.