CLUSTER MULTI THREADED NODEJS -- Run threads in parallel to speed up long processes (CORRECTED)

  Рет қаралды 35,292

Joel Codes

Joel Codes

Күн бұрын

Пікірлер: 67
@razvangorgan2186
@razvangorgan2186 4 жыл бұрын
Your content is straightforward without much bloatware. I respect that. Big up!
@JoelCodes
@JoelCodes 4 жыл бұрын
Thanks! I appreciate the feedback. I'm trying to create the content I would like to view. So I'm glad others are enjoying it also. Cheers 🍻
@saeeduchiha5537
@saeeduchiha5537 2 жыл бұрын
I respected that you came back to fix the video
@JoelCodes
@JoelCodes 2 жыл бұрын
Cheers 🍻
@DnKZone
@DnKZone Жыл бұрын
You made it super easy!! Bet no one can teach clustering that much easy. Subscribed :)
@carlosjacobfield-sierra3759
@carlosjacobfield-sierra3759 3 жыл бұрын
Great video man best one I found
@JoelCodes
@JoelCodes 3 жыл бұрын
Thanks. Much appreciate the feedback. Cheers 🍻
@ankurrai2837
@ankurrai2837 3 жыл бұрын
Love from India, Amazing
@JoelCodes
@JoelCodes 3 жыл бұрын
Hello friends from India! Cheers 🍻
@ankurrai2837
@ankurrai2837 3 жыл бұрын
@@JoelCodes Your student 🙏🙏🙏
@leozou2537
@leozou2537 4 жыл бұрын
Really helpful, thanks
@JoelCodes
@JoelCodes 4 жыл бұрын
I appreciate the feedback! Thanks!
@panicogalactico7379
@panicogalactico7379 2 жыл бұрын
Awesome work!! Thank you!!
@BrettCooper4702
@BrettCooper4702 4 жыл бұрын
Very nicely done, thanks
@JoelCodes
@JoelCodes 4 жыл бұрын
I appreciate the feedback. Glad you found the video to be useful. Makes me happy. Cheers 🍻
@IamNobodysir
@IamNobodysir 3 жыл бұрын
Anyone know how to get real user sys execute time in terminal? Somekind of plugin or extension?
@timothyhallbeck9853
@timothyhallbeck9853 3 жыл бұрын
Great lesson, thx
@JoelCodes
@JoelCodes 3 жыл бұрын
Appreciate the feedback! Hope to see you around. Cheers 🍻
@rahulbera454
@rahulbera454 3 жыл бұрын
subscribed !!!
@JoelCodes
@JoelCodes 3 жыл бұрын
Thanks. Much appreciated 🙏
@bntheyoutube
@bntheyoutube Жыл бұрын
Great video! I am curious if you have a solution to pass a predetermined list to each thread? Instead of each thread having to process the entire list. Hopefully that makes sense... thoughts?
@MuhammadImran-yr4pl
@MuhammadImran-yr4pl Жыл бұрын
you didn't give the source media file so i used some other photos as a source, but it's not working. though application is running but photo resizing mechanism is not working
@thewetfly9207
@thewetfly9207 Жыл бұрын
I am master, I am cluster. I am master of clusters 😉Like & sub, thanks for sharing.
@sudhir-pl6tz
@sudhir-pl6tz 2 жыл бұрын
Hi am confused between worker_threads and workerpools package could you please explain?
@eatwithsadam1320
@eatwithsadam1320 3 жыл бұрын
Thanks to its Very helpful. How implement CRON side using Cluster.
@JoelCodes
@JoelCodes 3 жыл бұрын
Glad to hear you found this useful. Can you expand on what you mean about CRON?
@eatwithsadam1320
@eatwithsadam1320 3 жыл бұрын
@@JoelCodes When cron was running and a huge amount of data was being added, the site went down.
@valdemarjohannesson2720
@valdemarjohannesson2720 4 жыл бұрын
Any possibility you can share code for this video? I've tried to follow the video and with your github project, but alas not working. It goes back and forth to quickly for me.
@JoelCodes
@JoelCodes 4 жыл бұрын
No problem! I put a tag in on the section of the code in the repository so you can go right to it. Here's the download link github.com/joelnet/mojo-gallery/releases/tag/youtube-video-cluster
@valdemarjohannesson2720
@valdemarjohannesson2720 4 жыл бұрын
@@JoelCodes thanks alot! Your vid helped me see why my workers didn't want to cooperate with me
@valdemarjohannesson2720
@valdemarjohannesson2720 4 жыл бұрын
@@JoelCodes Im not 100% on it, can you help me with the code? It looks like this right now, I removed resize from your file, but it aint firing away. hastebin.com/yifiqihayi.js
@JoelCodes
@JoelCodes 4 жыл бұрын
@@valdemarjohannesson2720 One thing I see in this code is you are awaiting `hugeData`, but `hugeData` is an Array. So you don't have to await that. You are also creating the function `makeGetRequest` inside of the for loop. Move this to outside of the for. Inside of `makeGetRequest` you are also referencing `i`, but it is not declared.
@valdemarjohannesson2720
@valdemarjohannesson2720 4 жыл бұрын
@@JoelCodes Thanks alot. Do you have any video on worker-threads?
@NKworld-kn6se
@NKworld-kn6se 2 ай бұрын
how to run the scheduler on one core in multi core CPU
@brunokotesky5965
@brunokotesky5965 3 жыл бұрын
Very nice, do you know how can i debbug worker threads or clusters using typescript files on vscode?
@JoelCodes
@JoelCodes 3 жыл бұрын
I'm still learning TypeScript, so I don't have any videos that cover TypeScript. But the process shouldn't be much different, other than setup. I'll put this one in my queue of videos to make. Great suggestion. Cheers 🍻
@mthaha2735
@mthaha2735 3 жыл бұрын
Great content my man. Can you give some other way in which we can segregate the work to each worker other than using the filter method
@JoelCodes
@JoelCodes 3 жыл бұрын
I'm not sure I fully understand what you're asking. I have been thinking about making a part 2 for this, but I haven't got it all planned out yet. Still thinking about it.
@mthaha2735
@mthaha2735 3 жыл бұрын
@@JoelCodes There is a huge array and on every item there is some heavy computational task being performed. So in the video you are allocating different parts of the array to different process using the filter method of array. This is one way of distributing load. Can you give some other example other than using the filter method
@mchannel1365
@mchannel1365 4 жыл бұрын
But its still single thread ,multiple processes. Of course it increases performance as it uses multi core cpu , but you can't share memory within processes i.e you must use databases or external storage at all times , you can't use or share dynamic shared state with clustering module. Clustering is OK for http web based apps, but not necessarily for IOT , online multi user games or Big Data.
@JoelCodes
@JoelCodes 4 жыл бұрын
Messages can be passed between threads. I would disagree with staying it's use is only limited to web apps. There are many successful multi process js applications out there that prove this.
@mchannel1365
@mchannel1365 4 жыл бұрын
@@JoelCodes Yes I agree , I think what you are saying is about worker threads
@IgorogI1000
@IgorogI1000 3 жыл бұрын
That is a important difference... I got a bit confused because of that
@christianaustria741
@christianaustria741 3 жыл бұрын
any update on how much speed it has saved if you use the corrected code?
@JoelCodes
@JoelCodes 3 жыл бұрын
The speed improvement will vary based on the application. So while I could have run benchmarks on this code, they would only apply to this specific code and not represent your app. It will have more effect with apps that use a lot of cpu.
@dungduong89
@dungduong89 3 жыл бұрын
what is the name of the theme vscode you use
@JoelCodes
@JoelCodes 3 жыл бұрын
Right now I am using a theme called Moonlight and the font FiraCode.
@dungduong89
@dungduong89 3 жыл бұрын
@@JoelCodes thank bro
@calvinrogercanas6737
@calvinrogercanas6737 4 жыл бұрын
Hello Joel, can you explain why your code didn't get stuck when the worker id is 1? It means your filter will always pass since the calculation will always be 0? Thanks and love the video!
@calvinrogercanas6737
@calvinrogercanas6737 4 жыл бұрын
not stuck per se, but that worker did not get all the load?
@JoelCodes
@JoelCodes 4 жыл бұрын
What is the time stamp in question? I'll go through it and try to explain it better for you. Cheers 🍻
@calvinrogercanas6737
@calvinrogercanas6737 4 жыл бұрын
@@JoelCodes 9:47 line 45 -- let's say the first forks value is 1 so the result of modulo calculation will always be 0 and all of images will be included on that clusterFiles since it will pass the filter everytime. right?
@JoelCodes
@JoelCodes 4 жыл бұрын
@@calvinrogercanas6737 Yes you have got it correct. The cluster (index 1) would have processed the full load and cluster (index 2) would have processed all the evens, index 3 would have done every 3rd. Not the result I was looking for. 😂
@sajad2126
@sajad2126 Жыл бұрын
360p ?
@somerandomguy1533
@somerandomguy1533 3 жыл бұрын
can I use this to scale apps and/or games to multiple cores with multiple cpu's? Or am I just dreaming? lol
@JoelCodes
@JoelCodes 3 жыл бұрын
Ya you can definitely use this. I believe most game engines will automatically do this (multi-processor) for you though. So you don't have to manually offload work.
@somerandomguy1533
@somerandomguy1533 3 жыл бұрын
@@JoelCodes Well in the case that I'm using older hardware to run a modern games... For example star citizen. I have to use sde.exe ( Intel's software developer executable) to emulate the AVX instruction set because I use old hardware. And for that reason, I like to see what software improvements I can do to bring them up to speed. I think you see where I'm going with this, hopefully.
@frontendsourcetom9428
@frontendsourcetom9428 4 жыл бұрын
guess what , i subed for learning english rn
@JoelCodes
@JoelCodes 4 жыл бұрын
Awesome! Hope to see you around then. Cheers 🍻
@soniablanche5672
@soniablanche5672 2 жыл бұрын
I think your cpu has multithreading and generally logical cores aren't as efficient as real cores
@JoelCodes
@JoelCodes 2 жыл бұрын
You may be right about that and I didn't think about that at the time. It would be nice to separate out the real cores and run a test on it. Next time I guess. Cheers 🍻
@dzenish.2262
@dzenish.2262 4 жыл бұрын
Dude, I'm sorry. But this is BAD. You really, and I mean really, need to delete or recreate this video.
@JoelCodes
@JoelCodes 4 жыл бұрын
Hi Dzenis, could you be more specific on what part of the video you would consider bad? Or an approach that you would recommend instead?
How to use Multithreading with "worker threads" in Node.js?
19:34
Software Developer Diaries
Рет қаралды 75 М.
PROOF JavaScript is a Multi-Threaded language
8:21
Beyond Fireship
Рет қаралды 292 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 145 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 35 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 35 МЛН
How to scale NodeJs applications using the cluster module.
13:37
Mafia Codes
Рет қаралды 51 М.
Go vs Rust vs Bun vs Node | Prime Reacts
18:07
ThePrimeTime
Рет қаралды 176 М.
Node.js is a serious thing now… (2023)
8:18
Code With Ryan
Рет қаралды 661 М.
When is NodeJS Single-Threaded and when is it Multi-Threaded?
18:42
Hussein Nasser
Рет қаралды 74 М.
Managing Multiple Threads In Node JS 🧵 | OPTIMIZING NODE JS
9:32
Bleeding Code (By John Jardin)
Рет қаралды 23 М.
All you need to know about "child_process" in Node.js
12:38
Software Developer Diaries
Рет қаралды 10 М.
Concurrency vs Parallelism in Node.js
7:47
Mehul - Codedamn
Рет қаралды 44 М.
Scaling your Node.js app using the "cluster" module
13:44
Software Developer Diaries
Рет қаралды 49 М.
The Node.js Event Loop: Not So Single Threaded
31:54
node.js
Рет қаралды 168 М.
Speed Up Your Node App Using Worker Threads!
6:34
Coding With Chaim
Рет қаралды 22 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 145 МЛН