IP Virtual Server (IPVS) collects per-service statistics through a built-in timer named estimation_timer. In large-scale environments, this timer causes network latency of tens to hundreds of milliseconds and triggers jitters. You can disable the estimation feature on Alibaba Cloud Linux to eliminate these overheads.
How the estimation feature causes jitters
Supported kernel versions
You can disable the IPVS estimation feature only on the following Alibaba Cloud Linux kernel versions:
| Distribution | Minimum kernel version |
|---|---|
| Alibaba Cloud Linux 2 | 4.19.91-22 |
| Alibaba Cloud Linux 3 | 5.10.134-14 |
Disable the estimation feature
Disabling the estimation feature makes IPVS service statistics unavailable. Commands such as sudo ipvsadm -Ln --stats will no longer report connection count or received packet count changes. Evaluate the impact on your workloads before proceeding.
Connect to your Elastic Compute Service (ECS) instance.
For more information, see Connect to a Linux instance by using a password or key.
Configure the sysctl parameter.
Open the sysctl configuration file:
sudo vim /etc/sysctl.confAdd the following line at the end of the file, then save and close:
net.ipv4.vs.run_estimation = 0Apply the configuration:
sudo sysctl -p
Handle container scenarios.
In container environments, perform the following additional steps.
IPVS module reloads
Each time the IPVS module reloads, you must rerun
sysctl -pfor the configuration to take effect. To automate this, create a modprobe configuration file:Create the file:
sudo vim /etc/modprobe.d/ipvs.confAdd the following content, then save and close:
install ip_vs /sbin/modprobe --ignore-install ip_vs && /sbin/sysctl -p
This ensures that the
sysctl.confsettings apply automatically when the system reloads the IPVS module.Network namespace containers
If you configured IPVS rules for containers that use network namespaces, disable the estimation feature in each container separately.
NoteFor Alibaba Cloud Container Service for Kubernetes (ACK), the default kube-proxy proxy mode is IPVS, and IPVS rules are configured on the host side. ACK users do not need to disable estimation for each container. Skip this step if you use ACK.
Verify that the feature is disabled.
Use either of the following methods to confirm that the estimation feature is disabled.
Method 1: Check the sysctl parameter. Run the following command. If the output is
0, the feature is disabled.sudo sysctl net.ipv4.vs.run_estimationMethod 2: Check IPVS statistics. Run the following command multiple times. If the statistical values do not change between runs, the feature is disabled.
ImportantIf
ipvsadmis not installed, install it first:sudo yum install ipvsadmsudo ipvsadm -Ln --stats
What to do next
Verify that network jitter and latency issues are resolved
After you confirm the feature is disabled, verify that jitters and latency are resolved:
Ping test. Ping the IP address or domain name of the ECS instance. If the latency remains stable and within a reasonable range, the issue is resolved.
Performance test. Use a network performance testing tool to run a latency and jitter test. If long tail latency is significantly reduced or no longer occurs, the issue is resolved.
NoteIf jitters or latency persist after you disable the estimation feature, use the network diagnostics feature in the Container Service for Kubernetes (ACK) console to investigate. For more information, see Network diagnostics.
Re-enable the estimation feature
To re-enable estimation, change the run_estimation value to 1 in both the sysctl configuration file (/etc/sysctl.conf) and the modprobe configuration file (/etc/modprobe.d/ipvs.conf). Then run sudo sysctl -p to apply the change.