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
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
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?
On Monday 28 January 2013 10:53:52 Cristian R. 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
It seems, and you have almost all the data read directly from drive,
which is resulted in 100% disk utilization.
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.
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.
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 R.
Web Developement & Electronic Publishing