Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 18: Load Balancing

Practice Questions and Lab Exercises

Now do this lab yourself. When you finish, delete the load balancer.

  1. Write the eight steps of one request, from the DNS name to the response, with no product names invented.
  2. The balancer is not an EC2. How many EC2 instances does this lab register, what is the minimum that still returns a page, and what can change that count?
  3. Instance A is stopped and DNS still has both A records. What does the user who received IP1 see? What does a target group do differently?
  4. Which row do you use for HTTP host rules, for TCP with a static IP, for a firewall appliance, and for an old Classic balancer?
  5. Two instances are healthy in site-a-tg. Which setting takes turns, and which setting prefers the quieter instance? Which feature sends /api/* to site-b-tg instead?
  6. Draw Mumbai and Singapore. Why can lab-alb not register a Singapore EC2? What does Route 53 send back, and what does the chosen balancer do next?
  7. Lab. Do these in order.

    1. Put Nginx on instance A and instance B with different pages.
    2. Open IP1 and IP2 and write down both sentences.
    3. Stop A and show that IP1 fails while IP2 still works. Start A again.
    4. Create site-a-tg and site-b-tg and wait until both are healthy.
    5. Create lab-alb forwarding port 80 to site-a-tg.
    6. Add the path rule /api/* to site-b-tg.
    7. Add the host rule api.example.com to site-b-tg.
    8. Curl /, /api/, and both Host headers. Save the four answers.
    9. On paper, add a second region and a Route 53 latency record. Do not launch extra instances.
    10. Delete lab-alb and any Network Load Balancer you created. Deregister the targets.
  8. On paper, one balancer, three groups: TG-web 2 instances port 80, TG-api 3 instances port 8080, TG-images 2 instances port 80. Which path reaches which group, and what is the default when no rule matches?

  9. Health check values we set: interval 30 seconds, healthy threshold 2, unhealthy threshold 2. About how long is two successes, and about how long is two failures on the checkout group if its interval is 10 seconds?
  10. Draw the internet-facing balancer in 172.16.0.0/24 and 172.16.1.0/24, and the internal balancer in 172.16.10.0/24 and 172.16.11.0/24. Who is allowed to open port 8080?
  11. Network Load Balancer, cross-zone off, AZ a has 2 healthy targets, AZ b has 4. If half the clients arrive at each node, what share does one AZ a target get, and what share does one AZ b target get? What is each target's share when cross-zone is on?
  12. Two alias records for www.example.com, latency routing, evaluate target health on. Mumbai targets are all unhealthy. Which region's balancer should Route 53 return?

Understood? A load balancer is one DNS name, it picks a healthy EC2, and it sends the response back. Another region needs another balancer. Now repeat the lab without looking at the notes.

Quick Revision

  • One request: DNS name, load balancer, one healthy target, response back. The user does not choose the EC2.
  • The balancer is not your EC2. Minimum that answers is 1 healthy target. This lab uses 2. Auto Scaling can change the count. Zero healthy targets is a 502.
  • Manual DNS can return two IPs. It does not notice a stopped instance.
  • Manual DNS when you have no balancer. ALB for HTTP/HTTPS and path or host rules. NLB for TCP/UDP and a static IP. GWLB for firewall appliances. Classic only if an old setup already uses it.
  • A target group is the instance list plus the health check. One listener forwards to a group. /api/* can forward to another group.
  • Round robin and least outstanding requests choose an instance inside the chosen group. Host and path rules choose the group.
  • One Application Load Balancer does not span regions. Each region has its own balancer and its own EC2 instances. Route 53 latency or geolocation routing picks the region. That balancer then distributes inside the region.
  • New instance healthy first, then remove the old one.
  • One balancer, many target groups. Rules pick the group. TG-web 2 on port 80, TG-api 3 on port 8080, TG-images 2 on port 80. Checkout desired 2 stays apart from browsing desired 4.
  • Listeners: HTTP 80 redirects 301 to HTTPS 443. Smaller priority number wins. Certificate on 443 only. Port 8080 stays on the internal balancer.
  • Health check we set: /health, 30 seconds, timeout 5, healthy 2, unhealthy 2, success 200. Do not point it at a login redirect or a slow database.
  • Internet-facing balancer in public subnets. Internal balancer in private subnets. Scheme is fixed at create time.
  • Three tiers: public balancer, web group min 2 desired 2 max 6, internal balancer, app group min 2 desired 2 max 4, RDS with no balancer in front. Port 3306 only from the app tier.
  • Application Load Balancer cross-zone stays on. Network Load Balancer cross-zone is off until you enable it. 2 and 4 targets: about 25 percent and 12.5 percent when off, about 16.7 percent each when on.
  • One name www.example.com, two regional balancers, Route 53 latency or geolocation. Failover needs evaluate target health. That is not cross-zone.