Static file benchmarks

Cocoa Guy cocoa.guy at gmail.com
Fri Apr 18 21:53:54 MSD 2008


I've seen places online casually mention that nginx can server static
files at 13k requests/sec:
http://www.vbulletin.com/forum/showpost.php?s=bc85853b9f0f48462767c44081cf7057&p=1474904&postcount=1
http://brainspl.at/articles/2006/08/23/nginx-my-new-favorite-front-end-for-mongrel-cluster

One blog entry achieved 8K requests/sec and posted their test files
and nginx conf file:
http://superjared.com/entry/benching-lighttpd-vs-nginx-static-files/

When running nginx on Amazon's EC2 and using this same test file and
nginx conf, I'm only getting 4K requests/sec and am trying to
understand why.

In my tests both the nginx machine and the machine running Apache
Bench are on EC2 with a max speed of 20 MB/s between them. I'm using
the internal EC2 IP addresses.

The instances have 1.7 GB or RAM and the equivalent of a single 1-1.2
Ghz Xeon. The machines are running Fedora Core 4.

During the test the CPU load is a bit over 10% and used memory is
constant at 0.3 GB.

Any thoughts as to what is the bottleneck? Hardware? OS? Network?
nginx misconfiguration?

Cheers!

ab -c 1000 -n 100000 http://xxxxxx/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxxx (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Finished 100000 requests


Server Software:        nginx/0.5.35
Server Hostname:        xxxxx
Server Port:            80

Document Path:          /
Document Length:        356 bytes

Concurrency Level:      1000
Time taken for tests:   24.326633 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      56720399 bytes
HTML transferred:       35611748 bytes
Requests per second:    4110.72 [#/sec] (mean)
Time per request:       243.266 [ms] (mean)
Time per request:       0.243 [ms] (mean, across all concurrent requests)
Transfer rate:          2276.97 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0  140 842.2      2   21073
Processing:     0   68 504.6      4   13673
Waiting:        0   66 503.5      2   13671
Total:          0  209 992.7      7   21078

Percentage of the requests served within a certain time (ms)
  50%      7
  66%      8
  75%      9
  80%     33
  90%     75
  95%    765
  98%   3047
  99%   3857
 100%  21078 (longest request)

nginx conf:
worker_processes  1;
events {
    worker_connections  1024;
}

http {
    include       conf/mime.types;
    default_type  application/octet-stream;

    access_log  logs/access.log;

    sendfile        on;
    keepalive_timeout  65;

    gzip  on;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   /www/pages;
            index  index.html;
        }
    }
}





More information about the nginx mailing list