sir, यह समझ मे आ गया लेकिन मेरा एक प्रश्न है nodejs worker threads क्या होता है क्या यह same है cluster और nodejs worker threads or cluster में क्या difference है और किस जगह किसका use होगा please इसके ऊपर video बना दीजिये request है
Great video bhai But I've got a quick question here We are creating workers in the equal amount of CPUs we have but does the newly created workers has the capacity equal to the primary NodeJs server because ye saare child workers us primary NodeJs server se hi create hue hai so does each of the workers has the same amount of capacity that the primary workers have? For eg: NodeJs primary server can handle 1k users so the child workers created suppose 10 does all those workers have the same amount of capacity like each workers can handle 1k users ?? Or they have 100 users of capacity each ??
how is this different from a single server.. assuming there are no other services running on that computer so no CPU context switching..(very less, because total number of processes are less) and we know that nodejs internally use multiple threads with lbuv and those threads can run on separate cors (cpus).. than how its different ? if we have same system resources..
How do we create so many servers on the same port? Fork one is in if section and server started in else section so if fork created 8 worker then how it move to else section?
@@pranupranav5563 it can be. But with react and next js you have to configure build bundle according to express server or passing the frontend to express server
@@pranupranav5563its more like a loadbalancer which youre talking about but logically again one port is only handling one io requests and it has the access to clusters of the server
if I have a mongodb connection inside my node app. can this create a producer consumer type problem? for example, different clusters could write to the DB simultaneously, could this happen, or MongoDB handles this?
@@piyushgargdev sorry should have check your channel first. But i want to say I searched on youtube a lot but your docker video is not there in youtube search results.
I understand that clusters are out-of-the-box feature of Node.js. But if it's just about scalability, we can't always scale out a.k.a horizontally scale our server. Isn't clustering same as scaling up a.k.a vertical scaling solution ?
Here the cluster load balancer is distributing the requests among the CPU Threads in a single machine (server). As you asked, "explicitly creating load balancers" is used to distribute loads among the multiple servers.
Dear i write same code as in your video in server.js file but when i open multiple browser tab then the workerId is same in all tab. can you suggest me where i am wrong ????
Good explanation Piyush ji I want to ask one question regarding this I am using PM2 for production but not able to distribute load after 2-3 days my servers is not working. And one last question if I have 9 cores and I have 3 node server for different purpose so each server have 9 workers in cluster or each will get 3 worker Please clear my doubt sir ji🎉🎉
can this really be used in live websites ? like if there is finance company like paytm which uses nodejs as backend ? so load can be managed through this ?
[nodemon] restarting due to changes... [nodemon] starting `node server.js` Server is running on port 8000 with PID 16656 Server is running on port 8000 with PID 13576 Server is running on port 8000 with PID 2436 Server is running on port 8000 with PID 18384 Server is running on port 8000 with PID 17504 Server is running on port 8000 with PID 3704 Server is running on port 8000 with PID 16880 Server is running on port 8000 with PID 16672 Server is running on port 8000 with PID 10992 Server is running on port 8000 with PID 16940 Server is running on port 8000 with PID 18156 Server is running on port 8000 with PID 11684 Worker 11684 handling request Worker 11684 handling request in my case when i do req so only on Worker handle all the req i also try with 1000 req but again same Worker which is 11684 handling all the req can anyone help me
Sir you are quite low efficient. Let me tell you why agr yese hi pdhna hota to hum chatgpt se bhi pdh lete code utha uthakr rkhna ye koi pdhana nhi hota smjhayega kon abhi mai puchna lgu cluster backend mai kaise os ko bta rha ki usko 4 cpu ka time milna chyaie I definitely apke pass uska jwb nhi hoga you are teaching in wrong qay
I simply love how you explain complex things in a really easy way.💌
Investing time in this series is totally worth it !!!!. You are suh a great teacher. Thank you Piyush for this amazing series.
Nice Content Sir . This Playlist is Amazing
Best Node js Playlist In TH-cam
So it is basically load balancer in NodeJS. Enjoyed it thanks for creating this advanced NodeJS playlist.
From which backend background are you from?
not working as expected bro
Crystal clear ❤️
cluster clear
Needful.TQ so much sir.
Amazing playlist Piyush. Thank you!
Nice explanation..sir can u come with a real time project where we can use these concepts (soket streaming cluster etc)
Never stop teaching you have great skills🎉🎉❤
have you completed this series up to now, and can u give me review abt it ?
Piyush one word for you RESPECT...
Possible to have video on system design and components involved..
have you completed this series up to now, and can u give me review abt it ?
have you completed this series up to now, and can u give me review abt it ?
Excellent explained, well explained 🎉
Great way of teaching .
great bhai , now understanding nodeJs so easy
have you completed this series up to now, and can u give me review abt it ?
Your content is always amazing.
Very helpful 🤩
Very clean explanation
I thought man you need kudos for a very calm and composed nature. Keep it up.
nice as always
Thank you bhaiya
sir, यह समझ मे आ गया लेकिन मेरा एक प्रश्न है
nodejs worker threads क्या होता है क्या यह same है cluster
और nodejs worker threads or cluster में क्या difference है और किस जगह किसका use होगा please इसके ऊपर video बना दीजिये request है
hey piyush, i have one question. Doesnt the primary cluster allocate a CPU?
Awesome thanks a lot
restart vs code
cntrl + p
type. " > reload "
select reload window enter
If possible can you explain using a microservice architecture?
Great Explaination bro
Thank you ❤️
Cluster is very old module, it has vulnerabilities. Any possible replacements for it?
Amazing video sir
have you completed this series up to now, and can u give me review abt it ?
use case kya h iska? deployment services like aws have their own load balancers and auto scaling groups. is this good for on premise servers?
Great video bhai
But I've got a quick question here
We are creating workers in the equal amount of CPUs we have but does the newly created workers has the capacity equal to the primary NodeJs server because ye saare child workers us primary NodeJs server se hi create hue hai so does each of the workers has the same amount of capacity that the primary workers have?
For eg: NodeJs primary server can handle 1k users so the child workers created suppose 10 does all those workers have the same amount of capacity like each workers can handle 1k users ?? Or they have 100 users of capacity each ??
Amazing video
Loadbalancing in Multiple docker containers are more useful or node js clustering?
how is this different from a single server.. assuming there are no other services running on that computer so no CPU context switching..(very less, because total number of processes are less) and we know that nodejs internally use multiple threads with lbuv and those threads can run on separate cors (cpus).. than how its different ? if we have same system resources..
So only multi-core processors support parallelism?
What if I use multiple single-core machines with increased RAM?
Thanks, Well which chrome plugin are you using to see json response in the browser?
super bro 👍👍👍
Thank you so much
This video help me a lot ... For video streaming app
Bhaiya ye jb hm deploy krenge toh kitne CPUs bnenge or kese Handel hoga ye sb..
Can u plz make video on child process
Nice video bro... 🔥
What does it mean we can create multiple threads ? as we know nodejs is single threaded
does it make sense to use cluster if we are using kubernetes and docker?
sir mere laptop me process.pid all different windows me same kyu hai
don't use process.isPrimary instead use process.isMaster
How do we create so many servers on the same port? Fork one is in if section and server started in else section so if fork created 8 worker then how it move to else section?
Same question!
Hii My Frontend Is Crashing when ever the traffic come on my web site it crash and show me error Error too many files open Errno -4066
How can you solve this problem? Please help me
bhai deployment with NGINX crash course banao please 🥺
Sure, Starting from today ✨
@@piyushgargdev love you bro you're the greatest teacher on TH-cam god bless you and you'll achieve more success 💕
How we can create many servers on same port ?
no
@@sad0n3 let a proxy server running on a port and handle requests based on the url forwarding to different services
@@pranupranav5563 it can be. But with react and next js you have to configure build bundle according to express server or passing the frontend to express server
Logically just one
@@pranupranav5563its more like a loadbalancer which youre talking about but logically again one port is only handling one io requests and it has the access to clusters of the server
if I have a mongodb connection inside my node app. can this create a producer consumer type problem? for example, different clusters could write to the DB simultaneously, could this happen, or MongoDB handles this?
have you completed this series up to now, and can u give me review abt it ?
Thanks
have you completed this series up to now, and can u give me review abt it ?
@@arpitmehta779 It is great.
Bhaiya ek docker pr bhi one video loa please request.
I already have a playlist on docker :)
@@piyushgargdev sorry should have check your channel first. But i want to say I searched on youtube a lot but your docker video is not there in youtube search results.
I understand that clusters are out-of-the-box feature of Node.js. But if it's just about scalability, we can't always scale out a.k.a horizontally scale our server. Isn't clustering same as scaling up a.k.a vertical scaling solution ?
have you completed this series up to now, and can u give me review abt it ?
Is there any difference in the explicitly creating load balancers on aws or using clusters???
Here the cluster load balancer is distributing the requests among the CPU Threads in a single machine (server). As you asked, "explicitly creating load balancers" is used to distribute loads among the multiple servers.
Dear i write same code as in your video in server.js file but when i open multiple browser tab then the workerId is same in all tab. can you suggest me where i am wrong ????
I think you have to open that second request in different account of browser or open in different browser then maybe it will work, give a try.
Good explanation Piyush ji
I want to ask one question regarding this I am using PM2 for production but not able to distribute load after 2-3 days my servers is not working.
And one last question if I have 9 cores and I have 3 node server for different purpose so each server have 9 workers in cluster or each will get 3 worker
Please clear my doubt sir ji🎉🎉
hey bro, please help me,
can this really be used in live websites ?
like if there is finance company like paytm which uses nodejs as backend ?
so load can be managed through this ?
have you completed this series up to now, and can u give me review abt it ?
Mine are coming same even in differnet browsers!!!!!!!1
damn this was mine interview quesstion , what is clusters in nodejs ?
Then you told them the answer?? Or you didn't know about it during your interview??
@@Ayush37262 I didn't know😭
@@yagneshacharya2461 Sed :(
Sir is it similar to worker thread module or its something else?
have you completed this series up to now, and can u give me review abt it ?
bhaiya ye bta do ki node js ke project ko host kaise karte hai
Already made a video in this playlist
9:05 sir mera pass 28 cores cpu i7 14gen
[nodemon] restarting due to changes...
[nodemon] starting `node server.js`
Server is running on port 8000 with PID 16656
Server is running on port 8000 with PID 13576
Server is running on port 8000 with PID 2436
Server is running on port 8000 with PID 18384
Server is running on port 8000 with PID 17504
Server is running on port 8000 with PID 3704
Server is running on port 8000 with PID 16880
Server is running on port 8000 with PID 16672
Server is running on port 8000 with PID 10992
Server is running on port 8000 with PID 16940
Server is running on port 8000 with PID 18156
Server is running on port 8000 with PID 11684
Worker 11684 handling request
Worker 11684 handling request
in my case when i do req so only on Worker handle all the req
i also try with 1000 req but again same Worker which is 11684 handling all the req
can anyone help me
Why put an English title on an Indian video 🤧
Sir you are quite low efficient. Let me tell you why agr yese hi pdhna hota to hum chatgpt se bhi pdh lete code utha uthakr rkhna ye koi pdhana nhi hota smjhayega kon abhi mai puchna lgu cluster backend mai kaise os ko bta rha ki usko 4 cpu ka time milna chyaie I definitely apke pass uska jwb nhi hoga you are teaching in wrong qay
Aap kyu nhi banake daal dete video
Thanks