2

I did a test with ab -n 10000 -c 1000 against node.js with different configurations, each returning the string Hello World!. Results seems odd to me.

X axis is the number of requests, y is the response time in milliseconds.

  • Node is the server alone
  • Node (cluster) is a server using the cluster module (two cores)
  • Nginx (balancer) is acting as a balancer in front of (two) node instances running the same code

The first thing is nginx is too slow as balancer, it has the worst result among the three. It's better than node alone only until 1000 requests (but slower than cluster). Another strange thing is that node alone has a constant response time until ~7000 (?). Starting from ~7000 requests, the cluster has a response time greater than node, and this seems too odd.

How would you interpret these results? Am I'm doing it wrong (bench or plotting errors)?

Plotted ab results

ApacheBench 2.3 (1430300), Node.js 0.10.5, nginx 1.4.1. Running on Xubuntu 13.04 x64.

1
  • could you paste the output of ab itself as well. Just out of curiosity. Many thanks.
    – Maziyar
    Jan 16, 2014 at 14:39

1 Answer 1

1

It is a matter of interpretation. You are not doing anything wrong. Here is how i interpret the graph. It is a distribution plot of x vs y where :

  • y is the response time in ms,
  • x is the number of requests returned within y ms cumulatively.

Statements based on distribution of request for node(alone) would be :

  • 7000 of 10000 requests were returned within ~14 ms
  • 2000 of remaining 3000 requests were returned within 14-18 ms
  • 800 of remaining 1000 requests were returned within 18-22 ms
  • Remaining 200 were returned within 35 ms

But when analysing cumulatively it would be :

  • 7000 of 10000 requests were returned within 14 ms
  • 9000 of 10000 requests were returned within 18 ms
  • 9800 of 10000 requests were returned within 22 ms
  • All were returned within 35 ms

Cluster configuration will show faster results than single node as expected.

For the nginx results there will be a fixed amount of delay in processing/load balancing. Looking at the figure it would be about 9-10 ms delay, which is as expected. This does not mean that nginx configuration is a bad performer. It does returns most requests within 30 ms (small difference from other configurations).

You gave concurrent requests as 1000 in Apache Bench, which does not require much load balancing to do as even single node is handling that much load easily. Giving more concurrent connections/heavier processing per request will blow up the graph for single node(it will rise early for lesser number of requests). Nginx sacrifices small processing time to allow more concurrent requests to be handled while still keeping response time reasonable.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .