filmov
tv
Let's solve a most popular myth..!!! How does NodeJS handle multiple requests?
![preview_player](https://i.ytimg.com/vi/0j1PgRWXkFo/maxresdefault.jpg)
Показать описание
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
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
Комментарии