Question

I've made a server in nowjs, and with about 80 users online it get slow and sometimes people get disconnect. I've heared about that I have to change the workers count. But how to do it? and is it a solution? Or maybe there are another advices.

Was it helpful?

Solution

You may have hit a scaling issue, 80 users seems low to me.
Are you sure you are not doing any kind of logic on your server side that could be blocking ? Any math or something that require too much time ?

If you have a scaling issue, you may need to horizontally scale you app. To do so you would have to use something like node cluster to have multiple workers handling the work, and a Redis or a Mongo used for handling shared the data, it might be possible to do using message in node cluster.

I've not push now.js that far yet. I don't know how it would handle in such a situation.

OTHER TIPS

Since you mentioned writing log data to file and is larger, make sure you're using right Node asynch file i/o so is not blocking -- can use with optional callbacks. Better yet, creating a write stream is the way to go (Node is great for it's asynch file streaming capabilities).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top