AWS Elastic Load Balancer and Auto Scaling

EnableGeek
4 min readApr 20, 2023

--

It’s a massive challenge to handle thousands or millions of concurrent connections. Here, AWS provides ways to do this without failure. Their system architecture, hardware, and software are designed to such a degree that even with millions of video streams, their service doesn’t fail. This is why even Netflix uses AWS to avoid getting its hands dirty with cloud management. Aside from Netflix, AWSs’ customers are Adobe, Airbnb, ESPN, NASA, Sony, Samsung, The Financial Times, and many, many more.

AWS provides an Elastic Load Balancer and auto-scaling, both of which are necessary to maintain a reliable service and distribute resources among users properly. Also, to handle the massive connections to databases, AWS provides read replicas. In this article, we will discuss Elastic Load Balancer and Auto Scaling and the relation between them.

AWS Elastic Load Balancer

For web applications with a heavy workload, there might be a problem of overloading; too much traffic might come at once for the instance to handle. To tackle this problem, AWS provides Elastic Load Balancer (EBS). It distributes the incoming traffic to multiple instances, so the incoming traffic can be distributed among the individual instances to reduce computing.

Types of Load Balancers

AWS supports two types of load balancers.

1. Application Load Balancers (ALB)

Application load balancers route HTTP/HTTPS (layer 7) or traffic. Among the load balancers, ALB takes the most time. Because it processes the incoming signal, unwraps the incoming protocols, and then sends the signal to different targets.

ALB supports path-based mapping. It also supports dynamic port mapping; so different instances can run on different ports. It helps if the instances are distributed over multiple server renderers (Nginx, Apache).

2. Network Load Balancers (NLB)

NLB handles TCP (Layer 4) traffic. ALB forwards incoming requests without modifying headers. It takes less time to process incoming signals than ALB. According to AWS documentation, NLB can handle millions of requests per second. NLB also supports dynamic port mapping.

Advantages

  • EBS helps to improve fault tolerance.
  • It does auto-health checks, so services are always up if the instances are spread over multiple zones.
  • For large applications, the server response becomes very fast due to the increased processing power distributed over multiple instances.
  • EBS can perform auto-scaling, so no matter how intensive the incoming traffic might get, the web application is always responsive.

Disadvantages

  • Because the network must go through an additional layer of load balancing, applications might face a little latency.
  • For databases, all the data in all the targets of the load balancer must be synced consistently. Or else the user will face data inconsistency. To handle this type of operation, extra thought needs to be given to the overall system architecture.
  • For high traffic, EBS can be costly.

When it comes to user satisfaction, and if the return on your investment is high, then surely AWS Load Balancer is worth the cost.

AWS Auto Scaling

If your web application is facing too much dynamic traffic, then it might be beneficial for you to consider AWS Auto Scaling. AS provides easily implementable horizontal scaling services (AWS DynamoDB, RDS, and Read Replica). For some times of the day, an application might face too much traffic; and for other times of the day, there might not be too much traffic. Auto-scaling provides dynamic instance launching. So, for example, if there is too much traffic coming to your Auto Scaling Group instances, then AS launches more instances. And if there is less traffic, it terminates extra instances.

Auto Scaling Group: To configure AS the Auto Scaling Group (ASG) is used. ASG contains a collection of logical instances, for the management of the auto-scaling service. It does an auto health check. So, if an instance doesn’t work, it launches extra instances to replace it. ASG also manages minimum/maximum instances for the AS to handle.

When Should You Use Auto Scaling

  • If your application has varying traffic over time, then having a fixed number of instances may be costly for you. Because there will be times when all of your instances might be unused. For this type of case AS is preferable. AS will increase your instances when traffic is high, and it will decrease your instances when traffic is low.
  • For high-resource applications (Video services, Gaming), there might be anomalies due to some cultural events. The traffic suddenly might get high for a popular service. For this type of service, not using AS can cause reputational damage to large companies. So, to be safe, large companies should use AS.

Auto Scaling and Elastic Load Balancer

Autoscaling is mostly used for instances, while load balancers can distribute loads over instances, containers, and IPs. So ELB can work with outside vendors. AS copies an instance, then launches it as a new instance. So, there is just a single instance distributed with large resources.

If AS is enabled with ELB, then newly launched instances are automatically registered with the ELB. Likewise, if the instances are terminated, the ELB automatically deregisters the instances.

In this article, you have learned about elastic load balancers, auto-scaling, and the relationship between them. To allocate more resources to your end users, you must understand these and choose the type of scaling you want to use.

--

--

EnableGeek

EnableGeek brings you all the curated tutorials and resources. See you at https://www.enablegeek.com .