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

193
Visualizações
Can I have multiple event loop in nodejs microservices?

I Have 4 Microservices, named "auth_ms","coin_ms","device_ms" and setting_ms. I'm running all 4 Microservices on different ports, for example: 3000, 3001, 3002 and 3003.

My Question: By running these 4 servers on different port, do we have 4 event-loops ? if NOT, then if I put it in Docker containers does it have 4 event-loops? Suppose there is only 1 event loop for everything then how does microservices help in processing?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

When you write node index.js in the terminal you are creating a NodeJS process, which contains all of the goodies of node, including the event loop.

Assuming your microservices run in separate node instances, then you will have an event loop for every one of your instances of node. And it does not matter if it's in docker or not as long as there are separate processes running.

Now, if there is only one OS process, then only one action can be performed at a time. And worse yet, if you run it on multi-core machine, only one of the cores will be used, wasting all of the potential resources that can be utilized for processing. For this reason in production environment I usually run container for every vCPU there is available.

So what you want to have is - separate processes for every service you have (separate docker containers also count) and the rest will be handled by the system.

about 4 years ago · Juan Pablo Isaza Relatório

0

Each of your microservices are running as different processes locally, so they will have separate event-loops. This also applies to Docker containers, where the services will be completely isolated.

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