S
S
Sergo Sergo2015-10-09 11:10:32
Node.js
Sergo Sergo, 2015-10-09 11:10:32

How to handle heavy load on node.js server?

Good afternoon. I have a project where online advertising reaches up to 4500. We encountered such a problem that the server on node.js + socket.io simply cannot withstand such online and starts to lag, does not have time to accept all clients and all that. We are thinking of rewriting the server using cluster, will this be the right decision?
Car specifications:
CPU:XEON 5520 4Core
HDD:60Gb
RAM:10Gb
NET:100Mbit \ unmetered

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Timur Shemsedinov, 2015-10-09
@sergo_serga

If you already have everything written, then you don’t need to rewrite it, just add cluster, here is an example: stackoverflow.com/questions/18310635/scaling-socke...
But in general, for the future, neither cluster nor socket is needed for such things. io, they only interfere and do not solve any additional problems, it is better to do as many processes on the server as there are cores and open a separate port on each, for example: 80, 81, 82... Disable all balancers, both software and hardware, do not skip through nginx and through cluster, these are also balancers, in fact. And choose the port randomly on the client. For a machine like yours, when using just ordinary Websockets, without any wrapper libraries, both on the client and on the server, you can keep up to 150,000 connections without problems.

L
lyeskin, 2015-10-09
@lyeskin

Give the connoisseurs the characteristics of the server. Or maybe you need vertical scaling, not horizontal.

D
Dmitry Makarov, 2018-11-29
@MDiMaI666

Or write in a normal compiled c# language (ASP.NET, NET core), for example, and not WebSocket, but drive simple bytes through tcp/udp/socket.
And I know that the question was written three years ago, for the future.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question