You can add a UDP listener to a Network Load Balancer (NLB) instance to forward UDP requests from clients. UDP listeners are suitable for scenarios that require high real-time performance but have low reliability requirements, such as video chat and real-time financial data push.
Prerequisites
An NLB instance is created. For more information, see Create and manage an NLB instance.
A server group is created. For more information, see Create and manage a server group.
Procedure
This topic describes two methods for creating a UDP listener. You can select the method based on your requirements.
Create a UDP listener: This method lets you customize features such as listening by port range and advanced configuration.
Quickly create a UDP listener: This method lets you quickly create a listener by configuring only the listener protocol, listener port, and the server group.
Create a UDP 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, find the NLB instance that you want to manage and use one of the following methods to open the listener configuration wizard:
Click Create Listener in the Actions column.
Click the ID of the NLB instance and click the Listener tab. On the Listener tab, click Create Listener above the listener list.
Click the instance ID. On the instance details page, click Create Listener in the wizard.
Click the instance ID. In the upper-right corner of the instance details page, click Create Listener.
In the Configure Listener wizard, set the following parameters and click Next.
Listener Configuration
Description
Select Load Balancing Protocol
Select a load balancing protocol. In this topic, UDP is selected.
All Ports Feature
Specify whether to enable listening by port range. If you enable this feature, the NLB instance listens on all ports in the specified listener port range and forwards requests received on the listener ports to the corresponding ports on backend servers.
NoteThe server group that is added to the listener that listens by port range must have the all-port forwarding feature enabled.
Listener Port Range
If you enable listening by port range, you must enter the start port and end port of the Listener Port Range.
ImportantThe listener port range cannot be modified after the listener is created.
Listener Port
Enter a Listener Port that is used to receive requests and forward them to backend servers.
You can click a common listener port to quickly set the parameter, or enter a port number. The valid port range is 1 to 65535.
NoteIf Listen By Port Range is enabled, you do not need to configure this parameter.
For more information about how to configure listener ports for the same NLB instance, see Port configuration.
Listener Name
Enter a custom name for the listener.
Tag
Set the Tag Key and Tag Value.
After you set tags, you can filter listeners by tag on the Listeners tab.
Advanced Configuration
Click Modify to expand the advanced configuration section.
Idle Connection Timeout
Specify the timeout period of an idle UDP connection. If no request is received within the timeout period, NLB closes the current connection. When the next request arrives, a new connection is established.
The valid range is 10 to 90 seconds. The default value is 90 seconds.
New Connection Throttling
Specify whether to enable throttling for new connections.
Maximum Number Of New Connections Per Second
If you enable throttling for new connections, set the maximum number of new connections per second that the listener can process in each zone (VIP).
ImportantThis limit applies only to the current listener. Access to other listeners is not affected by this limit. The limits on other listeners are subject to their respective configurations.
Enable Proxy Protocol
Specify whether to enable Proxy Protocol. If you enable this feature, client IP addresses are carried to backend servers using Proxy Protocol.
For more information, see Obtain the originating IP addresses of clients using NLB.
ImportantThe Proxy protocol takes effect only if it is enabled on both the proxy server and backend server. If the backend server cannot parse Proxy protocol headers but the Proxy protocol is enabled, parsing errors may arise on the backend server and compromise service availability.
In the Select Server Group wizard, select a backend server group of the Server or IP type, review the information about backend servers, and then click Next.
In the Configuration Review wizard, confirm the configuration and click Submit.
Quickly create a UDP listener
The quick creation method requires you to configure only the listener protocol, listener port, and the server group to which requests are forwarded.
In the left-side navigation pane, choose .
On the Instances page, find the destination instance and click the instance ID.
Click the Listeners tab and then click Quick Create Listener on the Listeners tab.
In the Quick Create Listener dialog box, set the following parameters and click OK.
Listener Configuration
Description
Select Load Balancing Protocol
Select a load balancing protocol. In this topic, UDP is selected.
Listener Port
Set the frontend protocol port, which is the listener port used to receive requests and forward them to backend servers.
You can click a common listener port to quickly set the parameter, or enter a port number. The valid port range is 1 to 65535.
Server Group For Forwarding
Select a backend server group of the Server or IP type.
References
CreateListener: Creates a TCP, UDP, or TCP/SSL listener for an NLB instance.
DeleteListener: Deletes a listener from an NLB instance.
ListListeners: Queries the listeners of an NLB instance.
UpdateListenerAttribute: Updates the configuration of a listener for an NLB instance.
StartListener: Enables a listener for an NLB instance.
StopListener: Disables a listener for an NLB instance.
GetListenerAttribute: Queries the details of a listener for an NLB instance.
GetListenerHealthStatus: Queries the health check status of a listener for an NLB instance.