4 ms·
I don't get it. `db` should resolve to all host ips? Wouldnt a load balancer make more sense in that scenario?
by rudasn 2y ago
I don't get it. `db` should resolve to all host ips? Wouldnt a load balancer make more sense in that scenario?
- 9dev 2y agoConsider `db` resolves to multiple A records: db. IN A 100.64.123.1 # prod-db-1. db. IN A 100.64.123.2 # prod-db-2. db. IN A 100.64.123.3 # prod-db-3. This is good for service discovery—e.g., you can configure something like RabbitMQ to discover cluster members from an A record—and it's nice for browsers, which will pick one host at random when connecting, which effectively is load balancing. In a usual setup, the problem is that if a host goes down, clients will still try to reach it because it's still in the DNS record; but with Tailscale, the "DNS" is generated by the local Tailscale daemon on the fly, so you get a live view, and if this was implemented, it would be possible to only return available servers for tag queries.
- bboreham 2y agoNit: the host is not picked at random, but according to the RFC3484 algorithm. Since people typically don’t believe me about this, here it is from someone who has done a lot of networking programming: https://daniel.haxx.se/blog/2012/01/03/getaddrinfo-with-round-robin-dns-and-happy-eyeballs/ https://daniel.haxx.se/blog/2012/01/03/getaddrinfo-with-roun...