Concurrency vs Parallelism in Node.js

Поділитися
Вставка
  • Опубліковано 17 жов 2024

КОМЕНТАРІ • 80

  • @bleakCode
    @bleakCode 2 роки тому +5

    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

  • @DavidMood
    @DavidMood 2 роки тому +14

    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 роки тому +2

      Yes.. give detailed explanation on node parallelism

    • @shubhamsingh4701
      @shubhamsingh4701 2 роки тому +1

      your can refer to thread pool in node js I think you will get some practical example.....

    • @justinJ689
      @justinJ689 2 роки тому +1

      yes, please give an example.

    • @sourav_singh_diaries
      @sourav_singh_diaries 7 місяців тому

      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 : ua-cam.com/video/p-i-fo0OgXA/v-deo.htmlsi=HpL64INhhR1qx7Bk

  • @sanjarcode
    @sanjarcode Рік тому +13

    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 10 місяців тому

      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 6 місяців тому

      ​@dheeraj_kr._shrivastva2.118 could you rephrase the question better or at least use some punctuation.

  • @aurobindobhuyan2107
    @aurobindobhuyan2107 7 місяців тому

    I was learning Node clustering, and this video added more details to it.❤

  • @prashantbismani
    @prashantbismani Рік тому

    Amazing Explanation, Thank you for making this. Please continue creating such videos, you got huge potential.

  • @Systemv1
    @Systemv1 Рік тому +1

    Fantastic - thank you for the talk. The whiteboard approach works really well :)

  • @pavan-iu7qy
    @pavan-iu7qy 2 роки тому

    I watched this till the end and also watch your upcoming videos till the end

  • @qcmira2024
    @qcmira2024 2 роки тому +3

    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 ?

  • @shubhamjaiswal9100
    @shubhamjaiswal9100 2 роки тому +3

    Ajinkya Rahane Cricketing career ka pata nhi ....but his teaching career in coding seems to be bright enough

  • @adityarawat4964
    @adityarawat4964 7 місяців тому

    This guy is a true fullstack developer

  • @dwaipayansen2966
    @dwaipayansen2966 2 роки тому

    I watched this video till the end and it was very lucid, thanks!

  • @jimlougheed9922
    @jimlougheed9922 2 роки тому

    I watched this video to the end, great info!

  • @Sandeep-zd6dq
    @Sandeep-zd6dq 2 роки тому +1

    Simple easy explanation of event loop. 🙌👍
    Watched till the end.

  • @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

  • @ubaidkhan426
    @ubaidkhan426 2 роки тому

    Splendid explanation 👍 I've watched the video till the end. Thank U :)

  • @uzair004
    @uzair004 2 роки тому +1

    multiple instance of nodejs for parallelism , is it the reason we use process manager like PM2 on production?

  • @ankitaggarwal9438
    @ankitaggarwal9438 2 роки тому

    I WATCHED THIS VIDEO TILL THE END!

  • @jorgeortiz41395
    @jorgeortiz41395 2 роки тому

    Got to respect the work and consistent video upload schedule!

  • @moshoodalimi2406
    @moshoodalimi2406 3 місяці тому

    nice video, learnt something new

  • @z.cibis-iqbal8774
    @z.cibis-iqbal8774 2 роки тому

    Thanks allot, i watched the video till the end:)

  • @tahasaleh4697
    @tahasaleh4697 2 роки тому

    Watched till the end 👍

  • @eric000
    @eric000 2 роки тому +3

    Pls clarify for parallelism no change in code is needed? NodeJS does it by itself of multiple cores available?

    • @dhanushs9159
      @dhanushs9159 2 роки тому +1

      You need to make use of cluster module (inbuilt to node). Or you can make use PM2.

    • @eric000
      @eric000 2 роки тому

      @@dhanushs9159 thanks👊👍

    • @sanjarcode
      @sanjarcode Рік тому +1

      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.

  • @liu-river
    @liu-river Рік тому

    How do you run nodejs in all 4 cores? Do you mean using worker threads?

  • @abdulazeezshakrullah9630
    @abdulazeezshakrullah9630 2 роки тому +1

    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 роки тому +1

      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.

  • @ruhankhandakar
    @ruhankhandakar 2 роки тому

    always watched all videos of ur till the end

  • @geekofia
    @geekofia 2 роки тому

    I watched this video till the end as always ❤️

  • @tibzdankan
    @tibzdankan 2 роки тому

    I watched the video till the end

  • @Rajkishan1000
    @Rajkishan1000 2 роки тому

    I watched this video till the end

  • @MuhammadUsman-gz8fk
    @MuhammadUsman-gz8fk Рік тому

    Nice Presentation

  • @vasurangpariya8492
    @vasurangpariya8492 2 роки тому

    Great please give more videos about node js

  • @ADITYAKUMARking
    @ADITYAKUMARking 2 роки тому

    I watched this video till the end.

  • @ikumargaurav
    @ikumargaurav 2 роки тому

    I watched the video til the end.

  • @dixztube
    @dixztube 4 місяці тому

    I watched to the end. Give me something!

  • @rahuleum
    @rahuleum 2 роки тому

    I watched till the end

  • @HarshSingh-cp8mq
    @HarshSingh-cp8mq 2 роки тому

    sir , so should i move to Golang to achieve parallelism

  • @SleepeJobs
    @SleepeJobs 2 роки тому

    Excellent explaination

  • @douglasmiranda4756
    @douglasmiranda4756 2 роки тому

    Thank you very much!

  • @djharshal0007
    @djharshal0007 Рік тому

    Amazing explanation 👌🏻👌🏻

  • @ahsanhabibabir5887
    @ahsanhabibabir5887 2 роки тому

    thnx, this was very useful

  • @thesouth4976
    @thesouth4976 2 роки тому

    " You from another universe"😂😂 nice reference

  • @ankitbinjola
    @ankitbinjola 2 роки тому

    Is node microservices an example of parallelism ?

  • @rushikeshkhilari4662
    @rushikeshkhilari4662 2 роки тому

    then what promise.all() can be defined?

  • @isurucumaranathunga
    @isurucumaranathunga 2 роки тому

    Thank you so much

  • @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

      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.

  • @poonamgur2294
    @poonamgur2294 2 роки тому

    So how multithreading is different?

  • @chris_ea
    @chris_ea 25 днів тому

    ❤ thanks

  • @hamzarasool7669
    @hamzarasool7669 2 роки тому

    where do we use this concept in real life

  • @sourav_singh_diaries
    @sourav_singh_diaries 7 місяців тому

    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 : ua-cam.com/video/p-i-fo0OgXA/v-deo.htmlsi=HpL64INhhR1qx7Bk

  • @ashish_prajapati_tr
    @ashish_prajapati_tr 2 роки тому +1

    awesome

  • @dizzymolecule6759
    @dizzymolecule6759 2 роки тому

    This is similar to the scheduling concept in operating system. For example round robin scheduling

  • @dhanabalt5552
    @dhanabalt5552 2 роки тому

    Perfect 👍

  • @epinino
    @epinino 2 роки тому

    how to do it in nodejs?

  • @vishal_sharma_rha
    @vishal_sharma_rha 2 роки тому

    Great 👍

  • @sanjarcode
    @sanjarcode Рік тому +1

    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.

  • @anthonypace5354
    @anthonypace5354 10 місяців тому

    workers?

  • @ahmedhafez9951
    @ahmedhafez9951 Рік тому

  • @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.

  • @kailash4591
    @kailash4591 2 роки тому

    The end of video.

  • @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.

  • @maacpiash
    @maacpiash 2 роки тому +2

    Still don't like this whiteboard format, man.

  • @deepak.chandola
    @deepak.chandola 2 роки тому

    I see your videos regularly but this one seemed completely irrelevant for a ~8 min video.

  • @parvati27
    @parvati27 2 роки тому

    If only your english is good, you would be a great asset

  • @Aditya.Santra
    @Aditya.Santra 2 роки тому

    I WATCHED THIS VIDEO TILL THE END!

  • @vishveshguthal
    @vishveshguthal 2 роки тому

    I watched this video till the end

  • @ankitsuda
    @ankitsuda 2 роки тому

    I watched the video till the end

  • @GarTheStar
    @GarTheStar 2 роки тому

    I watched this video till the end

  • @mohamedfaalil
    @mohamedfaalil 2 роки тому

    I watched this video till end