Server Load Balancer (SLB) is an Alibaba Cloud service that distributes network traffic across backend Elastic Compute Service (ECS) instances based on forwarding rules. You can use ECS and SLB together to improve the availability of ECS.


ECS can work with SLB in the following scenarios:

  • Handle applications with high loads

    If an application has high loads, you can configure listeners to distribute heavy traffic among ECS instances. You can also use the session persistence feature to forward all requests from the same client to the same backend ECS instance to improve access efficiency.

  • Develop scale-out systems

    You can extend the service capability of your applications by adding or removing backend ECS instances to suit your business needs. SLB can be used for both Web and application servers. For more information, see Backend server overview.

  • Eliminate single points of failure (SPOFs)

    You can add multiple ECS instances to an SLB instance as backend servers. When some of the ECS instances fail, SLB automatically isolates these ECS instances and distributes inbound requests to other healthy ECS instances. This ensures that your applications continue to run as expected.

  • Implement cross-zone disaster recovery (multi-zone disaster recovery)

    When you use SLB, we recommend that you implement cross-zone disaster recovery by deploying SLB instances to multiple zones within a region. This way, when a data center in a zone within the region fails, SLB can redirect inbound traffic to other zones within the region in a short period of time to restore services.

    Note You can add at least one ECS instance in each zone to obtain the optimal efficiency of SLB.
  • Implement geo-disaster recovery (cross-region disaster recovery)

    You can deploy SLB instances in different regions and add ECS instances within different zones of the same region to the SLB instances. You can use Alibaba Cloud DNS to resolve domain names to service addresses of SLB instances in different regions for global load balancing purposes. If a region becomes unavailable, you can temporarily stop DNS resolution in the region without affecting user access.


Before you use SLB, perform the following operations:

  • Plan a region where to deploy an SLB instance.
    • To reduce the network latency and increase the transmission speed, we recommend that you select a region that is geographically closest to your customers.
    • SLB does not support cross-region deployment. You must select a region where backend ECS instances reside to deploy the associated SLB instance.
  • Select a network type for an SLB instance: Internet-facing or internal-facing.

    You can select a network type for an SLB instance based on your business type. After an SLB instance is created, the system allocates a public IP address or a private IP address to the SLB instance based on the network type of the SLB instance.

    • If you create an Internet-facing SLB instance, only a public IP address is allocated to the SLB instance. This allows the SLB instance to be accessed from the Internet.
    • If you create an internal-facing SLB instance, only a private IP address is allocated to the SLB instance. In this case, the SLB instance can be accessed only from the internal network of Alibaba Cloud. If you create an internal-facing SLB instance, you are not charged public bandwidth fees.
  • Select a listener protocol.

    SLB supports Layer 4 (TCP and UDP protocols) and Layer 7 (HTTP and HTTPS protocols) listeners.

    • A Layer 4 listener distributes requests to backend servers without modifying packet headers. After a client request reaches a Layer 4 listener, SLB establishes a TCP connection between backend ECS instances and backend ports specified in the listener configuration.
    • A Layer 7 listener functions as a reverse proxy. After a client request reaches a Layer 7 listener, SLB establishes a new TCP connection over HTTP with backend ECS instances, instead of directly forwarding the request to the backend ECS instances.

    Compared with Layer 4 listeners, Layer 7 listeners require an additional step of Tengine processing. As a result, Layer 4 listeners provide higher performance than Layer 7 listeners. In addition, the performance of Layer 7 listeners may degrade due to factors such as insufficient client ports or excessive backend server connections. If you require high performance, we recommend that you use Layer 4 listeners.

  • Create backend servers.

    You must add ECS instances to an SLB instance to handle requests that are forwarded by frontend listening ports. Before you use SLB, make sure that ECS instances are created and relevant applications are deployed on the ECS instances. When you create ECS instances, take note of the following items:

    • Region and zones of the ECS instances

      Make sure that the ECS instances are deployed in the same region as the SLB instance. We recommend that you deploy the ECS instances across zones to improve service availability.

    • Configurations of the ECS instances
      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 your ECS instances run Linux operating systems, make sure that the following parameters in the net.ipv4.conf file 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
    • Deployment of the ECS instances

      The number of ECS instances that can be added to an SLB instance as backend servers is not limited. However, in order to ensure the stability and efficiency of your external services, we recommend that you add ECS instances that provide different services or execute different tasks to different SLB instances based on business types or application modules.


  1. Create ECS instances. Before you use SLB, at least two ECS instances are created. For more information, see Create an instance by using the wizard.
  2. Deploy relevant applications on the ECS instances after the ECS instances are created.
  3. Create an SLB instance. You can add multiple listeners and backend servers to an SLB instance. For more information, see Create a CLB instance.
  4. Add at least one listener and a group of backend servers after the SLB instance is created. For more information, see Configure a CLB instance.


SLB instances support the pay-by-data-transfer billing method. Billable items vary with the network type and performance type of SLB instances. For more information, see Pay-as-you-go.