Invalid argument "setup key" net.core.somaxconn "

I tried to configure the linux kernel after editing /etc/sysctl.conf and execute sysctl -p

shows an error

Invalid argument" setting key "net.core.somaxconn" 

Linux distribution: Ubuntu 12.04.4 LTS, x86_64, 3.2.0-60-generic

$ cat / etc / sysctl.conf

 net.ipv4.conf.eth0.arp_notify = 1 vm.swappiness = 0 net.ipv4.tcp_rmem = 4096 87380 4194304 net.ipv4.tcp_wmem = 4096 16384 4194304 net.core.wmem_default = 8388608 net.core.rmem_default = 8388608 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.core.somaxconn = 262144 net.core.netdev_max_backlog = 262144 fs.file-max = 1048576 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_keepalive_time = 1200 net.ipv4.tcp_max_syn_backlog = 409600 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_orphans = 262144 

Can net.core.somaxconn be increased to 262144?

+10
linux linux-kernel networking sysctl
source share
1 answer

The same problem I encountered when I tried to configure my nginx. This is a problem with a patch made for the Ubuntu kernel.

The sk_max_ack_backlog field of the sock structure is defined as unsigned short.

Therefore, the lag argument in inet_listen() must not exceed USHRT_MAX . The backlog argument in the listen () system call is truncated to somaxconn. Therefore, the somaxconn value should not exceed 65535 (USHRT_MAX).

In short, for your net.core.somaxconn to work, you must not give a value greater than 65535

net.core.somaxconn = 65535

This is sad, but we have to live with it until you are in order to reboot your kernel. https://lists.ubuntu.com/archives/kernel-team/2013-October/033041.html

+33
source share

All Articles