This is really perfect and detailed version of background processing while using node js. Saw it once, now it's printed in my brain 🔥. Thank you so much for this video and looking forward a great learning curve with you.
The explanation you give for everything including NodeJS Multi Thread, CORS, Networking Basics etc is Amazing. Due to your videos I can understand these concepts clearly. Keep making such wonderful videos for us.
if the Libuv thread pool gets hold of all the cores in our system, how does a separate nodejs process like cluster or pm2 instance run a different process with its own libuv thread pool and main thread ??
This concept seems more like what nodejs provides as worker threads for a compute heavy system. Is the concept same for IO intensive tasks as well? My question is which part exactly is responsible in os watching for a db query to be fulfilled?
for example 500 request comes....and each has to perform 10 task and some task's code may be synchronous and some task's code is asynchronous......as node js is single threaded it will put of all the request in a queue..it takes out 1 request and that request is to run 10 task .....out of which say 4 task'code are asynchronous so that 4 task command will go to thread pool right?....remaining 6 task is performed and result is generated.....now when the 4 lines asynchronous task result is generated the all 10 task result is clubed and response is send ...then for request 2 same thing happens.....so why we say node js can handle multiple request at a time.......or is it like when request1 6 sync task is completed......the other 6 task of request 2 starts to get executed even though request 1 4 async task has not completed so node js is making the request run concurrently and not parallely this shows the single threading nature....if for suppose node js might have been multi threading that we could have access multiple request parallely......am i getting it correct?
Great explanation. Does this only happen for something like a C++ binary? Can I make use of multithreading when writing normal javascript code in node js, I believe when we use promises it just uses the event loop which is concurrent but not parallel so it is still utilizing only a single core of our cpu.
@@electrolyteorb Yes Go lang is great, though I haven't used it yet. I mainly work with Elixir which is very good at concurrent or parallel processing.
As 1 request take 1 second for process + 1 second for callback = total 2 second. What about 500 request, for this example as we have 4 thread OS. What is total time to complete the execution for 500 request? Could you please assist for this? Thank you.
who will be placing the requests in thread pool to cores? Thread Pool or Scheduler? Because in the diagram you made, it shows that thread pool is putting it on cores.
Thanks for the great video. Did you actually dive deep into libuv's source code? Would be very interesting to see some videos where one points out how things really take place under the hood.
Your explanation is pretty much clear for me. Thanks alot :) Can I get some animated stuff of these process? Would really help me and others like me alot. :D
But this is about bcrypt which executes on a c++ binary. Can you please tell how do JavaScript inbuilts, like promises specifically work. Suppose there are 5 promises.... ho do these 5 promises get executed parallelly ? @codedamn
All the async ops including promises get offloaded from node main thread which is basically running v8 engine. You have to understand that async ops usually involve low level tasks . If you take a network call , you have to access the network card of the hardware. all these go to the libuv thread pool which executes them just like bcrypt. Once done they come to the callback queue and event loop pushes them to main thread one by one. Also we have to remember Nodejs works by concurrency Libuv works by parallelism
Hey the JS main thread is still single and if that's stuck in processing your event loop would be stuck and whole application would either be stuck or crash.
Thats why you never write data intensive ops on the main thread, You can spawn a worker thread for you do it and share the data with parent. If its async you anyway will pass it to libuv or web api in case of a browser
Sir teell mee from where did u got this much in depth Concept, I must say I been working with node for two years but do not got that this deep apology that took behind the scenes 😀😀😀 sir plz 🙏 refer me some this that could connect me to that level of deepness and personally I felt something is missing and by this video I come to know that there's a lot more to learn in node 😀😀😀 plz refer some book wher u prefer to have this much deep Concept...
The breadth of topics you cover is jaw-dropping. Always look forward to your videos.
This is really perfect and detailed version of background processing while using node js.
Saw it once, now it's printed in my brain 🔥.
Thank you so much for this video and looking forward a great learning curve with you.
The explanation you give for everything including NodeJS Multi Thread, CORS, Networking Basics etc is Amazing. Due to your videos I can understand these concepts clearly. Keep making such wonderful videos for us.
This is too good! I have recently been watching your videos. Thanks and respect to your hard work.
Amazing video. Loved it to the “core”
I watched this video till end 🏃🏃🏃
I watched this till the end. Thanks
I watched this video till end. Great content.
You are expert in Javascript. Thanks Engineer. Regards.
This is exactly what I was thinking... Thank you so much
Astonishing explanation..
if the Libuv thread pool gets hold of all the cores in our system, how does a separate nodejs process like cluster or pm2 instance run a different process with its own libuv thread pool and main thread ??
Underrated channel. 🔥
This concept seems more like what nodejs provides as worker threads for a compute heavy system. Is the concept same for IO intensive tasks as well? My question is which part exactly is responsible in os watching for a db query to be fulfilled?
Awesome !!
Thanks a lot !
" I watched this video till the end "
for example 500 request comes....and each has to perform 10 task and some task's code may be synchronous and some task's code is asynchronous......as node js is single threaded it will put of all the request in a queue..it takes out 1 request and that request is to run 10 task .....out of which say 4 task'code are asynchronous so that 4 task command will go to thread pool right?....remaining 6 task is performed and result is generated.....now when the 4 lines asynchronous task result is generated the all 10 task result is clubed and response is send ...then for request 2 same thing happens.....so why we say node js can handle multiple request at a time.......or is it like when request1 6 sync task is completed......the other 6 task of request 2 starts to get executed even though request 1 4 async task has not completed so node js is making the request run concurrently and not parallely this shows the single threading nature....if for suppose node js might have been multi threading that we could have access multiple request parallely......am i getting it correct?
I watched this video till end.
Came to know about libUV👌👌
Great explanation.
Does this only happen for something like a C++ binary? Can I make use of multithreading when writing normal javascript code in node js, I believe when we use promises it just uses the event loop which is concurrent but not parallel so it is still utilizing only a single core of our cpu.
Just learn Go
(With a grain of salt)
@@electrolyteorb Yes Go lang is great, though I haven't used it yet. I mainly work with Elixir which is very good at concurrent or parallel processing.
Thank you so much this must be relevant with all Web server : instances configurations.
Wouldnt be better initialize more node workers with less libuv threads to better utilization of processor for parallel requests processing priority?
I watched this video till the end.
As 1 request take 1 second for process + 1 second for callback = total 2 second. What about 500 request, for this example as we have 4 thread OS. What is total time to complete the execution for 500 request?
Could you please assist for this?
Thank you.
Wonderful Explanation!
who will be placing the requests in thread pool to cores? Thread Pool or Scheduler?
Because in the diagram you made, it shows that thread pool is putting it on cores.
Awesome Explanation
Thanks for the great video.
Did you actually dive deep into libuv's source code? Would be very interesting to see some videos where one points out how things really take place under the hood.
Your explanation is pretty much clear for me. Thanks alot :)
Can I get some animated stuff of these process?
Would really help me and others like me alot. :D
We have now async in python as well. FastAPI works somewhat similar to the Node js.
I always watch 👀 your video till the end.
Great content as always ✌🔥
Great explanation ❤️
I watched this video till the end :D
Really nice content man... 👌
Nice, thank you!
Mehul Sir same Content Post in Hindi also here or in ur Mehul Mohan Channel it will definitely Boost both Channel's 🔥🔥🔥
Node.js itself is not single-threaded. The Javascript program that we write to run on Node.js is single-threaded.
Watched this till the end
Thanks man ❤️
But this is about bcrypt which executes on a c++ binary. Can you please tell how do JavaScript inbuilts, like promises specifically work. Suppose there are 5 promises.... ho do these 5 promises get executed parallelly ? @codedamn
All the async ops including promises get offloaded from node main thread which is basically running v8 engine.
You have to understand that async ops usually involve low level tasks . If you take a network call , you have to access the network card of the hardware. all these go to the libuv thread pool which executes them just like bcrypt. Once done they come to the callback queue and event loop pushes them to main thread one by one.
Also we have to remember
Nodejs works by concurrency
Libuv works by parallelism
thank you so much for the explaination
@@eswarprasad9773
Hey the JS main thread is still single and if that's stuck in processing your event loop would be stuck and whole application would either be stuck or crash.
Thats why you never write data intensive ops on the main thread,
You can spawn a worker thread for you do it and share the data with parent. If its async you anyway will pass it to libuv or web api in case of a browser
I watched videos till end
I watched Till the End really informative video
Watched till the end
Watched to the end
I watched this video till the end
Hey nice explaination , can you make long videos like hussein ?
Thank you!
I WATCHED THIS VIDEO TILL THE END
i remember a twitter argument similar to this few weeks ago from oliverjumpertz
Please cover middleware
Sir teell mee from where did u got this much in depth Concept, I must say I been working with node for two years but do not got that this deep apology that took behind the scenes 😀😀😀 sir plz 🙏 refer me some this that could connect me to that level of deepness and personally I felt something is missing and by this video I come to know that there's a lot more to learn in node 😀😀😀 plz refer some book wher u prefer to have this much deep Concept...
I WATCHED THIS VIDEO TILL THE END! 😊
so basically, the more CPU cores you have the more libUV can schedule it to each core?
16 cores = 16 hashing process it can take in parallel?
correct
i watched this video till the end
just great :) thx
I watched full video
Great explanation, but the background music is really annoying
I watched till end
Nice!
awesome
great
👌👌
Nice
And video ends soon didn't noticed 🤣🤣🤣
I recommend you remove the background music.
Have some sleep tho
What a sad face wala kidding ismail ...!!!
I watched this video till end.
I watched this video till the end