All Products
Search
Document Center

Server Load Balancer:NLB server groups

Last Updated:Jun 05, 2026

Server groups route client requests to backend servers. When you add a listener, you must specify a server group. The listener forwards traffic to the corresponding server group based on the configured protocol and port. Network Load Balancer (NLB) uses health checks to monitor the health of backend servers.

NLB server group types

Server group type

Backend server type

Description

Server type

You can add ECS, ENI, and ECI instances as backend servers.

The backend servers must be in the same VPC as the server group to receive requests from the NLB instance.

IP type

You can add IP addresses as backend servers.

The IP addresses are not limited to the CIDR block of the VPC where the server group resides. You can add IP addresses of servers across regions, across VPCs, or in on-premises data centers. These IP addresses serve as backend servers to receive requests from the NLB instance.

  • Add IP addresses that are within the CIDR block of the VPC where the server group resides.

    NLB forwards requests to servers in the same VPC.

  • Add IP addresses of servers across regions, VPCs, or in on-premises data centers.

    NLB works with other services, such as Cloud Enterprise Network (CEN), to forward requests to servers in other VPCs or on-premises data centers.

Only private IP addresses are supported. public IP addresses are not supported.
Important

NLB does not automatically update a backend server's information if the server is released or its private IP address changes. To prevent service interruptions, remove the server from the server group before you release it or change its configuration.

Create a server group

  1. Log on to the NLB console.

  2. In the top navigation bar, select the region in which the NLB instance is deployed.

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

  4. On the Server Groups page, click Create Server Group.

  5. In the Create Server Group dialog box, configure the following settings and click Create.

    Parameter

    Description

    Server Group Type

    Select a server group type:

    • Server Type: Allows you to add ECS, ENI, and ECI instances as backend servers.

    • IP Type: Allows you to add IP addresses as backend servers.

    Only private IP addresses are supported. public IP addresses are not supported.

    VPC

    Select a VPC from the drop-down list.

    Backend Server Protocol

    Select a backend protocol:

    • TCP: Associate the server group with TCP and TCP/SSL listeners.

    • UDP: Associate the server group with UDP listeners.

    Scheduling Algorithm

    Select a scheduling algorithm:

    • Round Robin: Distributes requests to backend servers in sequence.

    • Weighted Round-robin (Default): Distributes requests to backend servers based on their weights. Backend servers with higher weights receive more requests.

    • Source IP Hashing: Uses consistent hashing based on source IP addresses. Requests from the same source IP address are routed to the same backend server.

    • Four-element Hashing: Uses consistent hashing based on four-tuples (source IP, destination IP, source port, and destination port). Packets from the same stream are routed to the same backend server.

    • QUIC ID Hashing: Uses consistent hashing based on QUIC connection IDs. Requests with the same QUIC ID are routed to the same backend server.

      You can select QUIC ID hashing only when the backend protocol is UDP.
      The QUIC protocol is evolving rapidly. This algorithm is implemented based on draft-ietf-quic-transport-10. Compatibility with all QUIC versions is not guaranteed. We recommend that you perform sufficient tests before you use this algorithm in a production environment.
    • Weighted Least Connections: Distributes requests based on both the weight and the actual load (number of connections) of each backend server. If backend servers have the same weight, the server with the fewest connections receives more requests.

    Resource Group

    Select a resource group for the server group.

    Tag

    Set a Tag Key and a Tag Value.

    IP Version

    Select an IP version:

    • IPv4 (Default): You can add only IPv4 backend servers.

    • IPv4/IPv6 dual-stack: You can add both IPv4 and IPv6 backend servers.

    If IPv6 is not enabled for the VPC that you selected, you can select only IPv4.

    IP Version Affinity

    If you set IP Version to IPv4/IPv6 dual-stack, you can configure IP Version Affinity:

    • No affinity (Default): Requests are distributed to healthy backend servers based on the scheduling algorithm, regardless of the IP version of the source.

    • Affinity mode: Requests are routed based on their source IP version. IPv4 requests are routed only to IPv4 backend servers, and IPv6 requests are routed only to IPv6 backend servers.

    If you select Affinity mode, make sure that the server group contains healthy IPv4 and IPv6 backends. Otherwise, requests of the corresponding IP version cannot be properly forwarded.

    Connection Draining

    Specify whether to enable connection draining. This feature is disabled by default.

    If you enable connection draining, you must also set the Connection Draining Timeout. The timeout can be set from 0 to 900 seconds. A value of 0 indicates that connections are drained immediately.

    When a backend server is removed or fails a health check:

    • If connection draining is disabled (default), existing connections are not actively interrupted. They are interrupted only after the client disconnects or the session expires.

    • If connection draining is enabled, existing connections are maintained until the timeout ends. Then, the connections are actively closed to ensure a smooth service transition.

    Client IP Preservation

    Specify whether to enable client IP preservation. If you enable this feature, backend servers can retrieve the source IP addresses of clients.

    If you disable this feature, backend servers can act as clients to access the NLB instance. To retrieve the source IP addresses of clients, you can enable Proxy Protocol for the listener.

    If you enable client IP preservation for an IP-based server group, client source IP addresses are not automatically passed to backend servers. You must use Proxy Protocol on the listener to retrieve the source IP addresses.

    Multi-port Forwarding

    Specify whether to enable multi-port forwarding. If you enable this feature, you do not need to specify a port when you add a backend server. NLB forwards traffic to the backend server based on the port of the incoming request.

    If you enable the multi-port forwarding feature for a listener, you must also enable this feature for the backend server group.

    Health Check

    Specify whether to enable health checks.

    Health Check Settings

    If you enable health checks, you can click Modify to change the health check settings.

    Health Check Protocol

    Select a protocol for health checks:

    • TCP (Default): Sends SYN packets to check whether the server port is reachable.

    • HTTP: Sends HEAD or GET requests to check whether the application on the server is healthy.

    • UDP: Sends ICMP Echo Request and UDP probe packets to obtain status information.

    You can select UDP for Health Check Protocol only if the server group backend protocol is UDP.

    Health Check Method

    Select a health check method:

    • GET: If a response packet is larger than 8 KB, the packet is truncated. This does not affect the health check result.

    • HEAD: HTTP listener health checks use HEAD by default. Make sure your backend servers support HEAD requests. If your backend application does not support or has disabled HEAD requests, health checks may fail. In this case, use the GET method.

    This parameter takes effect only when the health check protocol is HTTP.

    Health Check Protocol Version

    Select an HTTP version: HTTP/1.0 (default) or HTTP/1.1.

    • The health check protocol version must match the HTTP version supported by your backend application. Otherwise, health checks may fail. If your backend server:

      • Supports only HTTP 1.0, you must select HTTP/1.0.

      • Supports only HTTP 1.1, you must select HTTP/1.1.

      • Supports both HTTP 1.0 and HTTP 1.1, you can select either version.

    This parameter takes effect only when the health check protocol is HTTP .

    Health Check Port

    Select the probe port that the health check service uses to access the backend server.

    • Backend Server Port: By default, the health check service uses the ports of backend servers.

    • Custom Port: Specify a port for health checks.

    If you enable multi-port forwarding, you must specify a health check port.

    Health Check Path

    Enter the URL of the health check page.

    This parameter takes effect only when the health check protocol is HTTP.

    Health Check Domain Name

    Enter the domain name for health checks.

    • Backend Server Internal IP (Default): The private IP address of the backend server is used as the domain name for health checks.

    • Custom Domain Name: Enter a domain name.

    This parameter takes effect only when the health check protocol is HTTP.

    Health Check Status Codes

    Select the status codes that indicate a successful health check. You can select http_2xx (default), http_3xx, http_4xx, and http_5xx.

    This parameter takes effect only when the health check protocol is HTTP.

    Custom Request/Response

    When you configure a health check for a UDP listener, you can enable Custom Request/Response. Then, enter the request content in the Custom Request field, such as youraccountID, and the expected response in the Custom Response field, such as slb123.

    You must also add the corresponding health check response logic to the application on the backend server. For example, if the application receives a request that contains

    youraccountID, it must return a response that contains slb123.

    If the NLB instance receives the expected response from the backend server, the health check is successful. Otherwise, the health check fails. This method maximizes the reliability of UDP health checks.

    This parameter takes effect only when the health check protocol is UDP.

    Response Timeout Period

    The period to wait for a response to a health check request. If a backend server does not respond within the specified period, the health check fails.

    Health Check Interval

    The interval at which health checks are performed.

    If you set Health Check Protocol to UDP, make sure that the value of Health Check Interval is greater than or equal to the value of Response Timeout Period. This prevents a UDP probe from being misjudged as unresponsive due to a timeout.

    Healthy Threshold

    The number of consecutive successful health checks required to change the status of a backend server from unhealthy to healthy.

    Unhealthy Threshold

    The number of consecutive failed health checks required to change the status of a backend server from healthy to unhealthy.

Add backend servers (Server type)

If you create a server group of the Server type, you must add backend servers to handle incoming requests. You cannot add the same ECS, ENI, or ECI instance more than once to a server group for which multi-port forwarding is enabled.

  1. On the Server Groups page, find the server group that you want to manage and use one of the following methods to open the backend servers page.

    • In the Actions column, click Modify Backend Server.

    • Click the server group ID. On the server group details page, click the Backend Servers tab.

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

  3. In the Add Backend Server panel, select a Server Type and click Next.

    • If ECS/ENI is Purchase ECS Instance, select the target servers or click Purchase ECS Instance in the upper-right corner.

      To select an ENI, make sure that a secondary ENI is attached to the target ECS instance and the Advanced Mode switch is turned on. Then, click the 展开符合 icon to the right of the target ECS instance ID and select the ENI.

      If the server group IP Version is IPv4/IPv6 dual-stack, click the settings icon next to the IP column header. In the IP Address dialog box, select an IP address policy:

      • Prefer IPv4 over IPv6: An available primary IPv4 address is selected by default.

      • Prefer IPv6 over IPv4: An available IPv6 address is selected by default. If an ENI has multiple IPv6 addresses, the first available one is selected based on its order in the list.

      • Dualstack: An available primary IPv4 address and the first available IPv6 address are selected.

      This option sets only the default selected IP address for the ENI. You can still manually change the selection in the IP address column.
    • If ECI is ECI, select the target servers or click Purchase Elastic Container Instance in the upper-right corner.

  4. Configure the ports and weights of the servers, and then click OK.

    If multi-port forwarding is enabled for the server group, you do not need to specify a port when you add a backend server. NLB forwards traffic to backend servers based on the ports of incoming requests.

    The default weight is 100. A server with a higher weight receives more requests.

    You can hover over the 批量操作 icon to modify the weights and ports of multiple servers in bulk:

    • Click Replicate to Below: If you modify the weight or port of the current server, the weights or ports of all servers below it are changed to the same value.

    • Click Replicate to Above: If you modify the weight or port of the current server, the weights or ports of all servers above it are changed to the same value.

    • Click Replicate to All: If you modify the weight or port of the current server, the weights or ports of all servers in the server group are changed to the same value.

    • Click Reset:

      • Click Reset next to Weight to restore the default weights for all servers in the server group.

      • Click Reset next to Port to clear the port numbers of all servers in the server group.

    Warning

    If you set the weight of a server to 0, the server no longer receives new requests.

Add backend servers (IP type)

If you create a server group of the IP type, you must add IP addresses as backend servers to handle incoming requests. You cannot add the same IP address more than once to a server group for which multi-port forwarding is enabled.

  • You cannot add the virtual IP addresses (VIPs) of NLB instances in the same VPC, or the VIPs of ALB instances created in the same VPC after .

  • Only private IP addresses are supported. public IP addresses are not supported.

  1. On the Server Groups page, find the target server group and use one of the following methods to add an IP address.

    • In the Actions column, click Modify Backend Server.

    • Click the server group ID.

  2. On the server group details page, click the Backend Servers tab, and then click Add IP Address.

  3. On the Select Servers tab of the Add Backend Server panel, enter an IP address and click Next.

    You can configure multiple ports and weights for the IP address.

  4. On the Ports/Weights tab, set the port and weight for the added IP address, and then click OK.

    If multi-port forwarding is enabled for the server group, you do not need to specify a port when you add a backend server. NLB forwards traffic to backend servers based on the ports of incoming requests.

    The default weight is 100. A server with a higher weight receives more requests.

    You can hover over the 批量操作 icon to modify the weights and ports of multiple servers in bulk:

    • Click Replicate to Below: If you modify the weight or port of the current server, the weights or ports of all servers below it are changed to the same value.

    • Click Replicate to Above: If you modify the weight or port of the current server, the weights or ports of all servers above it are changed to the same value.

    • Click Replicate to All: If you modify the weight or port of the current server, the weights or ports of all servers in the server group are changed to the same value.

    • Click Reset:

      • Click Reset next to Weight to restore the default weights for all servers in the server group.

      • Click Reset next to Port to clear the port numbers of all servers in the server group.

    Warning

    If you set the weight of a server to 0, the server no longer receives new requests.

Other operations

Actions

Procedure

Edit basic information

On the Server Groups page, find the target server group and click Modify Basic Information. In the Modify Basic Information dialog box, you can modify the scheduling algorithm, IP version affinity (available only if the server group IP Version is IPv4/IPv6 dual-stack), connection draining, and client IP preservation settings.

Edit health check settings

On the Server Groups page, find the target server group and click Modify Health Check Settings. In the Modify Health Check Settings dialog box, modify the health check settings.

Warning
  • If you disable health checks, NLB no longer checks the health status of backend servers. If a backend server becomes unhealthy, NLB cannot automatically route traffic to other healthy backend servers.

  • If you increase the health check interval, NLB takes longer to detect unhealthy backend servers.

Remove a backend server

You can remove backend servers from a server group as needed.

Warning

Removing a backend server directly from a server group may cause service interruptions. To avoid this, first set the server's weight to 0, and then remove it from the server group.

  1. On the Server Groups page, click the ID of the target server group.

  2. Click the Backend Servers tab, find the server that you want to remove, click Remove, and then click OK.

Delete a server group

You can delete a server group only if it is not associated with any listener forwarding rules. Deleting a server group does not affect its backend servers. If you no longer need the ECS, ENI, or ECI instances that were registered as backend servers, you can stop or release them.

On the Server Groups page, find the target server group. In the Actions column, choose Delete and click OK.

API reference