This topic describes the considerations for configuring a Classic Load Balancer (CLB) instance. Before you create a CLB instance, you must determine the listener type and network type of the CLB instance.

Select the region of the CLB instance

When you select a region, take note of the following issues:

  • To reduce the network latency and increase the downloading speed, we recommend that you select the region that is closest to your users.
  • To provide more stable and reliable load balancing services, CLB supports primary/secondary zone deployment in most regions. This implements disaster recovery across data centers in the same region. We recommend that you select a region that supports primary/secondary zone deployment.
  • CLB does not support cross-region deployment. Therefore, you must deploy the CLB instance and backend Elastic Compute Service (ECS) instances in the same region.

Select the network type of the CLB instance

CLB provides load balancing services to the Internet and private networks:

  • If you want to use CLB to distribute requests from the Internet, create an Internet-facing CLB instance.

    An Internet-facing CLB instance is assigned a public IP address to receive requests from the Internet.

  • If you want to use CLB to distribute requests from private networks, create an internal-facing CLB instance.

    An internal-facing CLB instance is only assigned a private IP address of Alibaba Cloud. You must access the CLB instance through networks of Alibaba Cloud.

Select an instance type

CLB provides various instance types that can meet different business requirements.

  • For a pay-as-you-go CLB instance, we recommend that you select the instance type that provides the highest level of performance. This guarantees a flexible load balancing service without incurring additional costs. However, if the capacity of Super I (slb.s3.large), which is the highest-performance CLB instance type, exceeds your business demand, you can select a more appropriate type, such as Higher II (slb.s3.medium).

Select a listener protocol

CLB supports Layer 4 (TCP and UDP) and Layer 7 (HTTP and HTTPS) load balancing:

  • A Layer 4 listener directly distributes requests to backend servers without modifying packet headers. After a client request reaches a Layer 4 listener of CLB, CLB uses the backend port that is configured for the listener to establish a TCP connection with a backend ECS instance.
  • A Layer 7 listener functions as a reverse proxy. After a client request reaches a Layer 7 listener of CLB, CLB establishes a new TCP connection over HTTP with a backend server, instead of directly forwarding the request to the backend server.

    Compared with Layer 4 listeners, Layer 7 listeners require an additional step of Tengine processing. In addition, the performance of Layer 7 listeners can also be affected by factors such as insufficient client ports or excessive backend server connections. Therefore, we recommend that you use Layer 4 listeners for high-performance load-balancing services.

    For more information, see Protocols.

Create backend servers

Before you use the CLB service, you must create ECS instances, deploy applications on the ECS instances, and then add the ECS instances to your CLB instance to process client requests.

When you create and configure ECS instances, take note of the following issues:
  • Region and zones of the ECS instances

    Make sure that the ECS instances and the CLB instance are deployed in the same region. In addition, make sure that the CLB instance and the ECS instances belong to the same VPC. We recommend that you deploy the ECS instances in different zones to improve the availability. For more information about how to create an ECS instance, see Create an instance by using the wizard.

    In this example, two ECS instances named ECS01 and ECS02 are created in the China (Hangzhou) region. The following figure shows their basic configurations.

  • Configurations
    In this example, two static web pages are hosted on ECS01 and ECS02 by using Apache.
    • Enter the elastic IP address (EIP) that is associated with ECS01 in the address bar of your browser.
    • Enter the EIP that is associated with ECS02 in the address bar of your browser.
    No additional configurations are required after you deploy applications on the ECS instances. However, if you want to use a Layer 4 (TCP or UDP) listener and the ECS instances run Linux, make sure that the following parameters in the net.ipv4.conf file under /etc/sysctl.conf are set to 0:
    net.ipv4.conf.default.rp_filter = 0
    net.ipv4.conf.all.rp_filter = 0
    net.ipv4.conf.eth0.rp_filter = 0