Reputation: 1093
I use ws
library in Node.JS. When I've got more than 100 clients, the WebSocket server can't handle all traffic, the server lags, but if users are disconnected, the server works correctly. I use Heroku
to host servers. What can I do for optimize my servers/app? Should I use another service than Heroku
?
EDIT: I'm using paid version of Heroku (Hobby). My script isn't long (about 140 lines).
EDIT: I have 3 x VPS Cloud 3 from OVH.
Client -> VPS 1 -> ((VPS 2 -> example.com) + (VPS 3 -> example.com)) -> VPS 1 -> Client
Upvotes: 0
Views: 1480
Reputation: 180
This question does not contain enough information to properly answer the question. There are a lot of factors that can contribute to this. To name a few:
As someone else stated, Node.JS is typically running on a single core with asynchronous IO. Concurrency, as I've argued with many people in the past, is not parallelism. There is a huge difference. That doesn't mean Node couldn't be used to support more users, but it also depends on how you've implemented it and all of the other factors lying underneath. Think of a car that simply won't start. You can't just say, "Hey, my car won't start - why not?" At the same time, you can't simply say, "Hey, my car starts, but sometimes when driving, it vibrates badly and makes funny noises."
Can you put the Node.JS web socket code you're using up on a pastebin, and also include information on the server it's running on? Some good info from there would be:
cat /proc/meminfo cat /proc/cpuinfo ulimit -a
Also, the bandwidth you have (100mb? 10mb?)
Those would be good starting grounds to look at the problem and try and determine where the bottleneck is.
Oh, if you're on an OpenVZ host, it would be useful if you could give the bean counter information.
Upvotes: 3