The Concept Of AWS ELB(Elastic Load Balancing)
17120
post-template-default,single,single-post,postid-17120,single-format-standard,bridge-core-1.0.4,ajax_fade,page_not_loaded,,qode_grid_1200,qode-theme-ver-18.0.8,qode-theme-bridge,disabled_footer_top,wpb-js-composer js-comp-ver-5.7,vc_responsive
 

The Concept Of AWS ELB(Elastic Load Balancing)

The Concept Of AWS ELB(Elastic Load Balancing)

Background

✅ Scale-up & Scale-out

There are two categories of responses to increased traffic on the server.
Scale-up : Respond by expanding the performance of the server itself (e. g. Upgrading a computer’s CPU from i7 to i10 )
Scale-out : Respond by adding more servers (e. g. Buying more new computers)

If you choose a highly available scale-out method, load balancing is required to distribute traffic evenly across multiple servers.

✅ Load Balancing

Load balancing is a technology that appropriately distributes and solves the load rate (traffic) of the server, load, and speed, and operates based on various algorithms.

  • Round Robin Method : The way to assign requests that come into the server in order
  • Weighted Round Robin Method : The way to prioritize the distribution of requests based on the weights you set for each server
  • IP Hash Method : The way to connect a client’s IP address to a specific server to ensure that connections are always made to the same server
  • Least Connection Method : The way to distribute requests to servers with the lowest traffic at the time the request comes in
  • Least Response Time Method : The way to distribute traffic considering the server’s connection status and response time

✅ OSI(Open Systems Interconnection Reference Model) 7 Layer

The OSI 7 layer is a standard protocol published by the International Organization for Standardization in 1984 for equipment compatibility between information carriers, and is classified into hardware belonging to the lower layer and software belonging to the higher layer.

  • (* The upper layer inherits the functionality of the lower layer.)
  • 1- Pysical Layer : Layer that provides hardware transfer technology by representing physical requirements such as cable type, radio frequency link, pin, voltage, etc (e.g. modem)
  • 2- Data Link Layer : Layer that provides technology for transmitting data between by framing data according to the network transmission scheme (e.g. Ethernet)
  • 3- Network Layer : Layer that provides the technology to send data in small packets (e.g. IP)
  • 4- Transport Layer : Layer that provides communication technology that connects senders to receivers within network components and protocols (e.g. TCP)
  • 5- Session Layer :  Layer that provides technology for controlling and maintaining synchronization between processes, such as establishing and disconnecting session connections (e.g. SSL)
  • 6- Presentation Layer : Layer that provides technologies such as data translation, encryption, and decryption as data translators (e.g. JPEG)
  • 7- Application Layer : Layer that provides the interface for access to the network (e.g. FTP)

✅ L4 / L7 Load Balancing

Load distribution is possible based on port information from layer 4 (L4) of network communication layers. L4 and L7 load balancers are the most widely used for this load balancing.

  • L4 Load Balancing
    – Load distribution based on information from Transport Layer
    – Traffic is distributed primarily based on TCP, UDP port information
    – Advantages: Because traffic is distributed only at the packet level, it is fast and efficient
    – Disadvantages: Delicate routing is not possible
  • L7 Load Balancing
    – Load distribution based on information from the Application Layer
    – Distribute traffic primarily based on user requests such as HTTP headers and cookies
    – Advantages: Delicate routing and filtering of viruses or abnormal traffic (e.g.DoS/DDoS) provide excellent security
    – Disadvantage: Higher price requirement than L4 Load Balancing

 

Amazon Elastic Load Balancing

✅ ELB

Elastic Load Balancing (ELB) is a load-balancing product provided by AWS. Automatically distributes traffic to multiple targets, such as the Amazon EC2 instance, IP address, Lambda, and so on, providing high availability, auto-adjustment, and high security for fault tolerance.

✅ ELB Type

Available in 3 choices based on APP’s requirements

1. CLB (Classic Load Balancer) : Operating at L4(Transport) and L3(Network)
Application target built with EC2 – Classic network
Relatively large server configurations
The oldest load balancer and infrequently used trend!

2. ALB : Application Load Balancer : Operating at L7(Application)
⇒ Ideal for advanced load balancing services such as http, https
→ HTTP, HTTP listener registration only
Providing optimized load balancing for microservices and applications
Enable to map to different target groups depending on the path or port
Enable to connect to EC2 Instance, Lambda, IP

3. NLB(Network Load Balancer) : Operating at L4(Transport)
→ Load balancing TCP/UDP traffic and forwarding it to the internal instance
Easy to handle incoming traffic and forward traffic to internal instances
Enable to handle millions of requests per second while maintaining minimum latency
One static IP address per AZ, ideal for handling unstable traffic

✅ External-ELB and Internal-ELB

  • External-ELB → ELB receiving requests from the Internet → It must be created within the public subnet of the VPC because it must receive requests from the Internet.
  • Internal-ELB → ELB receiving only internal requests from VPC Subnet → Because elastic IP is not given, creating a public subnet does not allow access to the Internet.
  • Together, these two ELBs allow you to configure an architecture that distributes requests across multiple tiers of applications, such as a three-tier system (web server, AP server, DB server)

✅ Other ELB-related concepts

– Listener & Rule

  • Using with Application Load Balancing
  • Listener can be branched by port and protocol
  • Rule can be branched by path or Amazon Resource Name (ARN) under Listener

 

– Cross Zone Load Balancing

  • Suitable for situations where there is a difference in the number of EC2s used in each zone → NLB is off by default. → ALB internally (by default) has Cross Zone Load Balancing turned on.

 

– Health Check

  • Ability to verify that the EC2 instance is up and running normally
  • Load balancer performs a Health Check on the target → If it is determined that an EC2 instance is interrupted, the EC2 instance is excluded from traffic distribution. → If the health check fails as much as Threshold, load balancer is excluded from the service and added to the service when the target becomes healthy again. (auto)

 

– Sticky Sessions

  • The ability to check the user’s session and distribute traffic to the appropriate EC2 instance
    ex) Load Balancing for L7 with HTTP Cookies
  • All incoming requests are processed in the same EC2 while the user session is maintained.
  • Available in ALB, CLB (Not available in NLB) → When the Sticky Session is enabled in the ALB, the request is sent to the Target Group, not the EC2 unit.

 

– Connection Draining

  • Preventing Auto Scaling from immediately deleting EC2 instances that are processing a user’s request
  • ex) When the number of users decreases, Auto Scaling deletes the EC2 instance, and when a user downloads a file from that instance, the instance is deleted and the file is broken. → Therefore, it waits for the request to be processed for the specified time before deleting it.

 

– Latency

  • Delay time between ELB load balancer and EC2 instance

 

– HTTP 2XX, 4XX, 5XX

  • HTTP Response Code Returned from EC2 Instance

 

– ELB HTTP 4XX, 5XX

  • HTTP Error Code Returned from ELB Load Balancer

 

– Surge Queue Length

  • Number of requests that are not passed from the ELB load balancer to the EC2 instance and remain in the queue

 

– Spillover Count

  • Number of requests rejected by the ELB load balancer because the surge queue is full