You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Kernel fine-tuning
Modifying net.ipv4.udp_mem parameter in Linux operating system
Copy page
Download PDF
Modifying net.ipv4.udp_mem parameter in Linux operating system
By modifying the net.ipv4.udp_mem parameter, you can adjust UDP memory management policies of the kernel, thereby controlling UDP packet caching and processing capabilities of the system.​
About the net.ipv4.udp_mem parameter​
net.ipv4.udp_mem is a 3-integer array structured as [min pressure max]. These values represent memory usage limits for the UDP protocol stack under different states, respectively. The three values define memory thresholds, with the unit being Page (kernel page; typically, 1 kernel page equals 4 KiB). Their meanings are as follows:​
  • min: The threshold at which the kernel starts reclaiming memory. When the UDP memory usage of the system reaches this value, the kernel starts reclaiming memory to prevent overuse.​
  • pressure: The soft limit for kernel memory usage. When this value is exceeded, UDP adjusts its memory consumption and enters memory pressure mode. When memory consumption drops below the value specified by min, UDP exits memory pressure mode.​
  • max: The hard limit for kernel memory usage. That is, the maximum number of pages allowed for all UDP sockets to queue and buffer datagrams. When this value is exceeded, the system refuses to allocate new sockets.​
Applicable scenario​
  • Scenarios with heavy network load​
  • In scenarios that require processing a large number of UDP packets, such as real-time video streaming or large-scale data transmission, servers may encounter packet loss. This happens because the total memory of UDP sockets reaches the upper limit. In such cases, you can refer to the following adjustment plan:​
  • min: Set this parameter to a relatively high value to reduce the impact of frequent memory reclamation on high-traffic requests.​
  • pressure: Set this parameter to 4/3 times the value of the min parameter.​
  • max: Set this parameter to twice the value of the pressure parameter.​
  • Scenarios with light network load​
  • In scenarios involving basic internal network services with low UDP usage, such as file transfer and printing services, servers may experience unnecessary memory usage due to a high memory reclamation threshold. In such cases, you can refer to the following adjustment plan:​
  • min: Set this parameter to a relatively low value to lower the threshold for triggering memory reclamation and avoid unnecessary memory usage.​
  • pressure: Set this parameter to 4/3 times the value of the min parameter.​
  • max: Set this parameter to twice the value of the pressure parameter.​
Procedure​
​
Configuration by using the proc interface
Configuration by using the net_udp.conf file
​
You can use this method to temporarily modify the parameter value while the operating system is running. Each time the instance restarts, you need to configure the parameter again.​
  1. Log in to the target instance. For more information, see Logging in to Linux instances.​
  1. Execute the following command on the target Linux instance to view the current value of the net.ipv4.udp_mem parameter.​
  • ​
    cat /proc/sys/net/ipv4/udp_mem​
    ​
  • Sample output:​
  • ​​​
  1. Execute the following command to configure the net.ipv4.udp_mem parameter.​
  • ​
    echo "42396 56530 84792" > /proc/sys/net/ipv4/udp_mem​
    ​
tip​
Replace 42396 56530 84792 with the actual value required for your business. For more information, see About the net-ipv4-udp-mem parameter.​
​
​
Last updated: 2025.11.03 16:31:20