nginx large static file serving slow on AWS EBS-backed server


I’m trying to figure out the correct tuning for nginx on an AWS server that is wholly backed by EBS. The basic issue is that when downloading a ~100MB static file, I’m seeing consistent download rates of ~60K/s. If I use scp to copy the same file from the AWS server, I’m seeing rates of ~1MB/s. (So, I’m not sure EBS even comes into play here).

Initially, I was running nginx with basically the out-of-the-box configuration (for CentOS 6.x). But in an attempt to speed things up, I’ve played around with various tuning parameters to no avail — the speed has remained basically the same.

Here is the relevant fragment from my config as it stands at this moment:

Initially, these tuning settings were:

Note, I’m not trying to optimize for a large amount of traffic. There is likely only a single client ever downloading at any given time. The AWS server is a ‘micro’ instance with 617MB of memory. Regardless, the fact that scp can download at ~1MB/s leads me to believe that HTTP should be able to match or beat that throughput.

Any help is appreciated.

Additional information. Running a ‘top’ command while a download is running, I get:

and ‘iostat’ shows:


Have you considered turning sendfile on? Sendfile allows nginx to use the kernel directly to send static files, so it should be faster than any other option.

Leave a Reply