-
I have uWS cluster setup with worker threads as given in example section. My code is as follows
I generate a random unique id for every worker and I have my logger configured to add instance id to every log that it prints
When I just trigger some requests concurrently using load test all the requests end up being served by a single worker.
Just truncated the logs for few requests and I verified that all the 10000 requests that I triggered were served by a single worker. I hope its not desired behaviour. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
What tool did you use to test? Mostly it's issue with sticking keep-alive session. When you use multiple clients everything will be fine. |
Beta Was this translation helpful? Give feedback.
-
@zaksmok i just found the issue. Its already been raised here before. I am running it in mac machine and it requires different port for every worker. So only one worker gets successfully created out of four and eventually handles all the request. I hope it would not occur in linux machine which i have not tried yet |
Beta Was this translation helpful? Give feedback.
-
I tested on WSL (Debian 10), Debian 10 and Ubuntu 20. Everthing worked fine on these machines so it can be osx issue |
Beta Was this translation helpful? Give feedback.
-
It is a Linux feature |
Beta Was this translation helpful? Give feedback.
-
Yup got it @alexhultman-2fa i just got confused with nodejs cluster. It works with same port for all the workers in mac. I think it just creates a master listening on port and transfers the request to worker using round robin methodology. Here we create four independent worker threads which listen to port directly |
Beta Was this translation helpful? Give feedback.
-
Since mac is just my development machine and my server is linux it should not be a problem and i closed the issue for the very reason |
Beta Was this translation helpful? Give feedback.
It is a Linux feature