ubuntu - Apache 基准测试错误 : Too Many Open Files

标签 ubuntu ubuntu-12.04 apachebench ulimit

我正在使用 apache benchmark 对我的本地主机网站进行基准测试,但出现此错误:

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。

最佳答案

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

/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 上进行测试。

关于ubuntu - Apache 基准测试错误 : Too Many Open Files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24906097/

相关文章:

ubuntu - 无法在 Linux 上使用 alexbrainman/odbc 连接到 Go 中的第 3 方 ODBC 驱动程序

bash - 在shell中的另一个函数中调用时如何将参数传递给函数

android - 错误 libGL.so : cannot open shared object file using Android emulator

performance-testing - 为并发 apache bench 请求发送不同的 POST json

apache - Node.js 在 Windows 上表现不佳吗,它的基本 I/O 肯定不会比 apache 慢

apache - 尝试设置 AUTHBIND=yes,但从 zip 文件安装 tomcat 时未创建文件 etc/default/tomcat8

c - 为什么调用 lseek 后读取的文件总是返回 0?

ruby-on-rails - Ubuntu rvm 设置问题

python-2.7 - 如何在 Ubuntu 12.04 中删除 Python 版本?

php - Apache 基准文档长度与 YSlow 页面的总重量