All you need to know about "child_process" in Node.js

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 19

  • @ofeklevy1242
    @ofeklevy1242 7 หลายเดือนก่อน +7

    One of the best channels for learning advanced node-js and backend related stuff.
    BTW im waiting for the best practices for security in web apps. :)

  • @alphonsoacqua
    @alphonsoacqua 6 หลายเดือนก่อน +1

    Outstanding! Finally someone is making quality videos about advanced Node.js. Thank you. 🤝

  • @Yohannesalemu-k8w
    @Yohannesalemu-k8w ชั่วโมงที่ผ่านมา

    i understand know after warching 2 videos but this is clear and clear nice

  • @yousafraza9347
    @yousafraza9347 5 หลายเดือนก่อน

    Really love this methodology of deep diving a specific topic. Glad I found this channel

  • @allatyurina6631
    @allatyurina6631 หลายเดือนก่อน

    I really appreciate you for your videos! You are so great at explaining such complicated things. Many thanks!

  • @hanibal43
    @hanibal43 7 หลายเดือนก่อน +5

    These are amazing videos! no one is doing deep dives in node.js love the video would like to see more practical uses of these like with small API project videos

  • @aliadel1723
    @aliadel1723 3 หลายเดือนก่อน

    Best channel for nodejs

  • @headlights-go-up
    @headlights-go-up 7 หลายเดือนก่อน +2

    love these types of videos! so much better than the superficial "build a twitter clone" videos that everyone else makes.

  • @NguyenNgoc-b3e
    @NguyenNgoc-b3e 7 หลายเดือนก่อน +1

    I love your content man

  • @LuisGutierrez-ct6iw
    @LuisGutierrez-ct6iw 7 หลายเดือนก่อน

    Nice video man, but I still feel curious about what is the main difference using this approach rather than NodeJS cluster mode, I mean what are the special scenarios where is useful to use either worker_threads, cluster mode with NodeJS or PM2 and child processes, is it also recommended to use all of them in the same app? Thank you in advance

    • @SoftwareDeveloperDiaries
      @SoftwareDeveloperDiaries  7 หลายเดือนก่อน +3

      Hey mate! Thanks for watching the video and for your thoughtful question!
      When it comes to handling concurrency in Node.js, there are indeed several options like child processes, Node.js cluster mode, and tools like PM2. Each has its own strengths and best-fit scenarios.
      Child processes: These are great when you need to run separate tasks concurrently, like handling CPU-intensive operations or interacting with external processes. Imagine you're building a web server with Node.js, and you need to generate PDF reports on the fly in response to user requests. However, generating PDFs is a CPU-intensive task that could block the event loop. Here, you could offload the PDF generation to a child process, allowing your main server to continue handling incoming requests without being blocked.
      Node.js cluster mode: This is specifically designed for scaling your Node.js application across multiple CPU cores. It's ideal for network-bound applications where you want to take advantage of parallelism to handle multiple requests simultaneously. Suppose you're developing a chat application where multiple users can connect simultaneously. Each incoming connection triggers some processing on the server, such as authentication and message handling. By using cluster mode, you can spawn multiple instances of your application across CPU cores, allowing you to handle more concurrent connections efficiently.
      PM2: PM2 is more of a process manager that helps in running and managing Node.js applications in production environments. It can handle clustering, monitoring, and auto-restarting of processes, making it convenient for deployment scenarios. Let's say you have a production-grade API serving hundreds of requests per minute. You want to ensure high availability and automatic restarts in case of failures. PM2 can manage your Node.js process, keeping it running smoothly by automatically restarting it if it crashes. Additionally, PM2 can monitor CPU and memory usage, allowing you to scale your application vertically or horizontally as needed.
      As for whether to use all of them in the same app, it really depends on your specific use case. Generally, you wouldn't use child processes and cluster mode together since they serve similar purposes. However, PM2 can complement either of them by providing additional management features. Hope this was helpful 😊

  • @stonebaydevil2839
    @stonebaydevil2839 7 หลายเดือนก่อน

    Excellent video!

  • @vlatkod1065
    @vlatkod1065 6 หลายเดือนก่อน

    good job man!

  • @rahul455roy
    @rahul455roy 7 หลายเดือนก่อน +2

    Please also create video on middleware best practices

  • @elvillano1777
    @elvillano1777 5 วันที่ผ่านมา

    capo total