DNS load balancing LB

Not Just Restart
3 min readSep 6, 2022

--

DNS load balancing is to connect regional application stack and balance the traffic across region.So application can run across multiple region and run with a data store that shares data make it accessible across those region.

This is the standard way for clients to resolve domain name of the service to get the IP address to use when accessing the service.

VIP’s. Domain can be configured with one or more IPs by using VIP’s and these VIP’s address are target to balance the load that FE front end application stacks. DNS is configured by app owner or SRE with routine policy to determine how VIP are given out to clients

Routing policy

  • Round robin
  • Weighted round robin
  • Geo-Mapping

Round robin

DNS request are routed and shared across multiple IP/VIP’s to serve that domain.

Weighted Round robin

DNS request are assigned to different VIP based on SRE configured weight. 50% or 20%.

Geo-Mapping

Creating geo mapping of clients to an edge region and DNS will assigned to closest IP/VIP. DNS LB has own knowledge of IP prefix map to know geographic. This will bound with latency associated with reaching geographic. Mapping comes which region client belongs to. Region destination VIP’s belong to when processing request.

Health checks

Health check is crucial when LB is coupled with DNS. LB does the health check by sending request to VIP as if it were with real traffic.This type of health check is common and it does ma y region. It will get the reasonable level of confidence that VIP is indeed healthy.

After status is collected, unhealthy VIP/IP will get removed from the pool of DNS routing assignment.

DNS LB can also be setup like request can routed from primary VIP to secondary/Failover VIP based on health checks.

TTL (Time To Live)

DNS request will get kicked off when DNS cache expires such as configuring TTL(Time To Live). Resolved address is the address client will send the request to.

Actually client will continue to use that resolved address untill the TTL expires and continue to send request to the assigned region. This the service behind domain.

Problem with TTL is it affects the Failover time and availability of the application and it impacts user experience aswell.

Let’s take this picture we have two region AA and BB. Domain name is example.com. when request hit this URL it will resolve example.com it will be answered by DNS LB and mapped to VIP based on which routing policy.

If Region AA is unhealthy DNS LB knows and it will update the DNS routing not to use aa.example.com.

For clients who are all already using aa example.com they have to wait for TTL to get expired before they contact DNS and then it will be routed to bb.example.com.

Actually TTL will affect the availablity for those clients during this resolution.

Geo-Mapping vs Weighted Round robin merits and de-merits

Let’s assume 200 DNS request comes from around region AA and 100 DNS request comes from region BB.

DNS Geo mapping

Region AA will receive all traffic from AA and Region BB will get all requests from BB. This will produce best latency and unequal load on two region. In this case resources will get exhaust and auto scaling has to be in place.

DNS weighted Round robin

Send 50% of request to Region AA and another 50% send to region BB. 150 DNS request will hit to Region AA and BB each.

Here load is well balanced and but latency affects.

Client will be mapped across region. DNS won’t understand the actual load received by each service in each region and load will even out over time.

This is sometimes not true, Client may generate more request.

Conclusion is number of request to a region do not directly correlate with number of DNS request.

--

--

Not Just Restart
Not Just Restart

Written by Not Just Restart

Software Engineer, SRE, Devops, System Architect

No responses yet