Patterns

DNS in front

Put DNS ahead of several Load Balancers so the entry point is not a single machine, and set its TTL to match how fast you need failover.

Point the domain at DNS, and let DNS hand out the addresses of two or more Load Balancers.

Move up when#

  • The Load Balancer is itself the single point of failure.

  • Users can take only one link, and you need more than one entry point.

The Design#

Drag to pan. Hold Ctrl or Cmd and scroll to zoom.

At 3.00k Users the Simulation solves this Design to Apdex 0.50, p99 130 ms, 50.0% errors and $2.28/s Burn.
WhereSettingValueWhy
DNSTTL (s)3600Resolvers keep the answer this long, so a dead Load Balancer keeps getting its share for as long.
Load BalancerStateDownThis Load Balancer died a minute before the picture.
App ServerInstance sizesmallTwo equal servers behind both balancers.
App ServerInstance sizesmallTwo equal servers behind both balancers.
DatabaseInstance sizemediumMedium, shared by both servers.

Research this Design needs: DNS round robin, Load balancing, Health checks.

Drag to pan. Hold Ctrl or Cmd and scroll to zoom.

At 3.00k Users the Simulation solves this Design to Apdex 1.00, p99 247 ms, 0.0% errors and $2.28/s Burn.
WhereSettingValueWhy
DNSTTL (s)30A short answer lifetime lets DNS drop a dead Load Balancer within seconds, at the price of more lookups.
Load BalancerStateDownThe same Load Balancer, down for the same minute.
App ServerInstance sizesmallTwo equal servers behind both balancers.
App ServerInstance sizesmallTwo equal servers behind both balancers.
DatabaseInstance sizemediumMedium, shared by both servers.

Research this Design needs: DNS round robin, Load balancing, Health checks.

Both pictures show one minute after a Load Balancer died. DNS splits traffic evenly between two Load Balancers, and both reach the same two App Servers. A long TTL keeps sending users to the dead one. A short TTL has dropped it.

Why it works#

DNS answers are cached by resolvers for the TTL. With a long TTL, half the requests keep going to the dead Load Balancer until the TTL runs out. With a short one, DNS stops handing out the dead address within a lookup or two, and errors return to zero.

What it costs#

DNS has no health checks until you research them, so a dead host keeps its share. It also ignores size, so a small host gets as much as a large one. A short TTL means more lookups, and some resolvers hold answers longer than you ask. The TTL is a promise about the best case, not a guarantee.

In Quorum#

The DNS Component unlocks with DNS round robin. Changing the TTL needs Health checks, and DNS drops a dead host only once your Team has also built the Health check endpoint. The glossary defines DNS round robin. The next rung is static files on object storage and a CDN.