Updated on 2024-06-20 GMT+08:00

Dedicated 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

  • You are advised to select a region that is closest to your users to reduce network latency and improve the download speed.
  • You can add servers in a different VPC from where the load balancer is created, or in an on-premises data center, by using private IP addresses of the servers. For details, see IP Addresses as Backend Servers.
  • To add backend servers in different regions, you can use Cloud Connect to connect the VPCs across regions. For details, see the Cloud Connect User Guide.

AZ

Dedicated load balancers can be deployed across AZs. If you select multiple AZs, a load balancer is created in each selected AZ.

To reduce network latency and improve access speed, you are suggested to deploy your load balancer in the AZ where backend servers are running.

Load balancers in different AZs work in active-active or multi-active mode, and requests are distributed by the nearest load balancer in the same AZ.

Table 1 Disaster recovery planning

DR Solution

Application Scenario

Advantage

Select multiple AZs for a load balancer.

If the number of requests does not exceed what the largest specifications can handle, you can create a load balancer and select multiple AZs.

If the load balancer in an AZ goes down, the load balancer in other AZs takes over to route traffic.

Create multiple load balancers and select multiple AZs for each load balancer.

If the number of requests exceeds what the largest specifications can handle, you can create multiple load balancers and select multiple AZs for each load balancer.

If a load balancer in an AZ goes down, another load balancer in the same AZ or other AZs takes over to distribute traffic.

Table 2 Traffic distribution

Source

Traffic Distribution

Internet

If requests are from the Internet, the load balancer in each AZ you select routes the requests based on source IP addresses. If you select two AZs for a load balancer, the requests the load balancers can handle will be doubled.

Private network

  • If clients are in the same AZ as the load balancer, requests are distributed by the load balancer in this AZ. If the load balancer goes down, requests are distributed by the load balancer in another AZ.

    If the load balancer is healthy but the connections that the load balancer needs to handle exceed the amount defined in the specifications, service may be interrupted. To address this issue, you need to upgrade specifications.

    You can monitor traffic usage on private networks by AZ.

  • If clients are in an AZ that is different from the load balancer, requests are distributed by the load balancer in each AZ you select based on source IP addresses.

Direct Connect connection

If requests are from a Direct Connect connection, the load balancer in the same AZ as the Direct Connect connection routes the requests. If the load balancer in this AZ goes down, requests are distributed by the load balancer in another AZ.

A VPC that is different from where the load balancer works

If requests are in a VPC that is different from where the load balancer works, the load balancer in the AZ where the original VPC subnet works routes the requests. If the load balancer in this AZ goes down, requests are distributed by the load balancer in another AZ.

Specifications

Dedicated load balancers provide a wide range of specifications to meet your requirements.

Network load balancers can route TCP or UDP requests, while application load balancers route HTTP or HTTPS requests.

Select appropriate specifications based on your traffic volume and service requirements. For details, see Specifications of Dedicated Load Balancers.

You can view the monitoring metrics on the Cloud Eye console to analyze the peak traffic and usage trends to select the specifications as needed.

For details, see Table 3.

Table 3 Guide for selecting a specification

Specifications

Description

Network load balancing (TCP/UDP)

Pay attention to the maximum number of concurrent connections and consider maximum concurrent connections as a key metric. Estimate the maximum number of concurrent connections that a load balancer needs to handle and select the corresponding specification.

Application load balancing (HTTP/HTTPS)

Consider QPS as a key metric, which determines the service throughput of an application system. Estimate the QPS that a load balancer needs to handle and select the corresponding specification.

Protocols

ELB provides load balancing at both Layer 4 and Layer 7. Choose an appropriate protocol when you add a listener to a load balancer.

  • Network load balancers work well for heavy-traffic workloads that need to handle massively concurrent requests at Layer 4, such as file transfer, instant messaging, and online video services.
    Figure 2 Layer 4 load balancing
  • Application load balancers handle Layer 7 requests and support advanced forwarding policies.
    Figure 3 Layer 7 load balancing
Table 4 Protocols

Protocol

Description

TCP/UDP

After receiving a request, the listener routes it 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.

HTTP/HTTPS

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.

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.

Network Type

Dedicated load balancers can work on both public and private network.

Table 5 ELB network types

Network Type

Note

Application Scenarios

Load balancing on a public network

You need to assign an EIP or bind an existing EIP to this type of load balancers.

They can receive requests from the Internet and route the requests to backend servers.

  • A load balancer is used as a single point of contact for clients when a group of servers provide services over the Internet.
  • Fault tolerance and fault recovery are necessary.

Load balancing on a private network

This type of load balancers has only private IP addresses and can be only accessed within a VPC.

They receive requests from clients in a VPC and route the requests across backend servers in the same VPC.

  • There are multiple backend servers, and requests need to be evenly distributed across these servers.
  • Fault tolerance and fault recovery are necessary.
  • You do not want IP addresses of your physical devices to be exposed.

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 must 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.