Nginx large static file running slower on an AWS EBS-enabled server

I am trying to figure out the correct configuration for nginx on an AWS server fully supported by EBS. The main problem is that when loading a static file of 100 MB in size, I observe consistent download speeds of ~ 60 K / s. If I use scp to copy the same file from the AWS server, I see a speed of ~ 1 MB / s. (So, I'm not sure if EBS even comes into play here).

Initially, I started nginx mainly from a ready-made configuration (for CentOS 6.x). But, trying to speed up the work, I played with various settings to no avail - the speed remained basically the same.

Here is the corresponding snippet from my configuration, as it stands at the moment:

location /download {
    root /var/www/yada/update;
    disable_symlinks off;
    autoindex  on;

    # Transfer tuning follows
    aio        on;
    directio   4m;
    output_buffers 1 128k;
}

Initially, these settings were as follows:

sendfile       on;
tcp_nopush     on;
tcp_nodelay    on;

, . , - . AWS - "" 617 . , scp ~ 1 /, , HTTP .

.

[] . "top" , :

top - 07:37:33 up 11 days,  1:56,  1 user,  load average: 0.00, 0.01, 0.05
Tasks:  63 total,   1 running,  62 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

'iostat' :

Linux 3.2.38-5.48.amzn1.x86_64      04/03/2013  _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.02    0.00    0.03    0.03    0.02   99.89

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
xvdap1            0.23         2.66         8.59    2544324    8224920
+5
3

sendfile? Sendfile nginx ​​ , .

+3

scp , HTTP-. . , S3 . . - .

+2

Given that everything works well on the same machine, you get throttling. First check your usage policy with AWS, possibly in small print. Also, try different ISPs. If they all give you 60 kB / s, you know this AWS.

0
source

All Articles