Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Socket.io: How many concurrent connections can WebSockets handle?

I am wondering if you have any data on concurrent connections to websockets? I am using Socket.io on Node.js server. How many clients can connect to socket and receive data without bringing my server down? 1000? 1000.0000?

Thanks!

like image 862
Pono Avatar asked Apr 17 '11 17:04

Pono


People also ask

How many WebSockets can run concurrently?

The default value for this is 65536 so without this setting you wont be able to get more connections than that.

Would WebSockets be able to handle 1000000 concurrent connections?

With at least 30 GiB RAM you can handle 1 million concurrent sockets.

Can a WebSocket have multiple connections?

A server can open WebSocket connections with multiple clients—even multiple connections with the same client. It can then message one, some, or all of these clients. Practically, this means multiple people can connect to our chat app, and we can message some of them at a time.

How many requests can socket.io handle?

Server was able to handle 100000 events distributed in 1000 rooms with 5 requests per second querying db.


2 Answers

This highly depends on your hardware configuration, what exactly are you doing/processing on the server side and if your system is optimized for many concurrent connections. For example on Linux machine by default you would probably first hit maximum number of opened files or other limits (which can be increased) before running into hardware resources exhaustion or similar scalability issues. Key resource may be the amount of RAM which can be allocated by your node.js program to keep concurrent connections opened and ability to receive new ones.

like image 173
yojimbo87 Avatar answered Oct 08 '22 16:10

yojimbo87


http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/

Check this blog. We use the same principle. Previously our nodejs server will crash after 100 concurrent connections due to hardware constraints. But after we move to Amazon EC2 it is now highly scalable.

like image 45
3s2ng Avatar answered Oct 08 '22 16:10

3s2ng