Non-blocking I/O and how Node uses it, in friendly terms: blocking vs async IO, CPU vs IO

Поделиться
HTML-код
  • Опубликовано: 15 окт 2024

Комментарии • 173

  • @amstud
    @amstud 3 года назад +113

    This is easily the best programming video I've ever seen. You took a subtle and tricky concept (one which I suspect most software engineers don't actually understand), and explained it simply enough that a child could understand. Not to mention excellent production values. Super excited to have found this channel, and I can't wait to see what you make next!

  • @fourteensierra
    @fourteensierra 3 года назад +41

    Thought you did a fantastic job explaining Non-blocking I/O. I was super bummed when I saw you only had two other videos. Makes some more vids!!!

  • @iganic7574
    @iganic7574 6 месяцев назад +2

    Great explanation , finally I understood what is non blocking I/O .
    🙌

  • @jordanbtucker
    @jordanbtucker 3 года назад +11

    Loved the analogies and animations!

  • @LyadhKhorEngineer
    @LyadhKhorEngineer 3 года назад +23

    Great video. Cleared up a lot of confusion regarding how javascript works as a single threaded server. 👍🏼

  • @ninthsun
    @ninthsun Год назад +1

    Seriously, this video should be the must for every beginner learning nodejs. Super important concept, but in super easy words and animations.

  • @sepg6266
    @sepg6266 2 года назад +6

    Great job
    One suggestion: try a background video with less volume, no lyrics (human sound), and slower beats. That music is not just supposed to make the viewer excited or attracted, just makes it a lill colorful. Thanks

  • @sid6576
    @sid6576 Год назад +8

    Just found this video, great work man.
    My 2 cents: I think the conversation about asynchronousity is incomplete without thinking about how threads and context switching are handled at the OS level. Without the concepts of yielding, interrupts and a priority queue for threads, I was confused for the longest on time on how the computer just magically knows when to switch from one task to another and when it knows that an IO task is complete. I feel like the next step after this video would be to tackle scheduling in OSes because I feel like a lot of programmers on the internet find it to be impenetrable when it's really not that hard!

    • @wafikiri_
      @wafikiri_ Год назад

      I agree. I watched the video expecting a more advanced explanation. I'm currently amateurly designing the scheduler of a multi-tasking processor and wanted to learn of current solutions.

  • @avgsteve
    @avgsteve 3 года назад +2

    This is how the knowledge should be taught. Thanks for sharing

  • @whitebeardpirates7551
    @whitebeardpirates7551 Год назад

    Man that's HUGE, i finally understand this heavy topic as if it was a piece of cake, you're the GOAT ♥♥ Thanks for your effort ♥

  • @flucksy119
    @flucksy119 3 года назад +1

    i think this is the best computer science video ive ever watched with regards to visually understanding due to the graphics

  • @vertikasrivastava1186
    @vertikasrivastava1186 3 года назад +7

    This was super helpful, thank you!

  • @rafaelfigfigueiredo2988
    @rafaelfigfigueiredo2988 Месяц назад

    Thank you. Almost 10y fiddling with web dev and never bothered to check this, sounds awesome to implement

  • @IvanBilan-ty9jw
    @IvanBilan-ty9jw 4 месяца назад

    It's a great explanation of complex concept. Divinding work time into CPU and IO time is a realy great concept for understanding this. Now I understand why Node.js is so popuar for web development. Thanks!

  • @Priyanka-hs5jk
    @Priyanka-hs5jk Год назад

    This is the most crisp and clear explanation for non blocking I/O in layman terms, thanks a lot

  • @julianhu
    @julianhu 4 месяца назад

    This is absolutely the best explanation video about async I've ever seen. Amazing work!

  • @nicholasaine7756
    @nicholasaine7756 2 года назад

    Best explanation I have come accross, on this topic.

  • @brandonhunter2074
    @brandonhunter2074 11 месяцев назад

    This is one of the best explanations of this concept I've ever seen. Well done!

  • @alaaroumeeh2752
    @alaaroumeeh2752 Год назад

    Thank you very much no one explains this topic well, or they don't explain it at all!

  • @RebienKani
    @RebienKani 2 года назад +10

    Dude amazing video and excellent job on explaining this topic because it was true hassle for me too understand. Just a couple of tips for in the future:
    1: Choose a different music with lower BPM and lower it by 20%
    2: A better microfoon or remove static noise in post production
    For the rest killer video!!!

  • @nathanielkswas
    @nathanielkswas 3 года назад +7

    This was super well presented and produced. Keep up the good work!!

  • @souravsharma6092
    @souravsharma6092 11 месяцев назад

    Thank you! Really glad I landed on this video, I don't remember the last time someone explained things as simply and effectively as this. Keep up the good work! Will regularly check your channel for any doubts.

  • @dark_lord98
    @dark_lord98 Год назад +1

    This is the best video I watched regarding the I/O and CPU tasks. The code example cleared many things for me. Thanks a lot man. Please keep making videos on software engineering topics.

  • @asepulven2768
    @asepulven2768 4 месяца назад

    Excellent Video! best explanation so far with visual representation.

  • @MyAminedz
    @MyAminedz Год назад

    Absolutely mind-blowing video, hats off to you sir

  • @matthewoluwafisayoadeniyi9803
    @matthewoluwafisayoadeniyi9803 3 месяца назад +1

    Just what I needed. Thanks mehn

  • @imaazk
    @imaazk 11 месяцев назад

    I usually don't comment. but you really make things very simple to understand. Thank you!

  • @tayyibulhassan6227
    @tayyibulhassan6227 9 месяцев назад

    I HAVE NEVER SEEN A BETTER TUTORIAL THAN THIS ONE DUUUUUDDDEEEE, YOU ARE AMAZING!!!

  • @congdao7484
    @congdao7484 3 года назад +2

    Good work, hope you have more similar video.

  • @mandaputtra
    @mandaputtra 2 года назад +1

    Thanks, all of your video are easily digested! Maybe you can decrease the background music volume to 10% or 20%.

  • @jokercry8132
    @jokercry8132 2 года назад

    Wow! Explanation is so good with the graph.

  • @georgemarwanqana3478
    @georgemarwanqana3478 Год назад

    BEST EXPLANATION OF THE YEAR

  • @indoor-adventurer
    @indoor-adventurer 4 месяца назад

    dude, make more videos! Such high quality stuff 👏

  • @Finn-jp6pn
    @Finn-jp6pn 3 года назад +1

    Found this on Reddit. This was really helpful. Thanks 👍

  • @teamjupeter9451
    @teamjupeter9451 3 года назад +1

    What a wonderful lecture on blocking!!

  • @lychenus
    @lychenus 2 года назад

    very decently explained. now i understand when to pick a (non-)blocking io framework

  • @carolinafransiscalopezpaca541
    @carolinafransiscalopezpaca541 2 года назад

    you make great content, don't stop until the top

  • @brettwines6812
    @brettwines6812 3 года назад +1

    wow, each of these is better than the last. Your hard work really shows!!!

  • @minhtaile3572
    @minhtaile3572 3 года назад +1

    Thanks for making this video, it's easy to understand

  • @muhammadsalikin3886
    @muhammadsalikin3886 3 года назад +1

    Thank you so much for this video. Best explanation ever !

  • @ckim0324
    @ckim0324 2 года назад

    Fantastic video, Alex. Your channel is VERY underrated.

  • @dhruvpurwar6642
    @dhruvpurwar6642 2 года назад

    One of the best videos for the concept!!!

  • @island_rhythms
    @island_rhythms 11 месяцев назад

    This is a treasure! Such a great and simple explanation! Thank you

  • @teerapatprommarak2070
    @teerapatprommarak2070 3 года назад +1

    Fantastic video! Thank you Alex

  • @mars_bold
    @mars_bold 2 года назад

    BROTHER, YOU ARE THE BEST!!! You oooh really helped me!! THANK YOU VERY MUCH!This is cool, well done!

  • @saurabh95mishra
    @saurabh95mishra Год назад

    amazing explanation, I learned redis uses similar model as nodejs, would love your video on that!

  • @wichaisawangpongkasame9237
    @wichaisawangpongkasame9237 3 года назад +1

    You're great at explaining things. It's much clearer to me now. Thanks.

  • @ainharansubramaniam2910
    @ainharansubramaniam2910 3 года назад +1

    Great video I hope you keep them coming

  • @cvramankishore4u
    @cvramankishore4u 2 года назад

    Great explanation saw couple of your videos and both are awesome keep up the good work

  • @lgodlike2324
    @lgodlike2324 Год назад

    You just explain it so well !
    This is exactly the video I need.

  • @saurabh0241
    @saurabh0241 11 месяцев назад

    thank you soo much for this video brother . love from INDIA

  • @rollercoasterer
    @rollercoasterer 2 года назад

    Very top notch quality!

  • @aramaiskhachatryan553
    @aramaiskhachatryan553 3 года назад +1

    Great one! Keep it up Alex.

  • @karthiks-he4wh
    @karthiks-he4wh Год назад

    Beautifully explained 👌

  • @morphos2
    @morphos2 Год назад

    Bravo!!! Excellent explanation!! 👏👏👏

  • @Karpefilm
    @Karpefilm 2 года назад

    By far the best explanation! Keep up the fine work

  • @yashkumar-jv2cf
    @yashkumar-jv2cf 3 года назад

    I was struggling with this concept for months. you cleared my doubt. thanks man

  • @arjunbhat6502
    @arjunbhat6502 3 года назад

    Keep on doing such kind of videos. That really helped.

  • @sandeepkosta5750
    @sandeepkosta5750 Год назад

    I just wanted to break the like button by clicking on it many times.
    What a great explaination sir
    Thanks so much

  • @yooog
    @yooog 3 года назад +1

    Excellent explanation!

  • @vunu.
    @vunu. 3 года назад

    Your voice is perfect for these videos! You've come so far in the last decade, awesome stuff! Works like clockwork...wink wink nudge nudge. Anyway, I enjoyed this. I'm subscribing and hitting the bell!

  • @ashishchiluka8912
    @ashishchiluka8912 2 года назад

    Great explaination , one of the best videos

  • @siddharthyadav5066
    @siddharthyadav5066 2 года назад

    This very well explained the concept with animations and examples. Thanks for the great work

  • @cuongtrinhminh
    @cuongtrinhminh 2 года назад

    Great video because it explains a hard thing simple

  • @Frozd
    @Frozd Год назад

    Great video! The explanation was on-point and easy to understand, and the animations made it easy to follow.

  • @theace9562
    @theace9562 3 года назад +2

    Super helpful. Thanks

  • @mohamedchebbi1154
    @mohamedchebbi1154 2 года назад

    That's huge, great job, u saved my life.

  • @utkarshtripathi2349
    @utkarshtripathi2349 3 года назад

    Best explanation, Thanks for the video

  • @Juan_lauretta
    @Juan_lauretta 2 года назад

    Wow this video was amazing, thank you so much

  • @samartajshaikh2601
    @samartajshaikh2601 2 года назад

    Great explanation. Simple and precise. Exactly what I needed. Thanks.

  • @jmro7
    @jmro7 3 года назад

    top notch content. i can already envision this being a big education channel. Keep it up !

  • @icns01
    @icns01 2 года назад

    It was super helpful. Thanks much for clarifying.

  • @howards5205
    @howards5205 Год назад

    This is the best explanation I've seen on non-blocking I/O. Thank you SOOOO much for this video! It clarified so many questions I had.
    @4:20 of your video, you listed three examples of I/O (inactive time):
    - reading from filesystem
    - making network requests
    - waiting for time to pass
    Would executing a long-running database query qualify as a I/O or CPU? The database would be doing all the heavy compute. Would NodeJS be able to move onto other active tasks while the database query is running? Or will a thread be tied to the database query?

  • @RunxiDing
    @RunxiDing Год назад

    nice explanation! Thank you! Alex!

  • @ShaikSameer549
    @ShaikSameer549 3 года назад

    Thanks for making it simple and more understandable

  • @JanetTheDev
    @JanetTheDev 2 года назад

    Thanks so much, this was super helpful!

  • @ytrkptl
    @ytrkptl 3 года назад +1

    Great explanation.

  • @raimundoladrondeguevara8597
    @raimundoladrondeguevara8597 2 года назад

    Thank you so much for this video.

  • @vyasrajjoshi6059
    @vyasrajjoshi6059 2 года назад

    Very well presented. Waiting for more of such content 😊

  • @waniarifrasool
    @waniarifrasool Год назад

    This is wonderful!

  • @salvadorgonzales1566
    @salvadorgonzales1566 3 года назад

    Wow you did very good on this video! well explained! hope you make many more on all topics lol

  • @flavioneto1081
    @flavioneto1081 3 года назад

    Great video and animations, very explicative, thank you

  • @henriquesenadev2194
    @henriquesenadev2194 Год назад

    Incredible video!

  • @idanqwe1
    @idanqwe1 3 года назад

    Great explanation! Thank you.

  • @Simplicity4711
    @Simplicity4711 2 года назад

    Really great video, but I highly recommend using background music without vocals, or it gets much harder following what you say. 😊😉

  • @arnabgoswami8971
    @arnabgoswami8971 3 года назад

    Thanks you so much for the wonderful explanation It really helped me clearing the concept

  • @Belkiii88
    @Belkiii88 2 года назад

    Really great video!

  • @artnovikovdotru
    @artnovikovdotru 2 года назад +2

    First of all, thanks, very good animation.
    But, it misses an important point. Blocking IO isn't really blocking. Request goes to sleep mode when it waits for IO, giving resources to other threads - if following your analogy, the waiter's soul jumps into another waiter to do stuff, while the first one is waiting (sleeping) for customers to read the menu, etc. And you can have tons of threads to serve as many customers as you can possibly have. However, in reality, there is context switching between threads, and between threads and kernel. And this is what makes this approach slower. This is the most interesting part which I've never seen yet anybody covering in understandable way.

    • @StudyingWithAlex
      @StudyingWithAlex  2 года назад

      Blocking I/O is blocking in the sense that the thread performing I/O is occupied and can't work on other tasks. Like you said, the thread is sleeping and doesn't take up much compute resources, but it's still occupied. That's why blocking I/O with low thread count causes CPU underutilization and request slowdown, and why as I mention in the video, folks using blocking I/O usually crank up the thread count to compensate, but that has its own drawbacks as you mention.

    • @artnovikovdotru
      @artnovikovdotru 2 года назад

      @@StudyingWithAlex Yes, bascially you described the video and my comment again ;) What I'm saying is that one could think that "hey just increase thread count and no need to care about non blocking io, ugly async programming etc" but increasing thread count creates problems, and that's the most interesting part, because it's exactly the reasoning behind non blocking i/o, but no one can explain it properly in details. I.e. everybody just have to trust that threads have drawbacks, but no exact step by step comparison.

  • @KGTube
    @KGTube 2 года назад

    Very informative video, but it would be good to have it w/o music

  • @oladipupooladele3647
    @oladipupooladele3647 2 года назад

    Great video!!!!! i loved it so much

  • @michaelciyke
    @michaelciyke 2 года назад

    awesome explanation!

  • @Developerish
    @Developerish 3 года назад

    My gosh, where have you been my whole life.

  • @DharanAditya
    @DharanAditya 2 года назад

    Thanks for the video ❤

  • @soboko123
    @soboko123 2 года назад

    Great video. But I thought the video would have more details on how non blocking io itself is implemented in node.

  • @randomguy59420
    @randomguy59420 3 года назад +1

    awesome, well done!

  • @afshinshoja2026
    @afshinshoja2026 2 года назад

    Great video, Thanks

  • @mohamedsharkawey3847
    @mohamedsharkawey3847 3 года назад

    that's a nice one mate thank you!

  • @t2a392
    @t2a392 Год назад

    Amazing video !

  • @mirceastaicu4131
    @mirceastaicu4131 3 года назад +2

    So when you await on a fetch (Promise based) network request to finish, you transform the non-blocking I/O into blocking I/O?

    • @StudyingWithAlex
      @StudyingWithAlex  3 года назад +4

      Nope, that's a common misconception :) The await keyword doesn't change the execution at all. It's just an easier way to write Promise-oriented code.
      const result = await fetch(...);
      // do something with result
      is the same as
      fetch(...).then(result => { // do something with result })
      The first can be easier to read, but they're the same from an execution perspective.

    • @mirceastaicu4131
      @mirceastaicu4131 3 года назад

      @@StudyingWithAlex Got it, TIL!

  • @minhhieple6483
    @minhhieple6483 2 года назад

    Thank for sharing