express.static makes the server crash
Hello,
i'm doing a simple test with ApacheBench to check how fast express sends the static files.
I have a very small css: (static/css/default.css)
body { background-color:#FFFFFF; }
and this middleware:
app.use(express.static(__dirname + '/static'));
ab -n 10000 -c 1000 http://127.0.0.1:3000/css/default.css (Total of 15 requests completed)
This test blocks the server, with the follow error:
stream.js:99 throw er; // Unhandled stream error in pipe. ^ Error: EMFILE, Too many open files '/home/damiano/node/mywebsite.it/static/css/default.css'
is it a bug?
damiano@damiano-P5K-VM:~$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 20 file size (blocks, -f) unlimited pending signals (-i) 16382 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) unlimited virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
1024 is small for ulimit -n, up to like 10k or 5k at least, try again
perfect, it works! I set it at 10k