Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:55:37+00:00 2026-06-14T11:55:37+00:00

As per Understanding the node.js event loop , node.js supports a single thread model.

  • 0

As per Understanding the node.js event loop, node.js supports a single thread model. That means if I make multiple requests to a node.js server, it won’t spawn a new thread for each request but will execute each request one by one. It means if I do the following for the first request in my node.js code, and meanwhile a new request comes in on node, the second request has to wait until the first request completes, including 5 second sleep time. Right?

var sleep = require('sleep');
    sleep.sleep(5)//sleep for 5 seconds

Is there a way that node.js can spawn a new thread for each request so that the second request does not have to wait for the first request to complete, or can I call sleep on specific thread only?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:55:39+00:00Added an answer on June 14, 2026 at 11:55 am

    If you are referring to the npm module sleep, it notes in the readme that sleep will block execution. So you are right – it isn’t what you want. Instead you want to use setTimeout which is non-blocking. Here is an example:

    setTimeout(function() {
      console.log('hello world!');
    }, 5000);
    

    For anyone looking to do this using es7 async/await, this example should help:

    const snooze = ms => new Promise(resolve => setTimeout(resolve, ms));
    
    const example = async () => {
      console.log('About to snooze without halting the event loop...');
      await snooze(1000);
      console.log('done!');
    };
    
    example();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

as per my understanding about mvvm is. there is a model (entity class that
As per my understanding regarding N-Tier and SOA architecture. N-Tier N-Tier means dividing application
I have java based application hosted on my local tomcat server.As per my understanding
As per my understanding, a servlet container creates limited instances of servlets and multiple
As per my understanding, PHP processes doesn't behave as application server process. So, after
As per my understanding a lock is not released until the runtime completes the
Per a client's request I have written a communication class that inherits from webclient.
As per question says. Specifically i want the html.beginform() to have the runat=server attribute.
As per my understanding, JDBC Connection Pooling (at a basic level) works this way:
I have started learning Java language for Android Application developement. As per my understanding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.