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

293
Visualizações
"Hello world" Rust webserver is slower than Node when measured from Chrome but not from curl

I created a repository with a Node.js based and a Rocket.rs based web server inside.

Consider these steps:

  1. Start the Rocket.rs server via cargo run --release
  2. Start the Node.js server via node server.js
  3. Open http://localhost:8000/ (Rocket) and http://localhost:8090/ (Node) side by side in Chrome.
  4. With the developer console open, I keep refreshing both tabs and observe that the Node tab always finishes under 5ms while the Rocket tab sometimes takes more than 300ms to finish:

enter image description here

I observed a similar thing with actix-web too, though to a lesser extent: in that case, I only get the ~300ms delay if I haven't refreshed the tab for about 5 seconds. If I keep refreshing it, then requests finish under 5ms.

Interestingly, the delay seem to not occur if I measure via curl like this and this. I get around 4ms latency with both servers.

I noticed that Rocket and actix-web do not send Keep-Alive headers in their response. Which, if I understand it correctly, shouldn't matter for HTTP 1.1 requests.

I'm using WSL 2 with Ubuntu installed. Chrome is running in the host Windows.

Could somebody please shed some light on what's going on here?

Update: Forgot to mention that I was using nightly compiler to build the rocket server (Rocket v0.4.6 seem to require it). Changing to stable and building straight from the master branch got rid of the delay. The actix-web delay is still a bit concerning though, because I used stable compiler with that one.

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

0

Running all from windows, in node the response time is around 2-4 ms, and in rocket 1-2 ms. There is something weird happening on your enviroment.

Also tried on serving from WSL and same results.

Even on debug(rust) it takes on average +1ms more than on release, it might be some weird browser issue.

over 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