Let's solve a most popular myth..!!! How does NodeJS handle multiple requests?

preview_player
Показать описание
There's a lot of confusion out there about concurrency and parallelism. Some people use the terms interchangeably, but they actually refer to two different things.

Concurrency is when two or more tasks can start, run, and complete in overlapping time periods. It doesn't necessarily mean that they'll be running at the same time, but they can be interleaved so that at any given time, there is always one task running.

Parallelism is when two or more tasks can truly run at the same time. In order for this to happen, the tasks must be able to run on separate CPUs or cores.

So why is it important to understand the difference? Concurrency is important because it allows you to structure your code in a way that makes efficient use of resources. Parallelism is important because it can dramatically improve performance by doing more than one thing at a time.

If you're writing code that will be running on a single CPU or core, then you need to be aware of concurrency issues. If your code will be running on multiple CPUs or cores, then you need to be aware of parallelism issues.

NodeJS is a single-threaded platform. This means that it can only process one request at a time. So, how does it handle multiple requests?

This event-driven model is very efficient and allows NodeJS to handle thousands of concurrent requests with ease.

#krishdinesh #nodejs #concurrency

Рекомендации по теме
Комментарии
Автор

In Place of a Database, one can assume it to be an Operating System, the v8 engine communicates with OS only to execute the program. Since OS supports multi-threading, hence things are performed faster.
in the case of multiple cores, It can do I/O tasks parallelly also. But the Application thread would be only 1.

dishantvashistha
Автор

The way you explained makes it look like a piece of cake. Great work and thank you for clearing my doubts😃👍

shivangverma
Автор

This cleared my doubts in a very simple way. Thanks !!

rajanchavda
Автор

Too Good, loved the example of concurrency

syedwakil-ni
Автор

Great video! Enjoyed every bit and it also helped extend my understanding of the Node.JS runtime 🙌

dan_le_brown
Автор

This is the most interesting video about this topic I ever seen on youtube sir 🥰

techjaye
Автор

Thank you for this great tutorial. Can you please let me know if asyn or concurrency will put too much load on the database as compared to syn requests?

sanxavier
Автор

So what’s the best backend for multi threading request you think? Let’s think we making a quiz app and there’s a lot of users sending request at the same time.

Kumuthini
Автор

When I code, I think sequentially but node works concurrently, this sometimes make things worse... can u make a video on how we should handle concurrency, or at leas how we should think on such cases.

rukshandevelopment
Автор

Nice video, understood lots of misconceptions that I had. Also, can you do a video about reactive java spring webflux. I think it will work in both a reactive way as well a parallel way. so it would be great if you can explain the mechanism of spring webflux

jayamaljayamaha
Автор

thank you sir. I like to know how work java application when multi treading and concurrent processing.(like spring web)

madushankakumara
Автор

your english is confusing enought,
are you saying node can do this or can't do this

I can undertand that you have the concept figured out, but because of barrier I'm unable to clearly I understand what you are saying

vergil_