ipv4 instruction optimization and Invalid argument error parsing

 ipv4 instruction optimization and Invalid argument error parsing

2017-08-11 11:34:05

Number of readings: 399

In order to make the ipv4 optimization parameters in nginx take effect for a long time, you can append the parameter settings to the /etc/sysctl.conf file.

net.core.netdev_max_backlog parameter

net.core.netdev_max_backlog = 262144
  • 1

It is used to set the maximum number of packets that are allowed to be sent to the queue when the kernel cannot process the packets received by the network interface in time. The default is 128 (different linux systems will vary).

net.core.somaxconn parameter

net.core.somaxconn = 262144
  • 1

It is used to set the number of TCP connections initiated by the system at the same time. When the value is small, it cannot cope with high concurrency situations, resulting in connection timeout, retransmission and other problems.

net.ipv4.tcp_max_orphans parameter

net.ipv4.tcp_max_orphans = 262144
  • 1

Used to set the maximum number of TCP sockets allowed not to be associated with user file handles. Once this value is exceeded, TCP sockets not associated with file handles will be reset with a warning message. This value can be increased if the system has sufficient memory.

net.ipv4.tcp_max_syn_backlog parameter

net.ipv4.tcp_max_syn_backlog = 262144
  • 1

It is used to set the maximum value of connection requests that have not received confirmation information from the client. This value can be increased when the system memory is sufficient.

net.ipv4.tcp_timestamps parameter

net.ipv4.tcp_timestamps = 0
  • 1

Used to set timestamps, a value of 0 means disables support for TCP timestamps.

net.ipv4.tcp_synack_retries parameter

net.ipv4.tcp_synack_retries = 1
  • 1

It is used to set the number of SYN+ACK packets sent to the client before the kernel abandons the TCP connection. It is set to the second handshake in the TCP three-way handshake, generally set to 1.

net.ipv4.tcp_syn_retries parameter

net.ipv4.tcp_syn_retries = 1
  • 1

Similar to the net.ipv4.tcp_synack_retries parameter, it is used to set the number of SYN packets sent to the client before the kernel abandons the TCP connection.

Update takes effect

/sbin/sysctl -p
  • 1

Using the above command, the changes in /etc/sysctl.conf will take effect. However, a question will be prompted at this time: "sysctl: setting key 'net.core.somaxconn': invalid parameter", the reason for this error is that the value of the net.core.somaxconn parameter is set in the inet_listen() function should not be Exceeds USHRT_MAX, which is 65535, and the 262144 used in the above configuration far exceeds the upper limit, so a problem is prompted. The solution is as follows:

net.core.somaxconn = 65535
  • 1

After the command takes effect, the following information will be prompted:

root@**-VirtualBox:/home# /sbin/sysctl -p
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 65535
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission. https://blog.csdn.net/u013201628/article/details/77094947

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325098629&siteId=291194637