Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance Testing Apache vs NodeJs

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:

  1. Requests/Second per CPU
  2. 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?

like image 532
user572715 Avatar asked Jan 12 '11 12:01

user572715


2 Answers

"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'.

like image 137
Vitaly Kushner Avatar answered Oct 06 '22 00:10

Vitaly Kushner


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.

like image 42
broofa Avatar answered Oct 06 '22 01:10

broofa