问题描述
我是node.js的新用户。我测试socket.io的实时消息。我喜欢它,我想使用。我有一个问题。 Node.js服务器中可以运行多少并发?我们的程序将是大约100个并发。所以,我很担心。
I'm new in node.js. I'm testing socket.io for real time messaging. I love it and I want to use. I have a question. How many concurrency can run in Node.js server ? Our program will be approximately 100 concurrency. So, I'm worry about that.
我发现了另一个实时消息服务器APE。哪一个更好 ?我喜欢node.js,因为它很容易学习和容易写。但是我找不到关于node.js服务器中并发性的讨论。我的朋友公司使用APE,它可以控制大约2000年。所以,我想知道node.js服务器。
I found another real time messaging server , APE. Which one is better ? I love node.js because it's easy to learn and easy to write. But I couldn't find discussion about concurrency in node.js server. My friend company is using APE and it can control around 2000. So, I want to know about node.js server.
推荐答案
没有任何基准来支持这一点 - 既然都是事件驱动的(即在Linux上的epoll),我想象你会看到类似的结果(至少10K并发用户)。话虽这么说,性能可能会受到更多的影响的消息的频率比并发连接的数量,因为这是实现真正不同的地方。
Without having any benchmarks to back this up--since both are event-driven (i.e. epoll on Linux), I would imagine that you'll see comparable results for both (at least 10K concurrent users). That being said, performance is likely to be much more affected by the frequency of messages than the number of concurrent connections, since that's where the implementations really differ.
-world示例和关于node.js Comet性能的讨论,请参阅Amir Salihefendic的优秀博文:(您可以按照该帖子中的链接,查看其他很棒的帖子)。
For a real-world example and discussion about node.js Comet performance, see Amir Salihefendic's excellent blog post here: http://amix.dk/blog/post/19577 (you can follow the links in that post to other posts that are fantastic as well).
请注意,他写的一个版本是在C中使用libevent(epoll),这也是APE使用。另外,请注意,APE的网站声称它可以处理超过100,000个并发用户。
Notice that one of the versions he wrote was in C using libevent (epoll) which is what APE uses as well. Also, note that APE's website claims that it can handle over 100,000 concurrent users.
如果你真的想了解相关的问题,你可能会发现着名的C10K问题文章有趣(做一个谷歌搜索C10K问题)。
If you really want to understand the problems associated, you might find the famous "C10K problem" article interesting (do a google search for "C10K problem").
最后,它可能是由于你每秒预期多少请求,你有,以及你喜欢哪种语言代码。如果你只期望大约100个并发用户,我认为你会很好地使用任何平台你想要的。也就是说,我强烈推荐使用node.js - 只是为了纯粹的享受,如果没有别的。 : - )
In the end, it probably comes down to how many requests per second you expect, and how many machines you have, and which language you prefer to code in. If you're only expecting around 100 concurrent users, I think you'll be just fine using any platform you want. That being said, I highly recommend using node.js--just for sheer enjoyment if nothing else. :-)
这篇关于node.js并发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!