This topic describes the items that you must take note of before you use Classic Load Balancer (CLB). Before you create a CLB instance, you must determine the listener type and network type.

Select the region of the CLB instance

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

  • To reduce network latency and increase the download speed, we recommend that you select a region that is nearest to your location. Make sure that the Elastic Compute Service (ECS) instances and the CLB instance belong to the same region.
  • 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 and ensure service stability and reliability. We recommend that you select a region that supports primary/secondary zone deployment.
  • CLB does not support cross-region deployment. Therefore, make sure that the CLB instance and ECS instances belong to the same region.

Select the network type of the CLB instance

CLB provides load balancing services over the Internet and 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 is assigned a private IP address of Alibaba Cloud. You must access the CLB instance from the internal network of Alibaba Cloud.

Select a specification for your CLB instance

Alibaba Cloud provides CLB instances of different specifications.

  • For a pay-as-you-go CLB instance, we recommend that you select the highest specification to guarantee a flexible load balancing service and reduce excessive costs. If the capacity of the highest specification, Super I (slb.s3.large), exceeds your business demand, you can select a specification more suitable for your business, such as Higher II (slb.s3.medium).

Select a listener 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 configured for 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 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. 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 a 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:
  • 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 virtual private cloud (VPC). We recommend that you deploy the ECS instances across 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. The following figure describes the 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. 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 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