All Products
Search
Document Center

:What do I do if I cannot connect to an instance because the value of the net.core.optmem_max Linux kernel parameter is too small?

Last Updated:Mar 07, 2025

The net.core.optmem_max network parameter in the Linux kernel is used to set the maximum size of the receive buffer for each socket. The value of this parameter affects the performance of network applications when the applications process many concurrent connections and much high-bandwidth traffic. A small value of this parameter on an Elastic Compute Service (ECS) instance may cause degraded network performance, increased packet loss rate, and high latency, while also affecting the stability of connections to the instance. This topic describes how to change the value of this parameter.

Problem description

A small value of the net.core.optmem_max parameter in Linux may cause severe network connectivity issues. When the system must process many concurrent connections and much high-bandwidth traffic, a small value of this parameter may cause the following issues:

  1. Degraded network performance: An insufficient buffer size prevents the system from processing incoming packets at the earliest opportunity and reduces the throughput.

  2. Increased packet loss rate: Excess packets are discarded when the buffer is full, which affects the integrity of data transmission.

  3. High latency: High latency may occur in network applications due to waiting for buffer resources, especially in high-load scenarios.

  4. Remote connection failure: Connection disruptions or failures may occur for services that depend on stable network connections, such as SSH, Remote Desktop Protocol (RDP), or other remote management tools, due to an insufficient buffer.

Solution

To change the value of the net.core.optmem_max parameter, perform the following steps:

  1. Connect to the instance by using Virtual Network Computing (VNC).

    For more information, see Connect to an instance by using VNC.

  2. View the value of the net.core.optmem_max parameter.

    Run the following command to view the value of the net.core.optmem_max parameter:

    sudo sysctl net.core.optmem_max

    image

  3. Change the value of the net.core.optmem_max parameter.

    1. Open the /etc/sysctl.conf configuration file to check whether the file contains the net.core.optmem_max parameter. If a smaller-than-expected value is configured for this parameter, we recommend that you delete the net.core.optmem_max parameter from the configuration file to restore the default settings.

      Important
      • You can use the Vim editor to modify the configuration file. Back up the file before modifying it to prevent system exceptions caused by accidental operations.

      • You can also change the value of the net.core.optmem_max parameter based on the actual amount of network traffic and system load.

    2. Run the following command for the change to take effect:

      sudo sysctl -p