我在编辑/etc/sysctl.conf后尝试设置linux内核并执行sysctl -p
显示错误
Invalid argument" setting key "net.core.somaxconn"
Linux发行版: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
可以将net.core.somaxconn增加到262144吗?
答案 0 :(得分:32)
当我试图微调我的nginx时,我遇到了同样的问题。这是针对ubuntu内核的补丁的问题。
sock结构的sk_max_ack_backlog字段定义为unsigned short。
因此,inet_listen()
中的积压参数
不应该超过USHRT_MAX
。 listen()系统调用中的backlog参数被截断为somaxconn值。 因此,somaxconn值不应超过65535(USHRT_MAX)。
简而言之,制作你的" net.core.somaxconn"工作你不应该给予大于65535的价值
net.core.somaxconn = 65535
这很难过,但除非你可以重新安装内核,否则我们必须忍受它。 https://lists.ubuntu.com/archives/kernel-team/2013-October/033041.html
由于