无效的参数"设置键"net.core.somaxconn";

编程入门 行业动态 更新时间:2024-10-27 21:16:44
本文介绍了无效的参数"设置键"net.core.somaxconn";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试设置Linux内核.编辑/etc/sysctl.conf 并执行 sysctl -p 后它显示错误

I tried setting Linux kernel. After editing /etc/sysctl.conf and executing the sysctl -p it shows error

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

Linux发行版:Ubuntu 12.04.4 LTS,x86_64、3.2.0-60-通用

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.coredev_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 吗?

推荐答案

当我尝试微调nginx时遇到了同样的问题.这是针对Ubuntu内核制作的补丁程序的问题.

Same issue I got into when I tried to fine tune my nginx. This is the problem with the patch that been made to Ubuntu kernel. The

袜子结构的

sk_max_ack_backlog字段定义为无符号短

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

因此, inet_listen()中的积压参数不得超过 USHRT_MAX . listen()系统调用中的backlog参数被截断为 somaxconn 值.因此, somaxconn 的值不应超过 65535 ( USHRT_MAX ).

Therefore, the backlog argument in inet_listen() shouldn't exceed USHRT_MAX. The backlog argument in the listen() syscall is truncated to the somaxconn value. So, the somaxconn value shouldn't exceed 65535 (USHRT_MAX).

因此,简而言之,要使您的 net.core.somaxconn 工作,您不应提供大于 65535

So in short to make your net.core.somaxconn work you should not give value greater then 65535

net.core.somaxconn = 65535

net.core.somaxconn = 65535

这很可悲,但我们必须忍受它,除非您可以重新修补内核: lists.ubuntu/archives/kernel-team/2013-October/033041.html

This is sad but we have to live with it until unless you are ok to repatch your kernel: lists.ubuntu/archives/kernel-team/2013-October/033041.html

更多推荐

无效的参数"设置键"net.core.somaxconn";

本文发布于:2023-11-09 19:27:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573224.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   quot   net   core   somaxconn

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!