The worker pool size in Node.js was changed from 128 to 1024 in version 10.5.0. Prior to this version, the default worker pool size was 128. From version 10.5.0 onwards, you can increase the worker pool size up to 1024 by setting the UV_THREADPOOL_SIZE environment variable
what is the significance of increasing it to 1024? It would not help you execute things faster. The ideal value for the thread pool size should be equal to your number of physical cores or if your system system provides hyperthreading then a little more than that too works. @piyushgargdev am I right?
Your explanation hits me like a bolt of genius ⚡-straight to the brain! 💥 You're absolutely AMAZING! 🌟 You're my #1 FAVORITE RUclipsr right now! 🎥❤ Keep shining and growing
Summary - The sync tasks are run on the main thread by the v8 engine, the async tasks are taken care of by the libuv library. Libuv has event loop, which monitors 6 different queues and executes their callback by pushing to call stack whenever empty. Libuv uses the kernal/o.s threads (i.e. thread pool) to handle these async tasks and never blocks the main thread. Also, if there CPU intensive tasks on main thread (sync tasks) then they are offloaded to the thread pool straight away. That’s how Node/js being a single-threaded env, runs like multi-threaded.
This video will help me to understand the node js and most important part of the video is at the end time where and in which situation we can use node js and any multi threaded languages so thank you so much for such nice and simply but depth explanation
I believe before the top level code gets executed, the modules imported using require() are resolve first and then only it proceeds as require is synchronous in nature.
Awesome explanation of Node JS Architecture, especially Event Loop which had very confusing for me before watching this detail video. Thank you so much for such awesome video
Really loved the way you explained the entire architecture. You are a great teacher, you know what is going on in students mind and you answer them methodically. Please let me know if you have any video for V8.
Thanks piyush🎉. Best video for this topic, no one explained like this in RUclips and I saw many video to clear this concept. Watch ing this video I got the concept, need to watch more this video to clear more
Very well structured, and very well explained Piyush! You know when to say what and in what sequence! Thank you so much for all your efforts for all of us. Amazing work, keep it up! 🔥🔥
Awesome explanation of Node JS Architecture, especially EventLoop which had very confusing for me before watching this detail video. Thank you so much for such awesome video.❤❤
36:14 its not top level code, expressions that have the global execution context are pushed into a call stack, and it's not executed directly the execution context of nested functions are then stored on top of that call stack and non primitive data structures are stored to the heap. Now the js call stack executes in FILO method. Thats why closures are possible in js, the nested function has access to the execution context of its parent function ( it gets that within the call stack )
I'm also confused about fs task, Once he said they are taken care by thread pool as they are cpu extensive task And he had also shown them in event loop execution. Not sure where fs belongs.
@@MythicEcho For async fs tasks, Node.js uses the thread pool but keeps the event loop non-blocking. For sync fs tasks, the event loop gets blocked until the task completes, which is usually not recommended in a non-blocking environment like Node.js.
Hello Piyush Sir , I am being following your nodejs series , and currently i am on authentication. Sir my question is .. what is the best way to revise the concepts in nodejs or any other backend technologies .. so that my i can master the concepts properly ... BTW your nodejs series is awesome💫
Much needed video, but just a suggestion, Please keep theme costant to dark everywhere, it will look more aesthetic and there will not a flashes in our eyes. Thanks 😂😂
@piyushgargdev : How will the thread pool handle dynamic cryptographic requests? For example, if 1000 users requests password encryption at same time, how can the Node server manage these requests, given that we can't predict their origin?
Thank you for creating such an insightful and engaging video, I truly appreciated the valuable content and your skillful presentation. want more related videos, Thankyou!!
i think threadpool doesn't handle cpu intensive tasks,it only handles some cpu intensive tasks.for example:while loop with very long iteration is considered as cpu intensive task but it is not handled by the thread pool.
Never seen like that explanation .... Thank you so much Piyush Vai 💌. Create courses (Paid) regarding System Design /DSA / Devops/Microservice . All the best.
loved it piyush, just curious to know that how js on browser and js on nodejs differs to work , like how the asynchronous operations execution differs on both ,is it same ? is it different ?
is the concept of callstack ,microtask queue ,callback queue is of brower environment and nodejs environment is different? i have a doubt as per the video , top level code will be executed first then import modules. but what if top level code uses the modules then how??
where does the async and promise been executed . the callback that is returned in promise is executed in between the phase i got to know but does it run's in the different thread?
Hi Piyush, Nice video with explain. I have one question kindly if possible please make video on it. Consider one use case where I have Nodejs application with /abc endpoint inside this endpoint I have one function which is 1M of for loop which take time to complete 3 sec then give response to the endpoint. So 5 users can parallel make requests to this endpoint so what is time for 5th user will take ? Is it 3 sec or 15secs and why ?? THANKS
The worker pool size in Node.js was changed from 128 to 1024 in version 10.5.0. Prior to this version, the default worker pool size was 128. From version 10.5.0 onwards, you can increase the worker pool size up to 1024 by setting the UV_THREADPOOL_SIZE environment variable
what is the significance of increasing it to 1024? It would not help you execute things faster. The ideal value for the thread pool size should be equal to your number of physical cores or if your system system provides hyperthreading then a little more than that too works. @piyushgargdev am I right?
@@unemployed-coder agree, virtually it do make sense but physical core is what matter the most.
Shabash but video mein to 4 threads hi dikhaya h default
@@manishbhardwaj4587video mein 4 kyu dikhaya h default agr default 128 h?
@@xiaoshen194 Default 4 hi hai bhai... Maximum pehle 128 tha and then increased to 1024
Thank you, I was looking for Nodejs Internal Working explanation for the last one year, This one is more Helpful kudos
this is like the most in-depth video on Eventloop and working of Node.js I found, Need a course like this.
Ye koi nhi samjhaya h avi tk , i have searched a lot , thanks buddy for this wonderful explanation 😅
Can't believe u have only 5 year of experience....ur knowledge is way above who has experienced of 10-15 years
Your explanation hits me like a bolt of genius ⚡-straight to the brain! 💥 You're absolutely AMAZING! 🌟 You're my #1 FAVORITE RUclipsr right now! 🎥❤ Keep shining and growing
"08:05"- Thread Pool
"12:27"- IO polling
"21:30" - undefinite behaviour of setTimeout and setInterval in main thread
Best Explination and the simplest one so Far Thanks Bhaiya
This is the best explanation by far. You explained it so well. I would like to learn more nodejs concepts that no one is talking here.
This is the best explanation of nodesjs working so far
Summary -
The sync tasks are run on the main thread by the v8 engine, the async tasks are taken care of by the libuv library. Libuv has event loop, which monitors 6 different queues and executes their callback by pushing to call stack whenever empty. Libuv uses the kernal/o.s threads (i.e. thread pool) to handle these async tasks and never blocks the main thread. Also, if there CPU intensive tasks on main thread (sync tasks) then they are offloaded to the thread pool straight away. That’s how Node/js being a single-threaded env, runs like multi-threaded.
Very well explained really. Have seen lot of other event loop video but this is special. Please continue creating this types of videos.
Best node architecture video i have seen so far, keep up the good work 💯
Content is pure gold straight from heaven mann I am craving for more wisdom from this guy thanks piyush bhaiya
Awesome explanation. Keep making more of these in depth videos. 😍
This video will help me to understand the node js and most important part of the video is at the end time where and in which situation we can use node js and any multi threaded languages
so thank you so much for such nice and simply but depth explanation
I believe before the top level code gets executed, the modules imported using require() are resolve first and then only it proceeds as require is synchronous in nature.
This video is GEM i must say nothing more left to read after this.
Awesome explanation of Node JS Architecture, especially Event Loop which had very confusing for me before watching this detail video.
Thank you so much for such awesome video
thank you so much piyush sir for keep delivering this high knowledge videos with brief discussions ... i am loving it...
Really loved the way you explained the entire architecture. You are a great teacher, you know what is going on in students mind and you answer them methodically. Please let me know if you have any video for V8.
Lakho me Ek video h, mast h
Thanks piyush🎉. Best video for this topic, no one explained like this in RUclips and I saw many video to clear this concept. Watch ing this video I got the concept, need to watch more this video to clear more
i need this types of videos. please sir... to be continue............
Damn Man You're teaching in a very beautiful way
42:45
Yes cha hi hai aise video
Thank you Piyush for this amazing video. I learned a lot from this video like EventLoop and under the hood working of Node.js.
Yes, aur videos chahiye, and what session bhaiya, bhaiya poora din barbaad krdiya faltu me ab neend achhi aayegi yh video dekhne ke baad.❤❤
Sir your NodeJS playlist >>> All paid + free courses 🗿
which theme is he using do you know ?
Excellent explanation, extensive details & good pace. Worth a subscribe bro.
Thankyou Piyush brother for the deep explanation 👍
"great explanation of how the Node.js event loop works", WD 👌🏽
I really liked the way you explained, thanks for the easy explanation. I have never been understood better before watching this video. 👏
put more videos like this. it'll help you build core audience.
Very well structured, and very well explained Piyush! You know when to say what and in what sequence! Thank you so much for all your efforts for all of us. Amazing work, keep it up! 🔥🔥
outstanding way of explanation bhaiya
Awesome video man!. I was very confused about differentiating the timers and io execution timings.
Awesome explanation of Node JS Architecture, especially EventLoop which had very confusing for me before watching this detail video.
Thank you so much for such awesome video.❤❤
Very nice explanation sir, Thank you!
36:14 its not top level code, expressions that have the global execution context are pushed into a call stack, and it's not executed directly the execution context of nested functions are then stored on top of that call stack and non primitive data structures are stored to the heap. Now the js call stack executes in FILO method. Thats why closures are possible in js, the nested function has access to the execution context of its parent function ( it gets that within the call stack )
I'm also confused about fs task,
Once he said they are taken care by thread pool as they are cpu extensive task
And he had also shown them in event loop execution.
Not sure where fs belongs.
@MythicEcho it uses libuv ( a c library) as an API, it must be thread pool ig.
@@MythicEcho For async fs tasks, Node.js uses the thread pool but keeps the event loop non-blocking.
For sync fs tasks, the event loop gets blocked until the task completes, which is usually not recommended in a non-blocking environment like Node.js.
Such a detail video . Quite interesting and helps understanding deep concept of Node.js
Great Video Thank you so much for creating such valuable content
i see the full video as well as coded with you . and thnx for this beautiful video . good work
Very indepth concept clearing video..... Thanks Sir...💌
This video was very helpful, thank you for the wonderful explanation of node.js architecture 😊
Amazing sir, i would like to see more of these kind videos from you. Thank you for your content
Content Quality >>>
Plz make more video like this .
Thanks from my bottom of heart❤
Excellent explanation man
Hats off
Please create such videos, in nodejs only
More insight about node js
Please make on video on how await works in this internally
one of the best best explainations
U r gem man...just found ur channel ❤
Very good explanation, sir 👏🏻
Nice one bro, good to see you grow❤
Hello Piyush Sir , I am being following your nodejs series , and currently i am on authentication. Sir my question is .. what is the best way to revise the concepts in nodejs or any other backend technologies .. so that my i can master the concepts properly ...
BTW your nodejs series is awesome💫
Much needed video, but just a suggestion, Please keep theme costant to dark everywhere, it will look more aesthetic and there will not a flashes in our eyes. Thanks 😂😂
Ultimate😮 video, we want more videos like this.....
nice explanation, thanks for such detailed video
Great explaination for event loops. sir can you please make a video on memory leaks and how to prevent them?
Nice explanation 😃....Easy explanation for beginners.
PHP is not multithreaded. PHP-FPM can handle multiple incoming requests at once by launching multiple processes. I like your node js explaination
@piyushgargdev : How will the thread pool handle dynamic cryptographic requests? For example, if 1000 users requests password encryption at same time, how can the Node server manage these requests, given that we can't predict their origin?
reallly like to watch the explation of js working please make a video on that
yes please create this type of videos.
Nice And Detailed Explanation. Quite Impressed.😍 Can you please also share those Notes.👍👍👍 Thanks👍👍👍
Good explanation of Node.js architecture. Is there any playlist for Node.js with express.js and mongo DB ?
Hello Piyushbro,
Please make video on transaction in mongoose…
Your teaching method is very helpful..
Thank you for creating such an insightful and engaging video, I truly appreciated the valuable content and your skillful presentation. want more related videos, Thankyou!!
Very informative video💯 Thank u sir😄
Gem 💎content, bhaiya. Keep it up 👍Thank you!
i think threadpool doesn't handle cpu intensive tasks,it only handles some cpu intensive tasks.for example:while loop with very long iteration is considered as cpu intensive task but it is not handled by the thread pool.
Never seen like that explanation .... Thank you so much Piyush Vai 💌. Create courses (Paid) regarding System Design /DSA / Devops/Microservice . All the best.
same content as Jonas Schedtman instructor on udemy. But Great work for delivring to indian people.
Why am I feeling sleepy while watching your tutorial?
Uss bro😂
Hi Piyush, can you please make a video on Node Js C++ addon.
Excellent explanation
Need more explanation of setimmediate working at top level and inside eventloop
How can I thank you for being upload such a great video 😍
nice video
Please make a video series on Typescript
perfect explanation sir 💯💯
Great Explanation sir
loved it piyush, just curious to know that how js on browser and js on nodejs differs to work , like how the asynchronous operations execution differs on both ,is it same ? is it different ?
I love it make more videos on docker
excellent explanation 👌 👏 👍
Best explaination ever!
Bhai aapke CHARAN kahan hain ? So much love from Bengaluru ♥
Please include the other webapi and handling http request also. You have not mentioned the http calling here how it handles it
Informative as usual❤
is the concept of callstack ,microtask queue ,callback queue is of brower environment and nodejs environment is different?
i have a doubt as per the video , top level code will be executed first then import modules. but what if top level code uses the modules then how??
Great Explanation 💯
@piyushgargdev what happens to the blocking or synchronous operation.
amazing explanation , learned alot 👍
Next level explaination
bhai maza agaya thank you sir ji
where does the async and promise been executed . the callback that is returned in promise is executed in between the phase i got to know but does it run's in the different thread?
What an OP explanation!! ❤❤❤
bro some are some thing diff bro great work
Amazing Explanation.
Hi Piyush,
Nice video with explain.
I have one question kindly if possible please make video on it.
Consider one use case where I have Nodejs application with /abc endpoint inside this endpoint I have one function which is 1M of for loop which take time to complete 3 sec then give response to the endpoint. So 5 users can parallel make requests to this endpoint so what is time for 5th user will take ?
Is it 3 sec or 15secs and why ??
THANKS