node.js Socket.io:WebSockets 可以处理多少个并发连接?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5695107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Socket.io: How many concurrent connections can WebSockets handle?
提问by Pono
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?
我想知道您是否有关于与 websockets 的并发连接的任何数据?我在 Node.js 服务器上使用 Socket.io。有多少客户端可以连接到套接字并接收数据而不会关闭我的服务器?1000?1000.0000?
Thanks!
谢谢!
采纳答案by yojimbo87
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.
这在很大程度上取决于您的硬件配置、您在服务器端到底在做什么/处理以及您的系统是否针对许多并发连接进行了优化。例如,在 Linux 机器上,默认情况下,在遇到硬件资源耗尽或类似的可扩展性问题之前,您可能会首先达到打开文件的最大数量或其他限制(可以增加)。关键资源可能是您的 node.js 程序可以分配的 RAM 量,以保持并发连接打开和接收新连接的能力。
回答by 3s2ng
http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/
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.
检查此博客。我们使用相同的原则。以前我们的 nodejs 服务器会因为硬件限制在 100 个并发连接后崩溃。但是在我们迁移到 Amazon EC2 之后,它现在具有高度的可扩展性。

