E
E
EpicUsaMan2016-11-29 05:54:01
JavaScript
EpicUsaMan, 2016-11-29 05:54:01

Parallel socket.io?

Half of the functionality of the site works on socket.io and the user, wherever he is, connects to socket.io, but since this whole thing works in one thread, as a result, the speed drops dramatically on a large number of connections.
Is there a way to scatter users across threads? (Let's say 6 threads, each thread has 1/6 users)
And all of them must have access to shared memory (several arrays, one with constant data, one changes by itself over time, one changes by connections (sockets))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladlen Hellsite, 2016-11-29
@EpicUsaMan

It is possible to simply run the node in several processes using Cluster or a good PM2
wrapper . This is, of course, if I understand the task correctly.

I
Ivan, 2016-11-29
@LiguidCool

Regarding the processes, comrade Vladlen Hellsight answered you perfectly.
About storing data between child processes - read what Redis is for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question