Rate This Document
Findability
Accuracy
Completeness
Readability

Tuning the Client

Purpose

Modify some parameter settings in the OS to improve client network performance.

Procedure

  1. Open the /etc/sysctl.conf file.
    1
    vim /etc/sysctl.conf
    
  2. Press i to enter the insert mode and add the following content to the file:
    net.ipv4.ip_local_port_range = 1024     65535
    net.ipv4.tcp_tw_reuse = 1
    net.core.somaxconn = 65535
    net.core.netdev_max_backlog = 8096
    net.ipv4.tcp_max_syn_backlog = 8192
    net.ipv4.tcp_keepalive_time = 600
    net.ipv4.tcp_fin_timeout = 30
    net.ipv4.tcp_max_tw_buckets = 3000
    Table 1 Network parameters

    Parameter

    Description

    net.ipv4.tcp_tw_reuse

    TIME-WAIT sockets can be reused for new TCP connections.

    • 0: disabled (default)
    • 1: enabled

    net.ipv4.ip_local_port_range

    Port range for external connections

    net.core.somaxconn

    Maximum length of a network port listening queue. This is a global parameter and the default value is 128.

    net.core.netdev_max_backlog

    Maximum number of packets that can be sent to a queue when the packet receive rate of each network port is faster than the kernel processing rate.

    net.ipv4.tcp_max_syn_backlog

    Length of a queue of connections that are waiting for a client confirmation message (SYN). The default queue length is 1024. You can increase the queue length to 262144 to accommodate more waiting network connections.

    net.ipv4.tcp_keepalive_time

    Time that a socket remains in the FIN-WAIT-2 state when the socket is to be disabled on the local end

    net.ipv4.tcp_fin_timeout

    Enables quick reclamation of the sockets in TIME-WAIT state during TCP connection establishment. The default value 0 indicates that quick reclamation is disabled.

    net.ipv4.tcp_max_tw_buckets

    Maximum number of TIME_WAIT sockets. The default value is 180000.

  3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Make the modification take effect immediately.
    1
    sysctl -p