# Hard-disk util% got higher on enabling aio for nginx-1.2.1

**URL:** <https://www.ruby-forum.com/t/hard-disk-util-got-higher-on-enabling-aio-for-nginx-1-2-1/229464>\
**Category:** NGINX\
**Created:** [February 4, 2013, 6:39pm UTC](https://www.ruby-forum.com/t/hard-disk-util-got-higher-on-enabling-aio-for-nginx-1-2-1/229464 "2013-02-04T18:39:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahzaib12](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@shahzaib12](https://www.ruby-forum.com/u/shahzaib12)\
**Post date:** [February 4, 2013, 6:39pm UTC](https://www.ruby-forum.com/t/hard-disk-util-got-higher-on-enabling-aio-for-nginx-1-2-1/229464/1 "2013-02-04T18:39:29Z")

</div>

Hello,

```
     I followed this post

```

> <https://stackoverflow.com/questions/11250798/best-file-system-for-serving-1gb-files-using-nginx-under-moderate-write-read-p>

to optimize nginx for large static files i.e (flv,mp4) and enabled aio  
on  
nginx config which you can see below, and after enabling aio, directio,  
and  
output\_buffers, i could notice(iostat -x -d 3) that cpu util% got higher  
from 10.00 to 35.00 and svctime got reduced to 1.00 from 4.00. So i came  
to  
the conclusion that after enabling these directives , the i/o util%  
starts  
getting higher and svctime start getting reduced.

1.Can someone guide me if aio directive helps improving nginx flv  
stream,  
if yes than why it is utilizing too much hard-disk?  
2. Reducing the svctime(iostat -x -d 3) for i/o is a good thing or not ?

http {  
include mime.types;  
default\_type application/octet-stream;  
client\_body\_buffer\_size 128K;  
sendfile\_max\_chunk 128k;  
access\_log off;  
sendfile off;  
client\_header\_timeout 3m;  
client\_body\_timeout 3m;

server {  
listen 80;  
server\_name [domain.com](http://domain.com);  
client\_max\_body\_size 800m;  
limit\_rate 100k;

```
    location / {
        root /var/www/html/content;
        index index.html index.htm index.php;

```

}  
location ~ .(flv|jpeg|jpg)$ {  
flv;  
root /var/www/html/content;  
aio on;  
directio 512;  
output\_buffers 1 8m;  
expires 15d;  
valid\_referers none blocked [domain.com](http://domain.com);  
if ($invalid\_referer) {  
return 403;  
}  
}

Best Regards.

---

<div class="post-metadata">

**Author:** ![shahzaib12](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@shahzaib12](https://www.ruby-forum.com/u/shahzaib12)\
**Post date:** [February 5, 2013, 7:54am UTC](https://www.ruby-forum.com/t/hard-disk-util-got-higher-on-enabling-aio-for-nginx-1-2-1/229464/2 "2013-02-05T07:54:12Z")

</div>

Hello

It looks like you’r eon my spot right now.  
I learned directio is useless for large files as it set nginx to skip  
caching for anything larger than 512 Kb.  
If you have enough RAM (128MB maybe) you get to cache videos and avoid  
reading from HDD each time.  
Some other people here said aio is not ideally either at least on  
Centos,  
they said about FreeBSD but I have to google a bit on that.

I made it work using more servers, alrge one with slow HDDs for storage  
and  
fast server with SSD for caching.

So I have a setup of 1 www, 1 mysql, 2 storage, 2 edge servers and 2  
converter servers each dealing with their specific tasks.  
It works fine for 10Gbit and about 2500 users per second.

* * *

Cristian R.  
Web Developement & Electronic Publishing

======  
[Crilance.com](http://Crilance.com)

> **[Crilance Media Social Network](http://crilance.blogspot.com)**
>
> Video, audio, photo sharing platform written in php, ajax, mysql

---

<div class="post-metadata">

**Author:** ![shahzaib12](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@shahzaib12](https://www.ruby-forum.com/u/shahzaib12)\
**Post date:** [February 5, 2013, 8:15am UTC](https://www.ruby-forum.com/t/hard-disk-util-got-higher-on-enabling-aio-for-nginx-1-2-1/229464/3 "2013-02-05T08:15:50Z")

</div>

We’ve got similar setup to you, 1db server, 3 www servers (App  
clustering),  
5 content servers(nginx-1.2.1) for static content i.e (jpg,flv,mp4) but  
we  
don’t have a separate conversion server, conversion and streaming is  
served  
by these 5 content servers and we’ve 32Gb Ram with Raid10 Sas drives and  
1Gbps port for each of the content server and also got one large content  
storage server with slow HDD i.e software Raid.

Please keep in mind that all the servers are using linux(centos-6).

1. So should i disable aio for centos 6 ?
2. What about sendfile, should i keep it off for all content servers?
3. Can i enable aio for storage server ?

Best Regards.
