1

I'm using apache benchmark to benchmark my localhost website but getting this error:

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)

I tried everything ulimit -n, changing file /etc/sysctl.conf for fs.file-max = 700000. This might help--

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

I don't know what else to do I really want this to work my system RAM is 5GB.

Uday Swami
  • 395
  • 8
  • 22

1 Answers1

3

you could set file descriptors very high. i always do it through:

/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

After that you need a full reboot, as these settings inerhited by your shell. Be careful with this setting. Normally you need to configure it more strict. But in this case it seems like your just using it for testing on a Virtual Box.

Julian Hille
  • 669
  • 5
  • 11