How Concurrency and throughput is handled?

Node JS is single threaded so callback functions are sent to event loop where after completing other processes callback function is executed. To ensure concurrency event loop efficiently handles non-JavaScript operations such as I/O operations and concurrent code is executed aterwards.

Non-blocking asynchronous operations are much faster as compared to Blocking synchronous operations. This is different in JavaScript as most other languages create multiple threads to handle concurrency

Blocking and Non-Blocking in Node

Node is based on an event-driven non-blocking I/O model. This article discusses what does Blocking and Non-Blocking in Node means.

Table of Content

  • What is Blocking?
  • What is Non-Blocking ?
  • How Concurrency and throughput is handled?
  • Drawback of mixing Blocking and Non-Blocking Code

Similar Reads

What is Blocking?

It refers to the blocking of further operation until the current operation finishes. Blocking methods are executed synchronously. Synchronously means that the program is executed line by line. The program waits until the called function or the operation returns....

What is Non-Blocking ?

...

How Concurrency and throughput is handled?

It refers to the program that does not block the execution of further operations. Non-Blocking methods are executed asynchronously. Asynchronously means that the program may not necessarily execute line by line. The program calls the function and move to the next operation and does not wait for it to return....

Drawback of mixing Blocking and Non-Blocking Code

...

Contact Us