Interview Questions
These load balancer questions come up in cloud interviews. In every answer, be clear about a healthy target, the target group, and the difference a region makes.
Load balancer वर हे प्रश्न cloud interview मध्ये नक्की येतात. प्रत्येक उत्तरात healthy target, target group, आणि region चा फरक स्पष्ट सांगा.
Load balancer पर ये सवाल cloud interview में जरूर आते हैं. हर जवाब में healthy target, target group, और region का फरक साफ बताओ.
- Q1. What does a load balancer do with one request?
- The user hits one DNS name. DNS sends them to the load balancer. The balancer picks one healthy target, sends the request, and returns the response. The user does not pick the EC2 instance.
- Q2. Is the load balancer an EC2 instance?
- No. You do not install Nginx on it. Your EC2 instances serve the page. You choose how many are registered. This lab uses 2. One healthy target is the minimum that still answers. An Auto Scaling group can change that count.
- Q3. What is wrong with manual DNS round robin?
- Two A records send users to IP1 and IP2, but nothing checks health. When instance A is stopped, DNS still returns IP1 until you remove the record and the TTL expires.
- Q4. When do you choose an Application Load Balancer?
- HTTP or HTTPS, when host or path rules must send example.com and api.example.com, or
/and/api/, to different target groups. - Q5. When do you choose a Network Load Balancer?
- TCP or UDP, or when you need a static IP. Port 443 can pass through so the instance's certificate is the one the client sees.
- Q6. What is a Gateway Load Balancer for?
- Firewall and other inspection appliances, using GENEVE on port 6081 and a route to a Gateway Load Balancer endpoint. Not for a normal Nginx site.
- Q7. What about a Classic Load Balancer?
- Only if an old setup already uses it. Do not create one for a new lab. It has neither the Application Load Balancer's host and path rules nor the Network Load Balancer's static IP.
- Q8. What is a target group?
- The list of instances, the port, and the health check. A listener forwards to a group. A path rule can forward
/api/*to a different group than the default. - Q9. What is the difference between round robin and least outstanding requests?
- Both run inside one target group, after a listener rule has chosen that group. Round robin takes turns. Least outstanding requests prefers the target with fewer requests still in flight.
- Q10. What happens if every target is unhealthy?
- The Application Load Balancer returns 502. The DNS name can still resolve. Manual DNS would have kept sending people to the dead IP instead.
- Q11. Can one Application Load Balancer cover Mumbai and Singapore?
- No. Each region has its own load balancer and its own EC2 instances. Route 53 latency routing or geolocation routing sends the user to one region's balancer. That balancer then distributes only across EC2 instances in that region.
- Q12. How does this stay up while Auto Scaling replaces an instance?
- The new instance is registered in the target group. Wait until it is healthy. Only then remove the old one. The old one drains first. Stopping the only healthy instance before that is the 502.
- Q13. Why would one Application Load Balancer have three target groups?
- Web, API, and images, or browsing and checkout, do not share a port or a spare capacity. Example:
TG-webport 80 with 2 instances,TG-apiport 8080 with 3,TG-imagesport 80 with 2. Path rules choose the group. - Q14. What is a listener, and which rule runs first?
- Protocol, port, default action, and rules. The smaller priority number is checked first. The first match wins. Port 80 can redirect to 443 with a 301. The certificate is on 443 only.
- Q15. What do we set on a health check, and what must
/healthreturn? - For the web group we set path
/health, port traffic-port, interval 30 seconds, timeout 5 seconds, healthy threshold 2, unhealthy threshold 2, success code 200. The page returns 200 from the process. It should not depend on a slow database. A 302 from/to login marks every target unhealthy. - Q16. How is an internal balancer different from an internet-facing one?
- Internet-facing uses public subnets and a public DNS name. Internal uses private addresses only. The scheme is chosen at create time and is not flipped later. The app tier stays internal so the internet cannot skip the web tier.
- Q17. Where are the load balancers in a three-tier drawing, and where is the database?
- Internet-facing balancer, web Auto Scaling group (min 2, desired 2, max 6, port 80), internal balancer, app Auto Scaling group (min 2, desired 2, max 4, port 8080), then RDS. No balancer in front of the primary. Port 3306 is allowed only from the app security group.
- Q18. What changes when Network Load Balancer cross-zone is off, with 2 targets in one zone and 4 in the other?
- Each node uses only its own zone. If DNS splits clients about in half, the 2 targets get about 25 percent of total traffic each, and the 4 get about 12.5 percent each. With cross-zone on, each of the 6 gets about 16.7 percent. An Application Load Balancer cannot turn this off at the balancer.
- Q19. How can one name, www.example.com, reach two regions?
- Two alias A records in Route 53, both named www, each aliasing a regional balancer. Latency routing is the worked example: Pune, about 20 ms to Mumbai and about 150 ms to Ireland, receives the Mumbai balancer. Geolocation is the other policy. Turn on evaluate target health. Without it, the dead region can still be returned. This is not cross-zone, and it is not one balancer with targets in both regions.