Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the cluster adapter powerful enough to manage heavy socket.io instances (regarding speed) or is Redis adapter more recommended? #2

Closed
amrdb opened this issue Oct 10, 2021 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@amrdb
Copy link

amrdb commented Oct 10, 2021

No description provided.

@darrachequesne
Copy link
Member

That's a good question!

We didn't do extensive benchmark of the adapter, but it seems inter-process communication (IPC) is more efficient than Redis in that case: https://60devs.com/performance-of-inter-process-communications-in-nodejs.html

Note: since the primary/master process handles all incoming requests (and then forwards it to a given worker, see socket.io-sticky), it might be the limiting factor for the number of incoming connections.

As usual, please benchmark it against your own use case.

@darrachequesne darrachequesne added question Further information is requested documentation Improvements or additions to documentation and removed question Further information is requested labels Oct 12, 2021
@amrdb
Copy link
Author

amrdb commented Oct 12, 2021

So in that case, I don't need nginx either to reverse proxy between servers and sticky sessions as you said the primary/master process handles all incoming requests, so should i use nginx or not?

Thanks in advance

@darrachequesne
Copy link
Member

For a single server and multiple workers, using @socket.io/sticky and @socket.io/cluster-adapter is sufficient, and nginx is not needed.

For multiple servers (each one with multiple workers), you will need to use a load balancer (like nginx) and another adapter, like the one based on Redis.

Reference: https://github.com/socketio/socket.io-sticky#notes

@amrdb amrdb closed this as completed Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants