Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

452
Vistas
Node + Express: loadtest causing the application to quit with Error: accept ENFILE

My app quits at relatively low stress point when I run load test on it. For testing I use this npm package loadtest.

I run the test at 1000 requests per second with 10 concurrency for 10 seconds.

loadtest http://localhost:3000/my/api -t 10 -c 10 --rps 1000

The application quits after about two seconds and gives the following error which is not very useful.

events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: accept ENFILE
    at exports._errnoException (util.js:1050:11)
    at TCP.onconnection (net.js:1462:24)

Apparently, this is related to the number of open files. I tried this command ulimit -n <number> but it doesn't help. It's limited at 9999 (I can't set it above that).

The application can handle around 400rps at 10 concurrencies.

My local machine is a Mac OS Sierra, CPU: 1.6GHz, RAM: 8GB.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

macOS sets rather low kernel limits on the allowed number of open file descriptors (both in total and per process). I had to check on my wife's Mac, and the default per-process limit is 10240, which is basically spot on to what you are being limited to using ulimit ( ulimit cannot go beyond the kernel-imposed limit).

It's easy to increase these values, though, running the sysctl command:

sudo sysctl kern.maxfiles=122880 kern.maxfilesperproc=102400

(those are the values that I'm using on my Mac, they are rather arbitrary but work okay for me)

If you want them to stick after a reboot, add the following two lines to the file /etc/sysctl.conf (if it doesn't exist yet, just create it):

kern.maxfiles=122880
kern.maxfilesperproc=102400
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda