Cloud concept · Updated

Load Balancing - Load balancing distributes incoming requests or network connections across multiple targets to improve availability and use capacity efficiently.

In short

A load balancer provides an entry point that directs traffic to a pool of application instances, containers, or other endpoints according to routing rules and health information. It helps applications handle demand and continue serving users when individual targets fail, but it does not create additional application capacity by itself.

Cloud Concepts Hub →

6 key aspects of Load Balancing

Effective load balancing combines traffic distribution, meaningful health checks, appropriate protocol handling, and coordination with resilient application capacity.

01
Traffic distribution

Traffic is assigned to eligible targets using algorithms such as round robin, connection-based selection, or weighted distribution. The goal is effective capacity use, not necessarily identical request counts on every target.

02
Health-aware routing

Health checks help identify targets that should not receive new traffic. Configure checks to represent application readiness and understand the implementation's behavior when no targets are healthy.

03
Protocol-aware selection

Transport-layer balancing distributes connections or flows, while application-layer balancing can make decisions using HTTP attributes such as hostnames and paths. Choose the layer based on application protocols and required routing behavior.

04
Availability across failure boundaries

Distributing targets across availability zones reduces dependence on one location. The load-balancing tier and backend dependencies must also be resilient for the application to remain available.

05
Integration with scaling

Load balancing spreads traffic across existing capacity, while automatic scaling changes that capacity. Registration, health checks, and graceful deregistration connect these two mechanisms.

06
Session and connection handling

Session affinity and connection draining influence how traffic behaves during normal operation and target removal. Shared session storage generally makes it easier to distribute requests and tolerate individual target failures.

Cloud services for Load Balancing

Amazon Route 53 can resolve an application name to an Elastic Load Balancing endpoint. The load balancer then distributes incoming requests or connections across registered targets. Amazon EC2 Auto Scaling adjusts virtual-machine capacity and coordinates target registration, while Amazon ECS integrates load balancing with container task lifecycles. Together, these services connect a stable client-facing name to changing application resources. DNS routing, traffic distribution, and capacity scaling remain distinct functions, and each requires appropriate health checks, network access, and failure-handling configuration.

Amazon EC2 Auto ScalingAmazon EC2 Auto Scaling

Amazon EC2 Auto Scaling adjusts the number of EC2 instances and can register or deregister them with an attached load balancer. Scaling supplies capacity; load balancing directs traffic to the instances that are ready to serve it.

Amazon Route 53Amazon Route 53

Amazon Route 53 can direct a domain name to a load balancer and use DNS routing policies to steer clients among endpoints. DNS-based distribution complements request or connection balancing, but cached DNS answers mean it does not make an independent routing decision for every application request.

Load Balancing exam questions

Real practice exam questions on Load Balancing, with the correct answer and its explanation. Answer them with every option in the exam simulator.

CLF-C02

A company runs an online store on Amazon EC2 instances. One group of instances handles catalog requests, and another group handles order requests. Both groups must use the same website hostname. The company needs a managed solution that sends requests for /catalog to healthy catalog instances and requests for /orders to healthy order instances. Which solution meets these requirements?

Show answerCORRECT ANSWER

Use an Application Load Balancer with path-based routing rules and a target group for each instance group.

An Application Load Balancer, part of Elastic Load Balancing, can route HTTP requests based on URL paths. Separate target groups with health checks allow it to send catalog and order requests to healthy instances in the appropriate group.

SAA-C03

A company runs an HTTPS application behind an Application Load Balancer (ALB). The HTTPS listener has 40 forwarding rules with mutually exclusive URL path conditions. Each rule routes requests to a different target group. The rule for /catalog/* has priority 400 and is evaluated after the other 39 rules. Requests for /catalog/* account for 90% of traffic.

Monitoring shows that rule evaluations consistently determine the ALB's billed load balancer capacity units (LCUs). Processed bytes, new connections, and active connections remain well below that level. The company must preserve the existing routing behavior and application availability.

Which change will reduce the ALB's capacity charges without adding infrastructure?

Show answerCORRECT ANSWER

Assign the /catalog/* rule an unused priority value lower than every other rule's priority value.

ALB evaluates rules from the lowest numerical priority value upward and stops when a rule matches. Moving the most frequently matched, mutually exclusive rule first preserves routing behavior while eliminating unnecessary evaluations for 90% of requests. The first 10 rule evaluations per request are excluded from billable rule evaluations, so these catalog requests will no longer contribute to that dimension.

DOP-C02

A company runs a stateless HTTP application on an Amazon EC2 Auto Scaling group behind an Application Load Balancer (ALB). The target group uses the least outstanding requests routing algorithm, and target stickiness is disabled.

During scale-out, new instances pass application health checks after 30 seconds. However, each instance needs approximately 5 additional minutes of production requests to populate an instance-local cache and reach full throughput. New instances initially receive too much traffic, causing elevated latency. Existing healthy instances have sufficient capacity to handle most traffic during this period, and every scale-out adds instances to a target group that already contains healthy targets.

A DevOps engineer must allow new instances to receive production requests as soon as they become healthy, while gradually increasing their share of traffic over 5 minutes. The solution must not require application changes or a custom traffic controller.

Which configuration meets these requirements?

Show answerCORRECT ANSWER

Change the target group's routing algorithm to round robin. Set the target group's slow_start.duration_seconds attribute to 300.

ALB slow start gradually increases the share of requests sent to a newly healthy target over the configured duration. Round robin supports slow start, whereas least outstanding requests does not. This configuration lets new instances warm their caches with production requests before receiving their full traffic share.

Practice Load Balancing in a full exam

Questions on Load Balancing in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is Load Balancing

3 min read

Load balancing separates the address clients use to reach an application from the individual resources that process its traffic. Instead of connecting directly to one server, clients connect to a load-balancing endpoint. The load balancer selects an eligible target using a configured algorithm or routing policy. Depending on the implementation, it can distribute individual requests, connections, or network flows. Its main purposes are to spread demand, improve resource utilization, and support application availability.

For example, an online store might run its application on several virtual machines across two availability zones. A load balancer directs customer traffic across those machines. If one machine fails its health checks, the load balancer normally stops selecting it for new traffic while other healthy machines continue serving requests. This reduces dependence on any single application instance. However, an existing connection to a failed machine can still break, and users may need to retry their requests.

Load balancers operate at different protocol layers. A transport-layer load balancer commonly routes TCP or UDP flows using connection information without interpreting application URLs. An application-layer load balancer understands protocols such as HTTP and can route requests according to the hostname, URL path, or other request attributes. For example, requests for /images can go to an image service while requests for /checkout go to a separate application pool. The correct choice depends on protocol support, routing requirements, connection behavior, and performance needs.

In cloud environments, load balancing commonly works with automatic scaling. A scaling system adds or removes application resources, while the load balancer distributes traffic among the registered, eligible targets. These are separate responsibilities: a load balancer does not launch more servers merely because existing servers are overloaded. Similarly, adding servers will not help unless they become reachable, pass appropriate health checks, and are registered to receive traffic.

Health checks must reflect whether a target can serve useful requests. A successful network connection may prove that a process is listening without proving that its application is working. Conversely, an unnecessarily broad health check can remove every target when a shared dependency experiences a brief problem. Failure handling also varies by implementation; some load balancers can route to unhealthy targets when every target is unhealthy. Health checks therefore support resilience but do not guarantee uninterrupted service.

Application design affects how effectively traffic can be distributed. Keeping session data in a shared store allows successive requests to reach different instances. Session affinity, sometimes called sticky sessions, can keep a user associated with one target, but may produce uneven utilization and does not preserve that target's local state after failure. Connection draining allows in-flight work time to finish before a target is removed during maintenance or scaling.

Load balancing adds cost, configuration, and another network component to troubleshoot. TLS termination can centralize certificate handling, but encryption from the load balancer to backend targets requires separate configuration. Balanced traffic also does not necessarily mean equal traffic: target weights, long-lived connections, and differences in request duration can produce unequal workloads. Monitor application latency, errors, connection counts, and target utilization rather than assuming equal request counts indicate success.

For foundational certification questions, associate load balancers with distributing incoming traffic and improving availability across multiple targets. Distinguish that purpose from automatic scaling, which changes capacity, and DNS resolution, which maps names to endpoints. A highly available design also needs redundant load-balancing infrastructure, sufficient healthy backend capacity, and resilient application dependencies; placing one server behind a load balancer does not make the entire application highly available.

Learn Load Balancing in lessons

7 short lessons on Load Balancing in 3 certification courses.

and 1 more lesson

Open the lessons