Nginx Serving Static Files Way Too Slowly
Solution 1:
You can increase nginx performance, just adding next options to config:
http {
open_file_cache max=1000 inactive=300s;
open_file_cache_valid 360s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
}
Solution 2:
Your nginx is actually serving files at a reasonable rate. From an external machine, I was able to get 371 requests per second with ab
on one of the CSS files on that page.
You are testing the whole page, which means you're making 22 requests on it. I was able to get around 40 requests per second when benching http://journal.streamlister.com/news/
.
It could probably be faster, but you're on a VPS where you're sharing CPU and disk I/O with others.
Solution 3:
I would have to agree with gekkz that it might be your VPS. I just did an ab test on one of my static files and got:
Total transferred: 11203000 bytes
HTML transferred: 10861000 bytes
Requests per second: 674.14 [#/sec] (mean)
Time per request: 14.834 [ms] (mean)
Time per request: 1.483 [ms] (mean, across all concurrent requests)
Transfer rate: 7375.39 [Kbytes/sec] received
this was a css file. I'm also on a VPS from linode.com. A recent blog post of theirs shows some tests done on various VPSs that might be of interest.
I just looked and my config file is only a little different. I have 2 procs setup, 1024 connections and I have keep_alive turned on.
Solution 4:
Your test parameters are the problem I think. With a max concurrency of 10, but each page taking ~500 ms total to deliver, you will see at most about 20 requests per second.
Have you tested with higher concurrency levels using ab? (Note that ab is a really simplistic tool for load testing a web application, and can only really be considered a "microbenchmark"). You should also be benchmarking from a different machine of course, perhaps more than one other machine if bandwidth or memory are an issue.