1

I am trying to measure perfornace on nginx with ab. Doing the same ab from the local machine gives me about 10 times the requests per second as from a remote machine that is located on the same network.

Local results:
Server Software:        nginx
Server Hostname:        192.168.0.116
Server Port:            8000

Document Path:          /data/adpix/picture/test.jpg
Document Length:        4602 bytes

Concurrency Level:      1000
Time taken for tests:   1.475 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      49854651 bytes
HTML transferred:       46622862 bytes
Requests per second:    6778.38 [#/sec] (mean)
Time per request:       147.528 [ms] (mean)
Time per request:       0.148 [ms] (mean, across all concurrent requests)
Transfer rate:          33001.34 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       25   67  24.4     66     137
Processing:    28   73  24.9     71     146
Waiting:       13   42  19.7     40     110
Total:         75  140  17.9    139     182

And now from a remote machine:

Server Software:        nginx
Server Hostname:        192.168.0.116
Server Port:            80

Document Path:          /data/adpix/picture/test.jpg
Document Length:        4602 bytes

Concurrency Level:      1000
Time taken for tests:   14.422 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      51737663 bytes
HTML transferred:       48380826 bytes
Requests per second:    693.40 [#/sec] (mean)
Time per request:       1442.165 [ms] (mean)
Time per request:       1.442 [ms] (mean, across all concurrent requests)
Transfer rate:          3503.42 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       68  230 182.7    166    3052
Processing:   110 1113 2918.5    227   11862
Waiting:       20  648 2101.1    189   11451
Total:        246 1344 2898.0    387   11981

The problem seems to be within the connection times.

Network ist fast. Netperf returns 80 Mb/s Both machines are VM hosted on 2 different physical machines running quad cores. connected via gigabit switch.

Has anybody an idea what could be the problem?

Thank you for any help.

Prix
  • 4,703
  • 3
  • 23
  • 25
merlin
  • 2,033
  • 11
  • 37
  • 72
  • Next time please post the exact command used to run the test. Did you used the -k (keep-alive) switch? Opening and closing a network connection for each request takes a lot of time. Look [here](http://forum.gwan.com/index.php?p=/discussion/525/webserver-scalability-varnish-nginx-lighttpd-g-wan-rpscpuram) form something similar. –  Mar 03 '12 at 00:13

1 Answers1

2

It seems perfectly normal, just due to packet switching times and the speed of light in fiber. What makes you think 1.442ms is "slow"?

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
  • The amount of requests/s is just about 693 while ffrom the same machine I get 10 times the amount. I would like to benchmark nginx against apache and with this kind of test setup I get no differences. – merlin Feb 21 '12 at 03:31
  • 1
    You're going to have to get the machine under load to see a difference. You're testing without the machine even breaking a sweat, so all you're seeing is the network latency. – David Schwartz Feb 21 '12 at 04:01
  • So how do I manage to find out how many requests / s the webserver can handle? If I test with ab from the same machine, then I will put aditional cpu load on the same server where nginx is running on. – merlin Feb 21 '12 at 10:13
  • It depends what you really want to measure. For example, does it matter if the web server can handle more requests than the network can feed it? (And, of course, how could you measure?) – David Schwartz Feb 21 '12 at 10:17
  • Good point. Basically I want to measure if nginx is faster than apache in serving static files and how much the difference is. Then I would also like to optimize the settings of nginx. This is the only goal of the benchmark with ab. – merlin Feb 21 '12 at 13:33
  • 1
    Then so long as the cost of `ab` is constant across tests (which it should be) you should be able to run the test locally. Note that tuning for best performance in this test may or may not optimize real-world performance over the network. – David Schwartz Feb 21 '12 at 15:57
  • Sounds logical. Htop reports one core out of four with 100% the other 3 cores seem to be used by the webserver. Thank you for your help. – merlin Feb 21 '12 at 18:09