Updated on 2024-08-01 GMT+08:00

Shared Load Balancer Overview

A load balancer distributes incoming traffic across multiple backend servers. Before using a load balancer, you need to add at least one listener to it and associate one backend server with it.

Figure 1 ELB components

Region

When you select a region, note the following:
  • The region must be close to your users to reduce network latency and improve the download speed.
  • Shared load balancers cannot distribute traffic across regions. When creating a load balancer, select the same region as the backend servers.

Network Type

Shared load balancers can work on both public and private networks.
  • To distribute requests over the Internet, you need to assign an EIP or bind an existing EIP to a load balancer so that it can route requests from the Internet to backend servers.
  • If you want to distribute requests within a VPC, create a private network load balancer. This type of load balancers has only private IP addresses and can be only accessed within a VPC.

Protocol

ELB provides load balancing at both Layer 4 and Layer 7.

  • If you choose TCP or UDP, the load balancer routes requests directly to backend servers. In this process, the destination IP address in a packet is changed to the IP address of the backend server, and the source IP address to the private IP address of the load balancer. A connection is established after a three-way handshake between the client and the backend server, and the load balancer only forwards the data.
    Figure 2 Layer-4 load balancing
  • Load balancing at Layer 7 is also called "content exchange". Once the load balancer receives a request, it works as a proxy for backend servers and initiates a connection (three-way handshake) with the client. It then determines which backend server to route the request to based on the fields in the HTTP/HTTPS request header and the load balancing algorithm you select when you add the listener.
    Figure 3 Layer-7 load balancing

    ELB establishes persistent connections between the clients and the load balancers to reduce the costs of a large number of short connections. After a persistent connection is established, the client can keep sending HTTP or HTTPS requests to the load balancer until the connection times out.

Backend Server

Before you use ELB, you need to create cloud servers, deploy required applications on them, and add the cloud servers to one or more backend server groups. When you create cloud servers, note the following:

  • Cloud servers should be in the same region as the load balancer.
  • Cloud servers that run the same OS are recommended so that you can manage them more easily.
  • ELB does not support File Transfer Protocol (FTP), but supports Secure File Transfer Protocol (SFTP) on backend servers.