Configure slow start

Updated at:
Copy as MD

You can enable the slow start feature for server groups in Application Load Balancer (ALB). This feature gradually ramps up requests to newly added backend servers, preventing them from being overwhelmed by sudden traffic surges and allowing them time to warm up.

Use cases

In high-traffic scenarios, when you add backend servers manually or automatically, ALB begins routing requests to them according to their configured weights as soon as they pass health checks. This can create a sudden traffic spike that overwhelms the new servers, causing high CPU or memory usage and resulting in numerous access errors.

To prevent this, you can enable slow start for a server group. ALB then gradually routes traffic to new backend servers, preventing sudden traffic surges.

This topic uses the following scenario: An internet-facing ALB instance is deployed in the China (Hangzhou) region. The instance has an HTTP listener and one backend server, ECS01. To handle more traffic, a second server, ECS02, is added. By enabling slow start, requests are gradually ramped up to ECS02, preventing it from being overloaded.

image

Usage notes

  • A new backend server enters slow start mode only if the server group already contains at least one healthy server that is not in slow start mode. Existing servers and the first server added to an empty group do not enter slow start.

  • A backend server in slow start mode exits the mode upon removal. If re-added, it re-enters slow start after passing its health check.

  • A backend server exits slow start mode if it fails a health check and re-enters the mode once it becomes healthy again.

  • If health checks are enabled, slow start begins after the backend server passes its health check. If health checks are disabled, slow start begins immediately.

Prerequisites

  • You have created a standard ALB instance and a server group. For more information, see Create and manage an ALB instance and Create and manage a server group.

  • You have configured a listener for the ALB instance and associated the listener with the server group. For more information, see Add an HTTP listener.

  • You have created an access log for the ALB instance. For more information, see Create an access log.

  • This topic uses two ECS instances:

    ECS01 and ECS02 are used as backend servers, with each instance running a different Nginx service. For more information, see Create an instance by using the wizard.

    The following examples show how to deploy the test applications on ECS01 and ECS02:

    Commands to deploy the service on ECS01

    yum install -y nginx
    systemctl start nginx.service
    cd /usr/share/nginx/html/
    echo "Hello World ! This is ECS01." > index.html

    Commands to deploy the service on ECS02

    yum install -y nginx
    systemctl start nginx.service
    cd /usr/share/nginx/html/
    echo "Hello World ! This is ECS02." > index.html
  • You have added the ECS01 instance to the server group, and the service on ECS01 is accessible to clients. For more information, see Quickly implement load balancing for IPv4 services by using an ALB instance and Quickly implement load balancing for IPv6 services by using an ALB instance.

    Click to view the configuration of the ALB instance

    Parameter

    Description

    Network type

    internet-facing

    DNS name: alb-1o44v******.cn-hangzhou.alb.aliyuncs.com

    Listener protocol

    HTTP, Port 80.

    Backend servers

    • ECS01 instance

      • IP address: 10.0.2.50

      • Port: 80

      • Weight: 100

    • ECS02 instance

      • IP address: 10.0.2.51

      • Port: 80

      • Weight: 100

Step 1: Enable slow start

This step shows how to enable slow start for an existing server group. You can also enable this feature when you create a server group.

  1. Log on to the ALB console.

  2. In the top navigation bar, select the region where the backend servers are deployed. This topic uses China (Hangzhou).

  3. In the left-side navigation pane, choose ALB > Server Groups.

  4. On the Server Groups page, find the target server group and click its ID.

  5. On the Details tab, in the Basic Information section, click Modify Basic Information.

  6. In the Modify Basic Information dialog box, click Advanced Settings, and then turn on the Slow Start switch.

  7. Set Slow Start Duration to 30 seconds and click Save.

    Note

    This means ALB ramps up traffic to the new backend server over 30 seconds.

Step 2: Simulate client traffic by using wrk

This topic uses a client that runs the 64-bit version of Alibaba Cloud Linux 3.2104 as an example. The installation steps for the wrk tool may differ depending on the operating system.

  1. Log on to the client and open the command-line interface. Run the following commands in sequence to install the wrk tool.

    yum -y install git make gcc
    git clone https://github.com/wg/wrk.git
    yum install unzip
    cd wrk
    make
  2. Run the following command to stress-test the services on the ALB backend servers.

    ./wrk -c 1000 -d 6000s -t 3 -H “Connection:Close” http://<ALB-domain-name>

    Parameters:

    • -c: connections. The number of concurrent connections that are maintained for each thread.

    • -d: duration. The duration of the test. s indicates seconds.

    • -t: threads. The number of threads to use, which simulates concurrent users.

    • -H: header. An HTTP header to add to each request. For example, -H “Connection:Close” adds a header to indicate a non-persistent connection.

Step 3: Add the ECS02 backend server

Important

Make sure to add the backend server to the server group before the stress test ends.

  1. Log on to the ALB console.

  2. In the top navigation bar, select the region where the ALB instance is deployed.

  3. In the left-side navigation pane, choose ALB > Server Groups.

  4. On the Server Groups page, find the target server group, and then click Modify Backend Server in the Actions column.

  5. On the Backend Servers tab, click Add Backend Server.

  6. In the Add Backend Server panel, select the ECS02 instance and click Next.

  7. In the Ports/Weights wizard, set the port of the ECS02 instance to 80, keep the default weight of 100, and then click OK.

Step 4: Verify the result

  1. Log on to the ALB console.

  2. In the top navigation bar, select the region where the ALB instance is deployed.

  3. On the Instances page, click the ID of the target instance.

  4. Click the Access Logs tab. In the Basic Information section, click the link next to Simple Log Service to open the Log Service (SLS) console. The figure below shows how to view the traffic on the new backend server, ECS02.

    The access log shows that traffic is gradually distributed to the new backend server ECS02 during the slow start period.

    测试结果-cn (2).png

    No.

    Description

    Enter the following query to view traffic routed to the new backend server, ECS02.

    alb-80ri6****** and upstream_addr : "10.0.2.51:80"

    The fields are described as follows:

    • alb-80ri6****** specifies the ID of the ALB instance.

    • upstream_addr specifies the IP address and port of the backend server. In this example, enter the private IP address and port of ECS02.

    Select a time range for the query. In this example, 1 Minute is selected.

    Click Search & Analyze to view the traffic on the new backend server, ECS02.

Related documents