【问题标题】:socket: Too many open files (24) apache bench lighttpd套接字:打开的文件太多 (24) apache bench lighttpd
【发布时间】:2010-12-03 00:55:51
【问题描述】:

当我开始 Apache Bench 测试时:

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

我得到错误:

socket:打开的文件太多 (24)

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

因为我可以有超过 1000 个并发用户,所以我想修复套接字打开文件过多的问题或增加参数。怎么做?在哪里做?

我在 centos 5 上使用 lighttpd。

【问题讨论】:

  • When i change to '-c 1000' it works fine. 有助于保持懒惰 ;)

标签: apache scalability lighttpd file-descriptor


【解决方案1】:
ulimit -n 10000

根据您的系统配置,这可能不起作用 请咨询this 来配置您的系统。

【讨论】:

  • 默认情况下,大多数系统将每个用户的文件描述符数限制为 1024。您需要跳过箍,让您按照我参考的文章中的描述创建更多内容。它适用于我的 centos5。
  • 在 OS X EL Capitan 上也能正常工作。
  • ^^ 不要那样做ulimit -n 0
  • ^ 不要那样做 ^
【解决方案2】:

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

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

【讨论】:

    【解决方案3】:

    请查看 documentation 了解轻量级。您可能必须设置 server.max-fds 选项。 server.max-connections 也应相应更改(再次参见 the documentation)。

    【讨论】:

      猜你喜欢
      • 2015-11-30
      • 2010-10-27
      • 2020-03-07
      • 1970-01-01
      • 1970-01-01
      • 2016-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多