我正在使用 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/