0
tw5@renegade:~$ dig @192.168.57.1 tw5.helpdesk.com ; <<>> DiG 9.18.30-0ubuntu0.24.04.2-Ubuntu <<>> @192.168.57.1 tw5.helpdesk.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40082 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;tw5.helpdesk.com. IN A ;; ANSWER SECTION: tw5.helpdesk.com. 0 IN A 192.168.57.37 tw5.helpdesk.com. 0 IN A 192.168.57.43 ;; Query time: 3 msec ;; SERVER: 192.168.57.1#53(192.168.57.1) (UDP) ;; WHEN: Wed May 28 21:17:18 EDT 2025 ;; MSG SIZE rcvd: 82 

I've seen google's and facebook's DNS records come back this way as well, only with a heck of a lot more servers.

Now, as I understand it, (if I understand it), there should also be filesystem syncing between any of the application storage, and most of the application / storage configuration, so that when a change is made one server, the change gets made on the other server, and this can be for a couple of reasons, such as:

  1. High Availability.

    • The purpose is to keep everything running, so that when something breaks (one of the servers) the others can keep things working.
  2. Load Balancing.

    • The purpose is to make sure that when too many people visit the site, the load will be shared by both servers.

    • Sometimes it's done by being:

      • Weighted
      • Round Robin
      • Pick the next server if one isn't presently responding

But where I'm getting tripped up is, in the case of the server being a webserver, when a browser requests the page, from tw5.helpdesk.com, does the DNS server return a record at random? Does the browser pick a record at random?

Do I need nginx or haproxy or elixr or strange Cisco hardware to do High Availability or Load Balancing?

Or is it something like I need both things in the case that there are 4x application servers and 2x Load Balancers with 2x application servers behind them and both DNS records for the same name pointing at the Load Balancers.

1
  • 1
    DNS returns all records, sorted randomly or using round-robin or other policies applied. The browser uses the Happy Eyeballs algorithm to connect to the IPs returned by the DNS resolver. Commented May 29 at 5:30

1 Answer 1

5

when a browser requests the page, from tw5.helpdesk.com, does the DNS server return a record at random?

No. As you already see in the dig output: the DNS server returned two A records as the response to your query.

(Those two might not be all the IP-addresses the DNS server could return though. The DNS server might be much more complicated beast that only returns two IP-addresses for the two “nearest” servers that can answer your requests rather than returning all possible IP-addresses. That could be for example what happens with an anycast DNS service in association with a CDN.)

The DNS server might vary the order and sequence in which the two A records get returned. One query might get a response

tw5.helpdesk.com. 0 IN A 192.168.57.37 tw5.helpdesk.com. 0 IN A 192.168.57.43 

The next one

tw5.helpdesk.com. 0 IN A 192.168.57.43 tw5.helpdesk.com. 0 IN A 192.168.57.37 

Or sometimes the order in which the two IP-addresses are returned does not vary and indicates some sort of preference.

Does the browser pick a record at random?

No. AFAIK the resolver library on the system where your webbrowser runs can apply a local sorting algorithm on the list of IP-addresses that were returned from the DNS server, according to deprecated RFC3484 and RFC 6724.

Once sorted: the application, your web browser, will usually connect to first IP-address from the locally sorted list.

When it cannot connect to the first IP-address the application might immediately return a “connection refused/failed” error or it might attempt to make another connection attempt to the second IP-address.

Do I need nginx or haproxy or elixr or strange Cisco hardware to do High Availability or Load Balancing?

DNS is a useful tool to do some load balancing, it is computationally cheap, can give the appearance of high availability (at a global scale even) and can do some really useful things before application traffic even reaches a particular datacenter but it comes with a number of shortcomings. (For example round-robin DNS won't result in an even distribution of traffic and despite a short TTL on your DNS resource records, changes in your DNS records may not be picked up until much later than you'd expect and need.)

High availability is usually seen as eliminating single points of failure to allow service continuity during unplanned outages and ideally even during routine maintenance. That can be approached in many different ways.

A load balancer commonly is part of a HA architecture and typically does traffic distribution at a more local level, within a datacenter. It offers much better and fine-grained control on how to distribute traffic over your back-end servers. During (un)planned outages of a back-end server the load balancer can redirect traffic to the remaining node(s) which provides HA and service continuity.

To prevent the load balancer from becoming your next single point of failure, it is often deployed in a pair for high availability.

2
  • 1
    Google Docs is probably a good example. There has to be a fairly robust load balancers and data replication. In the past companies would set up multi-location replication and it may not work well or at all, and be very expensive. There could also be a dynamic name space updating component such as F5 "Global Traffic Manager". Commented May 29 at 13:32
  • Technically, it would be possible to use custom DNS that returns different records based on, e.g., region, but it is more typical to achieve the same by advertising different routes for the same IP address. Also, that is bit out of scope as it is something that large CDN networks do, and OP is likely focusing on smaller web site load balancing. Commented May 30 at 8:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.