Forum: NGINX HDD util is 100% - aio questions

Posted by Cristian R. (cristian_r)
on 2013-01-28 07:54
(Received via mailing list)
Hello

Right now nginx manages to put hdds in the server to high util rate.

I try to run Nginx 1.2.3 with aio support to deliver mp4 videos with the
streaming module.
I compiled the server with aio and it starts fine.
In config I set it like this

    sendfile        off;
    output_buffers 1 2m;
    #sndbuf=32K;
    aio on;
    directio 512;

I read that sendfile should be off, but it won't send video unless I 
turn
it on.
In this case does aio work at all? How can I tell, before I wait a week 
and
see that maybe HDD util is not 100% all the time anymore :P
Posted by Lukas Tribus (Guest)
on 2013-01-28 10:35
(Received via mailing list)
AIO will not work with the streaming module:

http://nginx.org/en/docs/http/ngx_http_core_module.html#aio

On Linux,directiocan only be used for reading blocks that are aligned on 
512-byte boundaries (or 4K for XFS). Reading of unaligned files end is 
still made in blocking mode. The same holds true for byte range 
requests, and for FLV requests not from the beginning of a file: reading 
of unaligned data at the beginning and end of a file will be blocking. 
There is no need to turn offsendfileexplicitly as it is turned off 
automatically whendirectiois used.



What is your exact configuration? What OS do you use, what load and what 
disk and RAM configuration do you have?





________________________________
Posted by Valentin V. Bartenev (Guest)
on 2013-01-28 18:47
(Received via mailing list)
On Monday 28 January 2013 10:53:52 Cristian Rusu wrote:
> Hello
>
> Right now nginx manages to put hdds in the server to high util rate.
>
> I try to run Nginx 1.2.3 with aio support to deliver mp4 videos with the
> streaming module.
> I compiled the server with aio and it starts fine.
> In config I set it like this
[...]
>     directio 512;
>

So, you effectively switched off the page cache for any response longer
than 512 bytes.

> I read that sendfile should be off, but it won't send video unless I turn
> it on.

No, it should not for Linux.

> In this case does aio work at all? How can I tell, before I wait a week and
> see that maybe HDD util is not 100% all the time anymore :P
>

It seems, and you have almost all the data read directly from drive,
which is resulted in 100% disk utilization.

  wbr, Valentin V. Bartenev

--
http://nginx.com/support.html
http://nginx.org/en/donation.html
Posted by Cristian R. (cristian_r)
on 2013-02-02 15:59
(Received via mailing list)
I have Centos Linux with RAM 64GB, 18TB RAID 10 HDDs,
CPU and load is practically 0, everything is in HDDs that hold the 
server
back

Should I remove directio?
The server is mainly for streaming large video files or for direct 
download.

Any particular setting I shuld make to nginx in this case to lower util?

Thank you

---------------------------------------------------------------
Cristian Rusu
Web Developement & Electronic Publishing

======
Crilance.com
Crilance.blogspot.com
Posted by Lukas Tribus (Guest)
on 2013-02-03 11:58
(Received via mailing list)
Yes, remove directio and aio, and let the pagecache handle load. Monitor 
the performance and load carefully and report back the results.



________________________________
Posted by Cristian R. (cristian_r)
on 2013-02-04 08:01
(Received via mailing list)
Pagecache?

---------------------------------------------------------------
Cristian Rusu
Web Developement & Electronic Publishing

======
Crilance.com
Crilance.blogspot.com
Posted by Jonathan Matthews (Guest)
on 2013-02-04 13:34
(Received via mailing list)
On 4 February 2013 07:00, Cristian Rusu <crirus@gmail.com> wrote:
> Pagecache?

Yes, page cache. http://bit.ly/12mJ61j
Posted by Cristian R. (cristian_r)
on 2013-02-04 17:29
(Received via mailing list)
I read alreayd, pagecache is a plugin for Magento?
---------------------------------------------------------------
Cristian Rusu
Web Developement & Electronic Publishing

======
Crilance.com
Crilance.blogspot.com


On Mon, Feb 4, 2013 at 2:34 PM, Jonathan Matthews
Posted by Lukas Tribus (Guest)
on 2013-02-04 17:54
(Received via mailing list)
No, read this (first hit for page cache @Google):

http://en.wikipedia.org/wiki/Page_cache




________________________________
Posted by Jan-Philip Gehrcke (Guest)
on 2013-02-04 19:19
(Received via mailing list)
64 GB of RAM might not be sufficient for keeping a significant part of
his video data in memory. Hence, depending on the number of concurrent
users and the average size of the videos Cristian wants to stream it is
entirely possible that caching videos in memory does not help at all. In
this case, he needs proper disk I/O settings.
Posted by Lukas Tribus (Guest)
on 2013-02-04 19:29
(Received via mailing list)
Yes, I'm aware, thats why I told him to monitor the box carefully. 
However, async IO is not so easy to accomplish under linux, and since he 
is also using the streaming module, things can get complicated.

I wonder if switching to FreeBSD would be a better idea to avoid the 
linux AIO limitations (as in the nginx documentation).

Anyway, he needs to do some serious testing/thinking/spending time with 
it. Nobody will come up with the perfect configuration for him resolving 
all the issues.



----------------------------------------
Posted by Cristian R. (cristian_r)
on 2013-02-05 07:48
(Received via mailing list)
Hello

Well, we don't have a single box, we have a few setups with large slow 
HDDs
and a couple of edge servers running on 1.5TB RAID SSD for actual 
streaming.

Right now it's stable(70% max util) as we managed to write a caching 
code
so basically the slow HDDs mainly feed the edges and only a few users at
first.

The edge servers are way faster and cope with 10Gbit bandwidth so far.

I just hoped that aio is a solution for less strain in HDDs util%.

As for page cache, that is pretty useless as web-mysql boxes does just 
fine
in serving up to 2500 connections per second.

The main issue is around getting large videos in and out of HDDs fast.

---------------------------------------------------------------
Cristian Rusu
Web Developement & Electronic Publishing

======
Crilance.com
Crilance.blogspot.com
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.