套接字:打开的文件太多 (24) apache bench lighttpd

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1504577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:12:55  来源:igfitidea点击:

socket: Too many open files (24) apache bench lighttpd

apachescalabilitylighttpdfile-descriptor

提问by Tomasz Smykowski

When I start Apache Bench test:

当我开始 Apache Bench 测试时:

ab -n 10000 -c 1300 http://domain.com/test.php

ab -n 10000 -c 1300 http://domain.com/test.php

I get error:

我得到错误:

socket: Too many open files (24)

套接字:打开的文件太多 (24)

When i change to '-c 1000' it works fine.

当我更改为“-c 1000”时,它工作正常。

Because I can have more than 1000 concurrent users I would like to fix socket too many open files problem or increase parameter. How to do this and where?

因为我可以有超过1000个并发用户我想修复socket太多打开文件的问题或增加参数。如何做到这一点以及在哪里?

I use lighttpd on centos 5.

我在 centos 5 上使用 lighttpd。

回答by catwalk

ulimit -n 10000

That might not work depending on you system configuration Consult thisto configure your system.

根据您的系统配置,这可能不起作用 请参阅此内容以配置您的系统。

回答by Dan Soap

Check out the documentationfor lighty. You might have to set the server.max-fdsoption. Also server.max-connectionsshould be changed accordingly (again, see the documentation).

查看lighty的文档。您可能必须设置该server.max-fds选项。也server.max-connections应该相应地更改(再次参见文档)。

回答by diyism

to permernent change max opened files limit, you should modify /etc/security/limits.conf?and reboot system:

要永久更改最大打开文件限制,您应该修改 /etc/security/limits.conf? 并重新启动系统:

echo?-ne?"?
*?soft?nofile?65536?
*?hard?nofile?65536?
"?>>/etc/security/limits.conf?