Updated on 2024-11-14 GMT+08:00

Configuring a Health Check

Scenarios

This section describes how you can enable or disable the health check option.

After the protocol is changed, the load balancer uses the new protocol to check the health of backend servers. The load balancer continues to route traffic to the backend servers after they are detected healthy.

Before the new configurations take effect, the load balancer may return the HTTP 503 error code to the clients.

Notes and Constraints

  • The health check protocol can be different from the backend protocol.
  • To reduce the vCPU usage of the backend servers, it is recommended that you use TCP for health checks. If you want to use HTTP for health checks, you can use static files to return the health check results.
  • If health check is enabled, security group rules must allow traffic from the health check port to the backend servers over the health check protocol. For details, see Security Group and Network ACL Rules.

After you enable health check, the load balancer immediately checks the health of backend servers.

  • If a backend server is detected healthy, the load balancer will start routing requests to it over new connections based on the configured loading balancing algorithms and weights.
  • If a backend server is detected unhealthy, the load balancer will stop routing traffic to it.

Enabling Health Check

  1. Go to the load balancer list page.
  2. On the Backend Server Groups page, locate the backend server group and click its name.
  3. On the Summary page, click Health Check on the right.
  4. In the Configure Health Check dialog box, configure the parameters based on Table 1.
    Table 1 Parameters required for configuring health check

    Parameter

    Description

    Example Value

    Health Check

    Specifies whether to enable health checks.

    NOTE:

    When the health check is enabled or disabled, the number of healthy or unhealthy backend servers may temporarily fluctuate but will stabilize after a monitoring period.

    N/A

    Health Check Protocol

    Specifies the protocol that will be used by the load balancer to check the health of backend servers.

    If the protocol of the backend server group is UDP, the health check protocol is UDP by default.

    Dedicated load balancers support TCP, HTTP, HTTPS, TLS, and gRPC.

    HTTP

    Domain Name

    Specifies the domain name that will be used for health checks. This parameter is mandatory if the health check protocol is HTTP, gRPC, or HTTPS.

    • You can use the private IP address of the backend server as the domain name.
    • You can also specify a domain name that consists of at least two labels separated by periods (.). Use only letters, digits, and hyphens (-). Do not start or end strings with a hyphen. Max total: 100 characters. Max label: 63 characters.

    www.elb.com

    Health Check Port

    Specifies the port that will be used by the load balancer to check the health of backend servers. The port number ranges from 1 to 65535.

    NOTE:

    By default, the service port on each backend server is used. You can also specify a port for health checks.

    80

    Path

    Specifies the health check URL, which is the destination on backend servers for health checks. This parameter is mandatory if the health check protocol is HTTP, gRPC, or HTTPS. The path can contain 1 to 80 characters and must start with a slash (/).

    If the backend server group is associated with a dedicated load balancer, the check path can contain letters, digits, hyphens (-), slashes (/), periods (.), question marks (?), number signs (#), percent signs (%), ampersands (&), and extended character sets _;~!. () *[]@$^:',+

    /index.html

    Interval (s)

    Specifies the maximum time between two consecutive health checks, in seconds.

    The interval ranges from 1 to 50.

    5

    Timeout (s)

    Specifies the maximum time required for waiting for a response from the health check, in seconds. The value ranges from 1 to 50.

    3

    Healthy Threshold

    Specifies the number of consecutive successful health checks required for declaring a backend server healthy. The value ranges from 1 to 10.

    3

    Unhealthy Threshold

    Specifies the number of consecutive failed health checks required for declaring a backend server unhealthy. The value ranges from 1 to 10.

    3

    Status Code

    Specifies the status codes that will be returned to the load balancer to indicate the health of backend servers. This parameter is available only when you set the health check protocol to HTTP, gRPC, or HTTPS.

    You can enter a unique number or a positive number range within the status code range, for example, 0-10 and 200-300. A maximum of five HTTP status codes are supported. If there is more than one status code, press Enter to separate them.

    • If the check protocol is HTTP or HTTPS, the status code ranges from 200 to 599.
    • When the gRPC protocol is used, the status code ranges from 0 to 99.
    NOTE:

    This feature will be available in more regions. See details on the management console.

    200

  5. Click OK.

Disabling Health Check

  1. Go to the load balancer list page.
  2. On the Backend Server Groups page, click the name of the target backend server group.
  3. On the Summary page, click Health Check on the right.
  4. In the Configure Health Check dialog box, disable health check.
  5. Click OK.