Concurrency vs Parallelism in Node.js

  Рет қаралды 40,256

Mehul - Codedamn

Mehul - Codedamn

Күн бұрын

What is concurrency in Node.js? Is concurrency the same as parallelism? In this video, learn concurrency and parallelism in Node.js and the comparison between them!
Drop a comment and let us know if you've watched this video till the end!
⚛️ Do you want to become a full-stack web developer? Check out codedamn's full-stack learning path: cdm.sh/fullstack
⚛️ Get started with web3 and decentralized technologies today: cdm.sh/web3
Timestamps
0:00 Teaser
0:32 What is Concurrency?
1:48 What is Parallelism?
2:15 Why computer doing concurrent execution?
3:36 Scenario of Node.js in this situation
6:25 Can you run Node.js parallelly?
7:06 Conclusion
7:26 Outro
👉 Checkout codedamn on social:
Instagram: cdm.sh/ig
Twitter: cdm.sh/twt
Discord community: cdm.sh/discord
Facebook: cdm.sh/fb
GitHub: cdm.sh/github
If you found the video valuable, please leave a like and subscribe ❤️ It helps the channel grow and helps me pumping out more such content.
✨ Hashtags ✨
#concurrency #parallelism #nodejs #2022

Пікірлер: 78
@bleakCode
@bleakCode Жыл бұрын
I really loved how you explained how concurrency works in nodejs without throwing too many jargon. It was also interesting to note that tho nodejs code might not be running parallel. But system calls are running in parallel to get things done faster
@sanjarcode
@sanjarcode Жыл бұрын
A point that's often missed, including here, is that the event loop comes into picture only after all synchronous code has finished executing. The queues are populated from the beginning, yes, but they come into the picture only when synchronous code has finished executing.
@dheeraj_kr._shrivastva2.118
@dheeraj_kr._shrivastva2.118 6 ай бұрын
how about when we use await does it wait make that sync code or instead of switching task it stays and answer it?
@abdulsalamalmahdi8332
@abdulsalamalmahdi8332 3 ай бұрын
​@dheeraj_kr._shrivastva2.118 could you rephrase the question better or at least use some punctuation.
@prashantbismani
@prashantbismani 9 ай бұрын
Amazing Explanation, Thank you for making this. Please continue creating such videos, you got huge potential.
@jimlougheed9922
@jimlougheed9922 2 жыл бұрын
I watched this video to the end, great info!
@Systemv1
@Systemv1 Жыл бұрын
Fantastic - thank you for the talk. The whiteboard approach works really well :)
@DavidMood
@DavidMood 2 жыл бұрын
U watched it till the end. It was actually a concept I looked to learn more. Please tell more about practical applications of parallelism with some code examples. 🙏
@sumitganjave3129
@sumitganjave3129 2 жыл бұрын
Yes.. give detailed explanation on node parallelism
@shubhamsingh4701
@shubhamsingh4701 2 жыл бұрын
your can refer to thread pool in node js I think you will get some practical example.....
@justinJ689
@justinJ689 2 жыл бұрын
yes, please give an example.
@sourav_singh_diaries
@sourav_singh_diaries 4 ай бұрын
Parallelism is something which I wanna add about. True parallelism can only be achievable via multiple CPUS or multiple Cores of CPU. If you just make 4 process of nodeJS, one single core CPU won't be able to execute it parallely. Parallelism is actually about leveraging the hardware of machine Not just processes but you can also have just worker threads in same process with multiple Cores for parallelism I have talked about here : kzfaq.info/get/bejne/ppOZYMmglbXLiHU.htmlsi=HpL64INhhR1qx7Bk
@Sandeep-zd6dq
@Sandeep-zd6dq 2 жыл бұрын
Simple easy explanation of event loop. 🙌👍 Watched till the end.
@dwaipayansen2966
@dwaipayansen2966 2 жыл бұрын
I watched this video till the end and it was very lucid, thanks!
@ubaidkhan426
@ubaidkhan426 2 жыл бұрын
Splendid explanation 👍 I've watched the video till the end. Thank U :)
@aurobindobhuyan2107
@aurobindobhuyan2107 4 ай бұрын
I was learning Node clustering, and this video added more details to it.❤
@jorgeortiz41395
@jorgeortiz41395 2 жыл бұрын
Got to respect the work and consistent video upload schedule!
@shubhamjaiswal9100
@shubhamjaiswal9100 2 жыл бұрын
Ajinkya Rahane Cricketing career ka pata nhi ....but his teaching career in coding seems to be bright enough
@pavan-iu7qy
@pavan-iu7qy 2 жыл бұрын
I watched this till the end and also watch your upcoming videos till the end
@geekofia
@geekofia 2 жыл бұрын
I watched this video till the end as always ❤️
@z.cibis-iqbal8774
@z.cibis-iqbal8774 2 жыл бұрын
Thanks allot, i watched the video till the end:)
@tahasaleh4697
@tahasaleh4697 2 жыл бұрын
Watched till the end 👍
@ruhankhandakar
@ruhankhandakar 2 жыл бұрын
always watched all videos of ur till the end
@douglasmiranda4756
@douglasmiranda4756 2 жыл бұрын
Thank you very much!
@adityarawat4964
@adityarawat4964 4 ай бұрын
This guy is a true fullstack developer
@philippec4448
@philippec4448 2 жыл бұрын
I watched the video til the end and as usual I learned a lot ! Thanks ! Any chance you can explain in a future video how BullMQ works ?
@SleepeJobs
@SleepeJobs 2 жыл бұрын
Excellent explaination
@MuhammadUsman-gz8fk
@MuhammadUsman-gz8fk 11 ай бұрын
Nice Presentation
@djharshal0007
@djharshal0007 Жыл бұрын
Amazing explanation 👌🏻👌🏻
@ahsanhabibabir5887
@ahsanhabibabir5887 2 жыл бұрын
thnx, this was very useful
@Aditya.Santra
@Aditya.Santra 2 жыл бұрын
I WATCHED THIS VIDEO TILL THE END!
@isurucumaranathunga
@isurucumaranathunga 2 жыл бұрын
Thank you so much
@CadisDiEtrama000
@CadisDiEtrama000 Жыл бұрын
It would be really cool to see some kind of load testing comparison... E.g. how many users/requests or w/e can a node express server that runs inside a 2GB/1CPU VPS, etc. and how each of such different approaches affects that
@vasurangpariya8492
@vasurangpariya8492 2 жыл бұрын
Great please give more videos about node js
@dhanabalt5552
@dhanabalt5552 2 жыл бұрын
Perfect 👍
@rahuleum
@rahuleum 2 жыл бұрын
I watched till the end
@uzair004
@uzair004 2 жыл бұрын
multiple instance of nodejs for parallelism , is it the reason we use process manager like PM2 on production?
@GarTheStar
@GarTheStar 2 жыл бұрын
I watched this video till the end
@ashish_prajapati_tr
@ashish_prajapati_tr 2 жыл бұрын
awesome
@ADITYAKUMARking
@ADITYAKUMARking 2 жыл бұрын
I watched this video till the end.
@ankitsuda
@ankitsuda 2 жыл бұрын
I watched the video till the end
@vishal_sharma_rha
@vishal_sharma_rha 2 жыл бұрын
Great 👍
@ikumargaurav
@ikumargaurav 2 жыл бұрын
I watched the video til the end.
@dixztube
@dixztube 25 күн бұрын
I watched to the end. Give me something!
@dizzymolecule6759
@dizzymolecule6759 2 жыл бұрын
This is similar to the scheduling concept in operating system. For example round robin scheduling
@liu-river
@liu-river 9 ай бұрын
How do you run nodejs in all 4 cores? Do you mean using worker threads?
@HarshSingh-cp8mq
@HarshSingh-cp8mq 2 жыл бұрын
sir , so should i move to Golang to achieve parallelism
@ankitbinjola
@ankitbinjola 2 жыл бұрын
Is node microservices an example of parallelism ?
@rushikeshkhilari4662
@rushikeshkhilari4662 2 жыл бұрын
then what promise.all() can be defined?
@ahmedhafez9951
@ahmedhafez9951 11 ай бұрын
@poonamgur2294
@poonamgur2294 2 жыл бұрын
So how multithreading is different?
@eric000
@eric000 2 жыл бұрын
Pls clarify for parallelism no change in code is needed? NodeJS does it by itself of multiple cores available?
@dhanushs9159
@dhanushs9159 2 жыл бұрын
You need to make use of cluster module (inbuilt to node). Or you can make use PM2.
@eric000
@eric000 2 жыл бұрын
@@dhanushs9159 thanks👊👍
@sanjarcode
@sanjarcode Жыл бұрын
We already have the answer, but just answering them in order. 1. Almost no change needed. Some change if using cluster module. No change needed if using pm2. 2. Node.js does it by itself. Parallelism will happen if cores are available, otherwise the tasks will compete.
@abdulazeezshakrullah9630
@abdulazeezshakrullah9630 2 жыл бұрын
Which is faster and easier to maintain , an app built from only Node.js or stack combination. I always think it's hard to learn node.js, since I haven't started learning. I'd like to learn through your recommended videos or sites. THANKS.
@kofiboateng9181
@kofiboateng9181 2 жыл бұрын
JavaScript is inherently slower than almost server side code (Go Rust Java etc..) if you are writing a enterprise level app, you will most likely use multiple backends depending on your business needs (Java, Typescript/Node, maybe Django) most Fortune 500 countries are using multiple backends and then Angular/ReactJs+Typescript for static and pseudo static typing
@sanjarcode
@sanjarcode Жыл бұрын
Node.js is the easiest to learn in general, and including if you need parallelism. It's slower than Golang and Rust, but they're harder to learn as compared to JS.
@souravdas423
@souravdas423 2 жыл бұрын
I have a small doubt suppose my one code a different process and on a different thread. Are both of them an example of paralism?
@sanjarcode
@sanjarcode Жыл бұрын
1. Different processes - will run parallelly if CPU cores are available, otherwise they'll complete (i.e. it'll become concurrent). How to implement - cluster module or the pm2 package. 2. Different threads on same Node process - same as before. How to implement - worker_threads. Parallelism depends on CPU number cores.
@hamzarasool7669
@hamzarasool7669 2 жыл бұрын
where do we use this concept in real life
@epinino
@epinino 2 жыл бұрын
how to do it in nodejs?
@mohamedfaalil
@mohamedfaalil 2 жыл бұрын
I watched this video till end
@prashlovessamosa
@prashlovessamosa 2 жыл бұрын
Me also
@thesouth4976
@thesouth4976 2 жыл бұрын
" You from another universe"😂😂 nice reference
@sourav_singh_diaries
@sourav_singh_diaries 4 ай бұрын
Good explaination. Parallelism is something which I wanna add about. True parallelism can only be achievable via multiple CPUS or multiple Cores of CPU. If you just make 4 process of nodeJS, one single core CPU won't be able to execute it parallely. Parallelism is actually about leveraging the hardware of machine Not just processes but you can also have just worker threads with multiple Cores for parallelism.I have talked about here : kzfaq.info/get/bejne/ppOZYMmglbXLiHU.htmlsi=HpL64INhhR1qx7Bk
@anthonypace5354
@anthonypace5354 7 ай бұрын
workers?
@kailash4591
@kailash4591 2 жыл бұрын
The end of video.
@sanjarcode
@sanjarcode Жыл бұрын
Folks, true parallelism is possible in Node.js (using the worker_threads, or cluster module or pm2 - pick what is suitable for you). For speed, use a different language.
@chrissigrilus6390
@chrissigrilus6390 2 жыл бұрын
Your videos become better and better from a quality perspective but become worse and worse from the point of video quality :D You should review your video setup and fix the issue, it has been much better in the past. I would also wish that your website would provide more courses than are longer and go into more detail. Currently it makes no sense to subscribe because I would finish all courses in a matter of weeks and they are to short to really go into detail.
@AllanSavolainen
@AllanSavolainen 2 жыл бұрын
I hope they fix this limation soon, there are so many easy things you could parallelise in JS. All event listeners should run in their own threads, as all settimeouts etc. All async calls can be run in their own threads. Just add automatic locking on global variables and DOM and it should just work.
@deepak.chandola
@deepak.chandola 2 жыл бұрын
I see your videos regularly but this one seemed completely irrelevant for a ~8 min video.
@maacpiash
@maacpiash 2 жыл бұрын
Still don't like this whiteboard format, man.
@parvati27
@parvati27 2 жыл бұрын
If only your english is good, you would be a great asset
@ankitaggarwal9438
@ankitaggarwal9438 2 жыл бұрын
I WATCHED THIS VIDEO TILL THE END!
@vishveshguthal
@vishveshguthal 2 жыл бұрын
I watched this video till the end
@tibzdankan
@tibzdankan 2 жыл бұрын
I watched the video till the end
@Rajkishan1000
@Rajkishan1000 2 жыл бұрын
I watched this video till the end
Hardest Backend Node.js Concept to Master
11:20
Mehul - Codedamn
Рет қаралды 66 М.
Concurrency vs Parallelism
9:29
Jakob Jenkov
Рет қаралды 63 М.
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 15 МЛН
Nutella bro sis family Challenge 😋
00:31
Mr. Clabik
Рет қаралды 13 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
Explained : Serverless vs Serverful Backends ⚡
11:50
Mehul - Codedamn
Рет қаралды 39 М.
Node.js Security Best Practices: JWT blacklisting, rate limiting, schema validation
12:02
Is it concurrent or parallel?
3:48
Jacob Sorber
Рет қаралды 20 М.
Scaling your Node.js app using the "cluster" module
13:44
Software Developer Diaries
Рет қаралды 36 М.
Here's Why Node JS is NOT Single Threaded
8:52
Mehul - Codedamn
Рет қаралды 14 М.
The Node.js Event Loop: Not So Single Threaded
31:54
node.js
Рет қаралды 165 М.
How to scale NodeJs applications using the cluster module.
13:37
Mafia Codes
Рет қаралды 49 М.
5 Interview Questions You Must know as a Backend Developer
44:30
Mehul - Codedamn
Рет қаралды 77 М.
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 15 МЛН