Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase max connection to node.js/socket.io

I noticed that the maximum concurrent connections to node.js with socket.io is about 1000 connections.

Is it possible to increase that number with ulimit command on linux? setting the ulimit to 65536 can solve my problem?

like image 518
udidu Avatar asked Jun 11 '12 18:06

udidu


People also ask

How many Socket connections can Socket.IO handle?

As we saw in the performance section of this article, a Socket.IO server can sustain 10,000 concurrent connections.

How many Socket connections can Nodejs handle?

The theoretical limit is 65k connections per IP address but the actual limit is often more like 20k, so we use multiple addresses to connect 20k to each (50 * 20k = 1 mil). I then run the web server as root by typing sudo -i followed by ulimit -n 1024000 and then node examples/WebSocket. js (in the uWebSockets.

How many messages per second can Socket.IO handle?

Load benchmarks Here we can see that the HTTP benchmark peaks at about~950 requests per second while Socket.io serves about ~3900 requests per second.

Should I use Socket.IO in 2022?

With nearly 55k stars on GitHub and about 3 million downloads on npm weekly, Socket.IO is a great library to keep an eye on in 2022. The documentation is very straightforward, meaning even an inexperienced developer should be able to get started in little to no time.


1 Answers

Set the ulimit for the user account node.js is running on to a higher number.

like image 165
TheHippo Avatar answered Oct 19 '22 23:10

TheHippo