This topic describes the preparations that you must complete before you use the Classic Load Balancer (CLB) service. For example, you must determine the type of listener that your business requires and the type of network to deploy a CLB instance before you use the Classic Load Balancer (CLB) service.

Select a region to deploy a CLB instance

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

  • By default, you cannot deploy a CLB instance across multiple regions. Make sure that the CLB instance and the Elastic Compute Service (ECS) instances that you want to add to the CLB instance belong to the same region.

    For example, if the ECS instance that hosts your services is deployed in the China (Hangzhou) region, you must create a CLB instance in the China (Hangzhou) region. This way, you can add the ECS instance to the CLB instance.

  • CLB supports primary/secondary zone deployment in most regions. You can deploy a CLB instance across zones to achieve disaster recovery across data centers in the same region. This ensures service stability and reliability. We recommend that you select a region that supports primary/secondary zone deployment.

Select the type of network to deploy your CLB instance

CLB provides load balancing services over the Internet and the internal network.

  • 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 the internal network, create an internal-facing CLB instance.

    An internal-facing CLB instance uses a private IP address from the IP address pool of Alibaba Cloud to distribute requests within the internal network of Alibaba Cloud. An internal-facing CLB instance cannot distribute requests over the Internet.

Select a specification for your CLB instance

For a pay-as-you-go CLB instance, we recommend that you select the highest specification to guarantee a flexible load balancing service and without additional cost. If the capacity of the highest specification (slb.s3.large) exceeds your business demand, you can select a specification more suitable for your business, such as slb.s3.medium.

Select a listening protocol

CLB supports Layer 4 load balancing over TCP and UDP and Layer 7 load balancing over HTTP and HTTPS.

  • A Layer 4 listener 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 associated with the listener to establish a TCP connection to 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 to a backend server over HTTP, 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. The throughput capacity of Layer 7 listeners may be limited by factors such as client port exhaustion or excessive workloads on backend servers. If your business requires higher performance, we recommend that you use Layer 4 listeners.

    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 ECS instances, take note of the following items:
  • 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 virtual private cloud (VPC). We recommend that you deploy the ECS instances across multiple zones to improve service availability. For more information about how to create an ECS instance, see Create an instance by using the wizard.

    In this example, an ECS instance named ECS01 and an ECS instance named ECS02 are created in the China (Hangzhou) region.

  • You must deploy your applications on the ECS instances.
    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. ECS01
    • Enter the EIP that is associated with ECS02 in the address bar of your browser. ECS02
    No additional configurations are required after you deploy applications on the ECS instances. If you want to use a Layer 4 (TCP or UDP) listener and your ECS instances run Linux, make sure that the following parameters in the net.ipv4.conf file located in /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