- Documentation
Elastic Compute Service
Elastic Compute Service
Best Practices
Images
Kernel fine-tuning
Modifying net.ipv4.tcp_slow_start_after_idle parameter in Linux operating system
Kernel fine-tuning
Modifying net.ipv4.tcp_slow_start_after_idle parameter in Linux operating system
Modifying net.ipv4.tcp_slow_start_after_idle parameter in Linux operating system
This topic describes how to configure the net.ipv4.tcp_slow_start_after_idle parameter in the Linux operating system.
About the net.ipv4.tcp_slow_start_after_idle parameter
This parameter is used to control the behavior of a TCP connection when it is reactivated after being idle for a period of time. By default, the value of this parameter in the Linux kernel is 1, which means the TCP connection will immediately enter the slow start phase upon reactivation. If the value is 0, the TCP connection will not enter the slow start phase and will directly enter the congestion avoidance phase when reactivated.
Applicable scenario
- Scenarios with relatively light network load
- In cases of light network load, you can set this parameter to 0. This avoids every request going through the slow start process, reduces the congestion window when reactivating connections, and improves network transmission speed.
- Scenarios with relatively heavy network load
- In cases of heavy network load, you can set this parameter to 1 to avoid network congestion as much as possible.
Procedure
Configuration by using the proc interface
Configuration by using the net_tcp.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.
- Execute the following command on the target Linux instance to view the current value of the tcp_slow_start_after_idle parameter.
cat /proc/sys/net/ipv4/tcp_slow_start_after_idle
- Execute the following command to configure the tcp_slow_start_after_idle parameter.
echo 0 > /proc/sys/net/ipv4/tcp_slow_start_after_idle
tip
Replace 0 with the required value. Value:
- 0: When a TCP connection is reactivated, it will not enter the slow start phase and will directly enter the congestion avoidance phase.
- 1: When a TCP connection is reactivated, it will immediately enter the slow start phase.
You can use this method to permanently modify the parameter value while the operating system is running. You do not need to configure the parameter again after the instance restarts.
- Execute the following command to view the current parameter value.
sysctl net.ipv4.tcp_slow_start_after_idle
-
- Modify the value of the somaxconn parameter.
- Execute the following command to create the net_tcp.conf file.
vim /etc/sysctl.d/net_tcp.conf
- Press the i key to enter edit mode and add the following content to the end of the file.
net.ipv4.tcp_slow_start_after_idle = 0
tip
Replace 0 with the required value. Valid values:
- 0: When a TCP connection is reactivated, it will not enter the slow start phase and will directly enter the congestion avoidance phase.
- 1: When a TCP connection is reactivated, it will immediately enter the slow start phase.
- Press the Esc key to exit edit mode, enter :wq, and then press Enter to save and exit the file.
- Execute the following command to make the configuration take effect.
sysctl -p /etc/sysctl.d/net_tcp.conf
Last updated: 2025.11.03 16:31:20