性能测试 Apache 与 NodeJs
我目前正在测试 Node.js 和 Apache 之间的性能。
我想证明的是:
- Apache 速度较慢,因为它比使用单线程事件循环的 Node.js 需要更多的线程切换。
- 与使用 epoll 的 Node.js 相比,Apache 需要更多的 RAM/连接。
这意味着,我想要测试的是:
- 每个 CPU 的请求数/秒
- 每个 RAM 的连接数
好吧,这就是我想要做的!但问题是我应该怎么做? 对于请求/第二次测试,我可以只使用 Apache Benchmark (ab)(但是 ab 甚至适合 Node.js 吗?) 最大的问题是:如何测试连接/RAM?
I'm currently testing the performance between Node.js and Apache.
What I want to prove is:
- Apache is slower because it needs a lot more Thread-switches than Node.js which uses a single threaded Event-Loop.
- Apache needs a lot more RAM / Connection in comparison with Node.js which uses epoll.
That means, that what I want to test is:
- Requests/Second per CPU
- Connections per RAM
Ok that's what I want to do! But the question is HOW I should do this?
For the Request/second-Test I could just use the Apache Benchmark (ab) (But is ab even suitable for Node.js?)
And the biggest question is: How can I test the Connections/RAM?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“我要证明”在做基准测试时是一种非常错误的态度。您没有证明任何事情,而是衡量实际表现。您可能会对结果感到惊讶,也可能不会,但您确实必须从“让我们看看这个东西能做什么”开始。
显然,顺便说一句,从我见过的所有基准测试来看,节点在原始速度方面首先出现,但使用的内存比 apache 更多,所以这就是你的“证明”。
"I want to prove" is a very wrong attitude when doing bench-marking. You are not proving anything, you measuring the actual performance. You might or might not be surprised by the outcome, but you really have to start with the "Let's see what this thing can do".
Apparently btw, from all the benchmarks I've seen, node comes up first in terms of raw speed but uses MORE memory then apache, so there goes your 'proof'.
连接数/秒:我最近使用一个简单的“hello world”node.js 服务器进行了此测试,每个 CPU 核心每秒收到约 9,000 个请求。 (顺便说一句,使用 ab。在 2.5GHz、四核、Xeon Linux 机器上进行测试)。
每个 RAM 的连接数:这里有两个您关心的#。基线内存(无连接时所需的内存)和每个连接的内存。我在 Mac Pro 上测试了这一点,方法是启动一个保持 HTTP 连接打开的简单服务器/客户端。我运行“top”命令来观察内存使用情况。在零连接时,节点的 RSIZE 为 14MB。然后,随着客户端运行并保持 2000 个并发连接打开,RSIZE 增长到 24MB。所以~5MB/1000 个连接。
当您获得 Node 和 Apache 的 # 时,您可以将它们发布到此处吗?我也很好奇。
Connections/second: I did this test recently with a simple "hello world" node.js server, and got ~9,000 requests/second per CPU core. (Using ab, btw. Testing on a 2.5GHz, quad-core, Xeon linux box).
Connections per RAM: There's two #'s here you care about. Baseline memory (memory required with no connections), and memory per connection. I tested this on my Mac Pro by spinning up a simple server/client that hold HTTP connections open. I ran the 'top' command to watch memory usage. At zero connections, node had a 14MB RSIZE. Then, with the client running and holding 2000 concurrent connections open, RSIZE grew to 24MB. So ~5MB/1000 connections.
When you get #'s for Node and Apache can you post them here? I'm curious as well.