Loadbalancer Musings

So recently I have been thinking about getting a load balancer/service, but worried about it being a single point of failure, as well as a hefty price. So how about a setup where we have multiple frontend webservers which are all setup to be a load balancer for each other?

Something like the following would be configured in DNS:

This would round robin the requests to any of the available frontend web servers.

In the Nginx configuration for each we would then load balance as well (including itself), this would automatically detect if a web server was unavailable and try another:

When I tested this with some VM’s it has worked flawlessly. Any thoughts or further improvements that could be made?

Checking TTL DNS

I often need a way to check the actual TTL value of a DNS record.

To do this you need to check the authoritative nameserver for that domain. I wrote a quick bash script that takes a list of DNS records and spits out authoritative nameserver info including the TTL.

Please let me know if you find it useful!