In a previous post, I’ve covered how I used Digital Ocean’s load balancer to handle the increasing number of request my Weather Extension receives. For weeks everything was going great but about a month ago I started having issues with DO load balancer. Users were receiving 522 (timeouts) errors. DO claimed my servers were the issue. After some testing, I realized that around 1,000 requests a minute, Digital Ocean’s load balancer started failing even though they claim to not limit the number of requests.
In a panic, I had to make a quick decision. I decided to double the ram/cpu on my web server and point all traffic to it to see if it could handle the request. This helped but some users were still having issues. Then I tried CloudFlare’s load balancer. It was easy to setup and worked well. Pricing is per request and I estimated it would cost around $20 a month, which matched DO.
My first bill for CloudFlare’s load balancer for 63 million requests was over $70, which was more than the servers hosting Weather Extension. I reached out to Taylor Otwell for advice. He recommended a free option using CloudFlare’s rotating DNS (Guide). I added the additional A records to point to my 3 servers and everything worked great!
I would recommend using rotating DNS over a load balancer if you are not needing automatic failover. In my case, the cost savings are worth the possible downtime.
If you have any questions, please leave a comment below.Follow @Tim_Leland
Also published on Medium.