【问题标题】:Apache Benchmark Error: Too Many Open FilesApache 基准测试错误:打开的文件太多
【发布时间】:2014-09-14 09:05:03
【问题描述】:

我正在使用 apache 基准测试我的本地主机网站,但收到此错误:

uday@uday-VirtualBox:/$ ab -n 2000 -c 2000 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
socket: Too many open files (24)

我尝试了一切 ulimit -n,将文件 /etc/sysctl.conf 更改为 fs.file-max = 700000。 这可能会有所帮助--

 sysctl -a | grep file
 fs.file-nr = 6816  0   700000
 fs.file-max = 700000

我不知道还能做什么我真的希望它能够工作我的系统 RAM 是 5GB。

【问题讨论】:

标签: ubuntu ubuntu-12.04 apachebench ulimit


【解决方案1】:

您可以将文件描述符设置得非常高。我总是这样做:

/etc/security/limits.d:

# set a high rate of file descriptors.
# for api and high traffic, high connection rate server.
# Setting for all users because if a user restarts the server,
# the process of the server has the same value the user had as nofile.
#

*        -    nofile    250000

之后,您需要完全重新启动,因为这些设置会被您的 shell 继承。 小心这个设置。通常您需要对其进行更严格的配置。但在这种情况下,您似乎只是将它用于在 Virtual Box 上进行测试。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-30
    • 2014-10-03
    • 2010-12-07
    • 1970-01-01
    • 2014-06-23
    • 2016-03-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多