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

122
Vistas
node worker for loop slow between first and second iteration

I have a method that contains a for loop, and I have the main process and child processes calling this method.

20404 create:  2022-01-14 05:44:10.073
20404 create:  2022-01-14 05:44:10.075
20404 create:  2022-01-14 05:44:10.077
20404 create:  2022-01-14 05:44:10.077
send: 2022-01-14 05:44:10.078
send: 2022-01-14 05:44:10.079
send: 2022-01-14 05:44:10.079
16228 get  2022-01-14 05:44:10.081
11976 get  2022-01-14 05:44:10.081
9692 get  2022-01-14 05:44:10.082
11976 create:  2022-01-14 05:44:10.087
9692 create:  2022-01-14 05:44:10.087
16228 create:  2022-01-14 05:44:10.087
16228 create:  2022-01-14 05:44:10.113
9692 create:  2022-01-14 05:44:10.114
16228 create:  2022-01-14 05:44:10.116
11976 create:  2022-01-14 05:44:10.116
9692 create:  2022-01-14 05:44:10.117
16228 create:  2022-01-14 05:44:10.119
11976 create:  2022-01-14 05:44:10.121
11976 create:  2022-01-14 05:44:10.123

Above are logs, send is when main process sends the instruction to child process.

The first four lines are printed out from the main process, 2ms on average between every iteration

get is when a child process gets the instruction.

The first number is the process id. As you can see at this part:

11976 create:  2022-01-14 05:44:10.087
9692 create:  2022-01-14 05:44:10.087
16228 create:  2022-01-14 05:44:10.087
16228 create:  2022-01-14 05:44:10.113
9692 create:  2022-01-14 05:44:10.114
16228 create:  2022-01-14 05:44:10.116

The time gap between those two iterations is huge compared to the rest time gaps. Any ideas why this is happening?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When I first created the child process the first run was always slow, so I had to send some dummy data to make it run a few times before it receives the actual data. In that way, when the actual request data comes in, the time gaps between iterations become small and consistent. Maybe it is just a node problem

about 4 years ago · Juan Pablo Isaza 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