Compared to Classic Load Balancer (CLB), Network Load Balancer (NLB) provides superior performance for layer 4 load balancing. It can handle massive concurrent connections and includes features such as TCPSSL offloading and connection throttling. When business growth demands enhanced features, performance, stability, and elasticity, you can manually migrate traffic from a CLB layer 4 listener to an NLB instance to handle high-concurrency workloads.
Key features
When migrating traffic from a CLB instance to an NLB instance, NLB provides the following key features:
-
High concurrency: A single instance supports up to 100 million concurrent connections and 100 Gbps of bandwidth, making it ideal for high-concurrency scenarios such as managing large volumes of IoT connections.
-
Auto scaling: Performance scales automatically with your business traffic, eliminating the need to select or adjust the NLB instance type.
-
All-port listening: NLB monitors and processes all network traffic within a specified port range. This is ideal for applications that listen on numerous or dynamic ports.
-
IPv6 capabilities: NLB provides comprehensive IPv6 support for various scenarios, including dual-stack, 6to4, and 6to6.
Use cases
Common use cases for migrating traffic from a CLB instance to an NLB instance include the following:
-
Handling high volumes of concurrent connections for applications such as instant messaging and IoT device management.
-
Automatically adjusting resources to handle traffic spikes in scenarios with fluctuating demand, such as e-commerce promotions.
-
Processing data for applications that use a wide range of ports, such as online gaming, video conferencing systems, and online education platforms.
-
Expanding network resources by transitioning services from IPv4 to IPv6.
Example scenario
This article uses the following scenario as an example. A company has purchased a public-facing Classic Load Balancer (CLB) instance in the Alibaba Cloud China (Hangzhou) region. This CLB instance is configured with a TCP listener and provides services over the Internet through a DNS domain name. When a client accesses the domain name www.example.cn, DNS resolution directs traffic to the CLB instance based on the configured A record. The CLB instance then forwards the traffic to ECS01 and ECS02 for processing based on the forwarding policy defined by the scheduling algorithm.
As the business grows, the enterprise needs to support IoT services and migrate traffic from the CLB instance to an NLB instance. To ensure service stability, the enterprise wants to keep the public-facing DNS domain name and the IP addresses of the backend servers unchanged. To do this, the enterprise can purchase a new NLB instance in the China (Hangzhou) region, configure it to match the CLB instance, and then use DNS weight settings to migrate the traffic.
Notes
-
CLB supports both pay-as-you-go billing methods, whereas NLB supports only pay-as-you-go. Migrating from a CLB instance to an NLB instance will result in billing changes because the billable items and pricing differ between the services. For details on the billing rules, see the following topics:
-
The NLB and CLB instances must use the same backend servers within the same VPC.
-
An IPv4 CLB instance can be migrated to an IPv4 or dual-stack NLB instance. An IPv6 CLB instance can be migrated only to a dual-stack NLB instance.
Prerequisites
-
The CLB instance for migration must be configured with a TCP listener and backend servers. Its domain name must also have an A record. For more information, see Getting started overview.
-
You have created two backend servers, ECS01 and ECS02, and deployed a sample application on each. For more information about how to create an ECS instance, see Create an instance with custom configurations.
Note-
If your CLB instance uses a UDP listener, the NLB instance must also use a UDP listener.
-
Prepare two test servers: one to test traffic before the migration and the other to verify access during the migration. You can use existing servers if available. In this topic, the two test servers are running the Alibaba Cloud Linux 3.2104 64-bit operating system.
Use the following commands to deploy the sample application on ECS01 and ECS02:
-
Step 1: Create an NLB instance
Log on to the NLB console.
-
In the top navigation bar, select the region in which the NLB instance is deployed.
-
On the Instances page, click Create NLB.
-
On the Network Load Balancer (pay-as-you-go) International Site purchase page, set the following parameters, accept the default values for the others, and then click Buy Now to complete the purchase.
Parameter
Description
Region
Select the region for your NLB instance. This example uses China (Hangzhou).
Network Type
Select an instance network type. This example uses Public.
NoteIf you select Private, a dual-VIP NLB instance provides up to 10 Gbps of private network throughput, supporting 100,000 new connections per second and 1.5 million concurrent connections. In addition, NLB can automatically scale its performance up to 50 Gbps based on traffic.
IP Version
Select the protocol version for the instance. This example uses IPv4.
VPC
Select the VPC for the instance.
Zone
Select the availability zones and vSwitches. This example uses Hangzhou Zone H and Hangzhou Zone I and their corresponding vSwitches.
Associate with Internet Shared Bandwidth
In this example, select Associate with Internet Shared Bandwidth and select a Shared Bandwidth Package. If you do not have a Shared Bandwidth Package, click Purchase Shared Bandwidth Package to create one.
NoteIf your application handles high volumes of public network traffic:
-
You can add the instance to a Shared Bandwidth Package. Once added, the instance's peak bandwidth is limited by that of the Shared Bandwidth Package.
-
If not added to a Shared Bandwidth Package, the instance uses a pay-as-you-go Elastic IP Address (EIP) by default. In this case, the maximum peak bandwidth of the public-facing NLB instance is 400 Mbps. This value is for reference and not a guarantee.
-
You can also add a public-facing NLB instance to a Shared Bandwidth Package after you create the instance. For more information, see Increase the peak bandwidth of a public-facing NLB instance.
-
Step 2: Create an NLB server group
Log on to the NLB console.
-
In the top navigation bar, select the region in which the NLB instance is deployed.
-
In the left-side navigation pane, choose NLB > Server Groups.
-
On the Server Groups page, click Create Server Group.
-
In the Create Server Group dialog box, configure the following parameters (leave the other parameters at their default values), and then click Create.
Parameter
Description
Server Group Type
Select the server group type. In this example, select Server.
Server Group Name
Enter a name.
VPC
Select the VPC where the NLB instance is located. Only servers from this VPC can be added to this server group.
Backend Server Protocol
Select the backend protocol. In this example, select TCP.
Health Check Settings
Select Enable and keep the default settings.
-
After you create the server group, click its instance ID and then click the Backend Servers tab.
-
Click Add Backend Server. In the Add Backend Server panel, select ECS01 and ECS02, and then click Next.
-
In the Ports/Weights wizard, enter
80for Port and keep the default value for Weight. Then, click OK.
Step 3: Create a TCP listener
Log on to the NLB console.
-
In the top navigation bar, select the region in which the NLB instance is deployed.
-
On the Instances page, click the ID of the target instance.
-
Click the Listener tab, and then click Quick Create Listener.
-
In the Quick Create Listener dialog box, configure the following parameters, and then click OK.
Parameter
Description
Select Listener Protocol
Select TCP.
Listener Port
Enter
80.Server Group
Select a Server and the server group that you created in Step 2.
Step 4: Test traffic
-
Log on to the public-facing Linux server to test traffic to the NLB instance before migration.
-
Run the following command to edit the hosts file.
sudo vi /etc/hosts-
Press the
ikey to switch to edit mode, and add the following record to map the IP address of the NLB instance to a domain name.
47.XX.XX.101 www.example.cn-
After you finish editing, press the
Esckey, enter:wq, and press Enter to save and close the configuration file.
NoteIn this step, you will resolve the domain name
www.example.cnto the specified Elastic IP Address (47.XX.XX.101) of the NLB instance, which overwrites the original DNS resolution for the CLB. Before you migrate traffic, you need to test whether the domain name can successfully access the NLB instance. -
-
Run the following command to test whether the NLB instance is accessible by using the domain name. If telnet is not installed, run the
yum install -y telnetcommand to install telnet.telnet www.example.cn 80 # TCP listener port 80A Connected to nlb-... message indicates that the NLB instance can forward requests to the backend servers.

-
View the NLB operation logs.
Log on to the NLB console.
-
In the left-side navigation pane, choose .
-
On the Operation Log page, filter for events where the Event Name is GetLoadBalancerAttribute. In the Operations column, click View Details.
-
On the View Details page, click Event Record in the Operations column. Then, use the
requestParameterandLoadBalancerIdfields to view the runtime log information for the NLB instance.
Step 5: Migrate traffic to NLB
This topic assumes the CLB access path shown in the following figure. The CLB instance is configured with a TCP listener and serves multiple domain names. The domain name used in this example is example.cn.
-
Before migrating traffic, compare your CLB and NLB instance configurations. Ensure they have identical capabilities and are thoroughly tested to prevent unexpected business impacts during the migration.
-
We recommend migrating traffic during off-peak hours to minimize the potential impact on your services.
Before migration, an A record points your business domain name to the service address of the CLB instance.
After validating the NLB instance configuration, this topic describes the steps to migrate traffic from a CLB to an NLB instance using Alibaba Cloud DNS as an example. For more information about Alibaba Cloud DNS, see public DNS.
Step 1: Configure a temporary domain for the CLB instance and add a CNAME record
We recommend that you configure a CNAME record for the NLB instance. To meet the prerequisites for weight configuration, you must add a CNAME record for a temporary domain name that points to the service address of the CLB instance. This topic assumes that the business domain name configured for the CLB instance is www.example.cn.
To use weight configuration, you must have multiple A, CNAME, or AAAA records for the same host record and resolution line.
-
Log on to the Alibaba Cloud DNS console.
-
On the Public Zone page, find the domain name
example.cnfor the CLB instance that you want to migrate, and click the domain name. -
On the Settings page, find the A record that points to the service address of the CLB instance, and click Modify in the Actions column.
-
In the Edit Record panel, change the Hostname and click OK. In this example, the host record is changed to web0. Keep the other parameters unchanged.
-
On the Settings page, click Add Record. In the Add Record panel, configure the following parameters and click OK.
Parameter
Description
Record Type
Select CNAME.
Hostname
The prefix of your domain name. In this example, enter www.
Query Source
Select Default.
TTL
Time To Live (TTL) specifies how long a DNS record is cached on a DNS server. Set the value to 5 seconds.
Record Value
Enter the temporary domain name. In this example, enter web0.example.cn.
Step 2: Add a CNAME record for the NLB
On the Settings page, click Add Record. In the Add Record panel, configure the following parameters and click OK.
|
Parameter |
Description |
|
Record Type |
Select CNAME. |
|
Hostname |
The prefix of your domain name. In this example, enter www. |
|
Query Source |
Select Default. |
|
TTL |
Time To Live (TTL) specifies how long a DNS record is cached on a DNS server. Set the value to 5 seconds. |
|
Record Value |
Enter the DNS domain name that you copied from the NLB instance. |
Step 3: Set weights and start canary release
-
On the Settings page, find the CNAME record that you added in Step 2. Click the drop-down arrow next to Modify and select Edit Record Set.
-
In the Edit Record panel, go to the Record Values section and set weights for the CLB and NLB instance records. Set the weight of the CLB instance record to 100 and the weight of the NLB instance record to 0. Click OK.

-
If you observe no impact on your services, gradually decrease the weight of the CLB instance record while increasing the weight of the NLB instance record.
-
Log on to your Linux client and run the
digcommand multiple times to verify the traffic migration.dig www.example.cn
The following figure shows the output. By running the command multiple times, you can observe that requests are routed to either the CLB or NLB instance according to the configured weights.

Step 4: Complete traffic migration
Based on the verification results, gradually decrease the weight of the CLB instance record to 0 and increase the weight of the NLB instance record to 100. At this point, the traffic migration from the CLB instance to the NLB instance is complete. Monitor your services for a period to ensure stability. After you confirm that all long-lived connections to the CLB instance have closed and it receives no new traffic, you can release the CLB instance. For information about how to release a CLB instance, see Create and manage CLB instances.
After the migration, the access path for the NLB instance is shown in the following figure:
Advanced features
Network Load Balancer (NLB) is an upgrade to the Layer 4 load balancing capabilities of Classic Load Balancer (CLB). The two services differ in how they implement certain features. The following topics cover NLB instances, quota limits, quick starts, and DDoS protection:
-
See NLB instances for an overview of NLB instances.
-
See Performance and usage limits for information about NLB quota limits.
-
See Quickly achieve load balancing for IPv4 services with NLB and Quickly achieve load balancing for IPv6 services with NLB for NLB quick starts.
-
NLB provides basic DDoS protection by default. For details, see What is Anti-DDoS Origin?.
The following table compares some advanced features of CLB and NLB.
|
Feature |
CLB |
NLB |
|
Server group |
Supports default server groups, virtual server groups, and primary/standby server groups. |
NLB uses a single server group concept. |
|
One-way authentication |
Supports SSL certificates issued by Alibaba Cloud and uploaded third-party SSL certificates. For configuration details, see Use CLB to deploy HTTPS services (one-way authentication). |
You can deploy an NLB instance at the traffic entry point and configure an SSL certificate. The backend servers do not need to be configured with SSL. The NLB instance can use a TCPSSL listener to decrypt incoming traffic and forward it to the backend servers. For configuration details, see Use NLB to implement TCPSSL offloading (one-way authentication). |
|
Two-way authentication |
Supports CA certificates issued by Alibaba Cloud and uploaded third-party CA certificates. For configuration details, see Use CLB to deploy HTTPS services (two-way authentication). |
You can deploy an NLB instance at the traffic entry point and configure both an SSL certificate and a CA certificate to authenticate both communicating parties. For configuration details, see Use NLB to implement TCPSSL offloading (two-way authentication). |
|
All-port listener |
Not supported. |
The all-port listener feature lets an NLB instance monitor and respond to all network traffic within a port range. This feature forwards multi-port traffic within a single listener, which simplifies configuration, reduces operational complexity, and lowers security risks. For configuration details, see Use the NLB all-port listener to forward multi-port traffic. |
|
Security protection |
CLB uses access control to implement allowlist and denylist policies. For configuration details, see Access control. |
NLB uses security groups to implement access control at the listener or port level and to create allowlist and denylist policies. For configuration details, see the following topics: |
FAQ
-
Which configurations must be the same for the CLB instance and the NLB instance during migration?
The region, network type, listener protocol, and backend servers must be the same. Both instances must also use the same VPC, but they can be in different zones.
-
What are the differences in how CLB and NLB use certificates?
CLB supports HTTPS encryption, while NLB supports TCPSSL encryption. With CLB, you can upload certificates from Alibaba Cloud or third-party providers. In contrast, NLB uses certificates managed through Certificate Management Service.
-
For a CLB instance, see Upload a certificate.
-
For an NLB instance, see Purchase an official certificate and Upload, sync, and share SSL certificates.
-
-
What are the differences in access control between CLB and NLB?
-
CLB provides access control at the listener level, allowing you to set a unique access policy for each listener. For more information, see Access control.
-
NLB uses security groups for access control, filtering traffic by protocol, port, or IP address. For more information, see Add an NLB instance to a security group.
-
-
What are the differences in domain name resolution between CLB and NLB?
-
CLB instances require an A record to map a custom domain name to the instance's service address.
-
For an NLB instance:
-
We recommend using a CNAME record to map your custom domain name to the DNS name of the NLB instance. This simplifies access to your network resources.
-
To resolve your custom domain name to a static IP address, use an A record to map the domain name to the IP address provided by the NLB instance.
-
-
Related documents
-
For a comparison of the features, billing, and advantages of CLB and NLB instances, see Introduction to the Server Load Balancer (SLB) product family.
-
The following links provide product overviews, basic configuration, feature differences, and billing information for CLB and NLB instances:
CLB instances
NLB instances
