you are wrong u said that first top level code run then require module run that is wrong u can take example that create fs.readFileSync and console.log its output and then run console.log("0") then output will be return result of fs.readFileSync then 0 will be printed
@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?
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?
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.
Never seen like that explanation .... Thank you so much Piyush Vai 💌. Create courses (Paid) regarding System Design /DSA / Devops/Microservice . All the best.
Can someone please explain why below order is different from architecture console.log("start"); setTimeout(() => { console.log('setTimeout'); }); Promise.resolve().then(() => { console.log('resolved'); }) console.log('end'); Result order is start end resolved setTimeout however as per event loop architecture it should be first
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??
Number of threads should depend upon system configuration, if it is so .. then how we can manage number of threads??? Number of threads should always be four ...
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?
bhaiyaaaaaaa please COmputer networks ka basics bhi explain kardooo uske sare levels...kese data jataa hai un levels se guzarke like application , transport , network , data link . . PLEASEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
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 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.
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💫
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
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! 🔥🔥
you are wrong u said that first top level code run then require module run that is wrong u can take example that create fs.readFileSync and console.log its output and then run console.log("0") then output will be return result of fs.readFileSync then 0 will be printed
bro, sync is blocking request. So, It will block the execution
Great Video Thank you so much for creating such valuable content
Sir your NodeJS playlist >>> All paid + free courses 🗿
which theme is he using do you know ?
@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?
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
U r gem man...just found ur channel ❤
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.
Remember , Nodejs and JavaScript both works differently.
I am pretty sure if you switch to English, your channel will be viewed by international audience
Why am I feeling sleepy while watching your tutorial?
Uss bro😂
Ye koi nhi samjhaya h avi tk , i have searched a lot , thanks buddy for this wonderful explanation 😅
"08:05"- Thread Pool
"12:27"- IO polling
"21:30" - undefinite behaviour of setTimeout and setInterval in main thread
Never seen like that explanation .... Thank you so much Piyush Vai 💌. Create courses (Paid) regarding System Design /DSA / Devops/Microservice . All the best.
Good explanation of Node.js architecture. Is there any playlist for Node.js with express.js and mongo DB ?
Can someone please explain why below order is different from architecture
console.log("start");
setTimeout(() => {
console.log('setTimeout');
});
Promise.resolve().then(() => {
console.log('resolved');
})
console.log('end');
Result order is
start
end
resolved
setTimeout
however as per event loop architecture it should be first
Then how NodeJS is single threaded if it will generate multiple threads for blocking/CPU Intensive tasks ?
@piyushgargdev
Piyush can provide link for notes
Thankyou Piyush brother for the deep explanation 👍
@piyushgargdev what happens to the blocking or synchronous operation.
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??
Number of threads should depend upon system configuration, if it is so .. then how we can manage number of threads??? Number of threads should always be four ...
nice video
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?
Bhai aapke CHARAN kahan hain ? So much love from Bengaluru ♥
Very nice explanation sir, Thank you!
same content as Jonas Schedtman instructor on udemy. But Great work for delivring to indian people.
bhaiyaaaaaaa please COmputer networks ka basics bhi explain kardooo uske sare levels...kese data jataa hai un levels se guzarke like application , transport , network , data link . . PLEASEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Can we really not do CPU intensive tasks in Node??
because there are cluster modules, worker threads !!!!
You look better in bread... 🤧❤️🩹✨
also some butter 🧈 😂
Very well explained really. Have seen lot of other event loop video but this is special. Please continue creating this types of videos.
Please Sir make a basic video on Apache Seatunnel please..........................................
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 ?
Great explaination for event loops. sir can you please make a video on memory leaks and how to prevent them?
nice explanation, thanks for such detailed video
Thank you, I was looking for Nodejs Internal Working explanation for the last one year, This one is more Helpful kudos
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.
High level technical video === Low level details of a tool
HiLo
Hila dala na?!!
Please include the other webapi and handling http request also. You have not mentioned the http calling here how it handles it
Very informative video💯 Thank u sir😄
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.
i need this types of videos. please sir... to be continue............
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💫
Awesome explanation. Keep making more of these in depth videos. 😍
Content Quality >>>
Isnt setTimeout a webapi?can we use it in express js if its available in node js
Hi Piyush, can you please make a video on Node Js C++ addon.
Please make on video on how await works in this internally
Need more explanation of setimmediate working at top level and inside eventloop
Very good explanation, sir 👏🏻
Best Explination and the simplest one so Far Thanks Bhaiya
ekdum sexy explaination sir
Hey piyush please add link to that whiteboard
Very Nice Video man, keep doing like this .
Best node architecture video i have seen so far, keep up the good work 💯
Need same quality content for react js
Lakho me Ek video h, mast h
If anyone has made notes of this lecture please send it to me. 🙏
Hello piyush...jab hum database call krte h to uska callback event loop me kab excute hota h ?
db call network call hota hi to shayad wo libuv dwara handle hota hi,
Bro can you make a tutorial on API testing ?
Please make a video series on Typescript
bro some are some thing diff bro great work
does anyone knows the theme name
This is the best explanation of nodesjs working so far
maza aya
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
one of the best best explainations
Nice one bro, good to see you grow❤
Bro really greattt❤❤
Which theme,file icon packs
great video, nicely explained
This is amazing....Thank you....
Amazing Explanation.
Great Explanation sir
bhai maza agaya thank you sir ji
hy sir node sikne ke liye kya kya ana chaihiye
excellent explanation 👌 👏 👍
Great Video. Enjoyed it a lot.
Never seen someone use setImmediate
yes please create this type of videos.
more andvance content we want...
Thanks a lot for the video
Great video best ever explain
Nice explanation 😃....Easy explanation for beginners.
First comment 🎉🎉🎉🎉🎉🎉🎉
What's your vs code theme?
Nice explanation ❤❤
Excellent explanation
Nice And Detailed Explanation. Quite Impressed.😍 Can you please also share those Notes.👍👍👍 Thanks👍👍👍
React architecture please
42:45
Yes cha hi hai aise video
please share the link of notes
I love it make more videos on docker
Genius brother 🎉
informative video!
very interesting video.
Hello Piyushbro,
Please make video on transaction in mongoose…
Your teaching method is very helpful..
so was it polling, and not pooling
Thank you sir!
❤❤
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! 🔥🔥