# Optimzing hard drive IO for proxy\_pass

**URL:** <https://www.ruby-forum.com/t/optimzing-hard-drive-io-for-proxy-pass/242789>\
**Category:** NGINX\
**Created:** [July 26, 2015, 5:30pm UTC](https://www.ruby-forum.com/t/optimzing-hard-drive-io-for-proxy-pass/242789 "2015-07-26T17:30:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [July 26, 2015, 5:30pm UTC](https://www.ruby-forum.com/t/optimzing-hard-drive-io-for-proxy-pass/242789/1 "2015-07-26T17:30:21Z")

</div>

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/](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.

---

<div class="post-metadata">

**Author:** ![highclass99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f05b48/32.png) [@highclass99](https://www.ruby-forum.com/u/highclass99)\
**Post date:** [July 26, 2015, 5:32pm UTC](https://www.ruby-forum.com/t/optimzing-hard-drive-io-for-proxy-pass/242789/2 "2015-07-26T17:32:07Z")

</div>

Sorry everyone about the multiple posts with the same content…  
My own posts weren’t coming to me at all through email…  
I just checked  
[http://mailman.nginx.org/pipermail/nginx/2015-July/thread.html](http://mailman.nginx.org/pipermail/nginx/2015-July/thread.html)  
and found out all my posts were posted.

Again I apologize for the inconvenience.

☹

It was sincerely a mistake.
