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

128
Visualizações
event loop vs worker-threads for web crawler in nodejs

I'm trying to build a web crawler with NodeJS. I'm debating what is the most efficient way to implement the crawler for scale and high number of requests.

Let assume that we only send 1 request to crawl a webpage and all the URLs inside it, and repeat the process until X depth or Y URLs crawled.

I came up with 2 design options (worker-threads vs event loop):

  1. A queue containing the URLs. For each URL in the queue I create a worker-thread (from a pool) to run the crawl task and each time I see a link it will be added to the queue.

  2. Use the native event loop, so that for each URL in the HTML page I'll run the same asynchronous function in a recursive way

I'm also planning on reading the HTML pages as a stream. Which is better in terms of performance?

I'll also like to know if each worker-thread has its own event loop.

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