Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

444
Visualizações
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.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

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
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda