node.js - Node + Express: loadtest causing the application to quit with Error: accept ENFILE -
my app quits @ relatively low stress point when run load test on it. testing use npm package loadtest.
i run test @ 1000 requests per second 10 concurrency 10 seconds.
loadtest http://localhost:3000/my/api -t 10 -c 10 --rps 1000
the application quits after 2 seconds , gives following error not useful.
events.js:163 throw er; // unhandled 'error' event ^ error: accept enfile @ exports._errnoexception (util.js:1050:11) @ tcp.onconnection (net.js:1462:24)
apparently, related number of open files. tried command ulimit -n <number>
doesn't help. it's limited @ 9999 (i can't set above that).
the application can handle around 400rps @ 10 concurrencies.
my local machine mac os sierra, cpu: 1.6ghz, ram: 8gb.
macos sets rather low kernel limits on allowed number of open file descriptors (both in total , per process). had check on wife's mac, , default per-process limit 10240, spot on being limited using ulimit
( ulimit
cannot go beyond kernel-imposed limit).
it's easy increase these values, though, running sysctl
command:
sudo sysctl kern.maxfiles=122880 kern.maxfilesperproc=102400
(those values i'm using on mac, rather arbitrary work okay me)
if want them stick after reboot, add following 2 lines file /etc/sysctl.conf
(if doesn't exist yet, create it):
kern.maxfiles=122880 kern.maxfilesperproc=102400
Comments
Post a Comment