Optimzing hard drive IO for proxy_pass

highclass99 highclass99 at gmail.com
Sun Jul 26 15:29:51 UTC 2015


I have server A with a large HDD at IDC 1 (TB hdd)
I have server B with cheap bandwidth at IDC 2 (very small virtual server 20
GB hdd)

I send all image requests to server B, and it caches from A.
My problem is that on server IO is really high

Server B iostat
Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz
avgqu-sz   await  svctm  %util
sda              34.01   517.21 1263.36 76.72 19922.27  4751.42    18.41
  2.95    2.20   0.36  47.67
sda1              0.00     0.00  0.00  0.00     0.00     0.00     0.00
0.00    0.00   0.00   0.00
sda2             34.01   517.21 1263.36 76.72 19922.27  4751.42    18.41
  2.95    2.20   0.36  47.67
dm-0              0.00     0.00 1297.37 593.93 19922.27  4751.42    13.05
  8.78    4.64   0.25  47.71
dm-1              0.00     0.00  0.00  0.00     0.00     0.00     0.00
0.00    0.00   0.00   0.00

Here is my related nginx config
--------------- cut --------------------------------------
        proxy_cache_path /cache levels=1:2
                                        keys_zone=MEDIA:200m
                                        inactive=2d max_size=6g;
--------------- cut --------------------------------------
        location / {
            proxy_pass http://SERVER_A <http://server_a/>
            proxy_cache MEDIA;
            proxy_cache_key "$scheme$request_uri";

            proxy_cache_valid  200 302 304 7d;
            proxy_cache_valid  301 1h;
            proxy_cache_valid  any 1m;
            proxy_cache_use_stale error timeout invalid_header http_500
http_502 http_503 http_504 http_404 updating;
                        proxy_ignore_headers Cache-Control Expires
Set-Cookie;
                        proxy_cache_min_uses 3;
                        proxy_cache_revalidate on;
                        proxy_cache_lock on;
                        proxy_cache_lock_timeout 15s;

            expires 7d;
        }
--------------- cut --------------------------------------

Server B has nothing else running.
Server B is sending about 200~400 MBs traffic outside
Is such a high IO load normal?
Is there a way I can decrease the IO load while keeping the caching of
server B efficient?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150727/371d46ec/attachment.html>


More information about the nginx mailing list