Welcome! Log In Create A New Profile


MP4 Streaming Module with AIO - high IO

Posted by SaQo 
MP4 Streaming Module with AIO - high IO
November 24, 2012 09:46AM
Hey guys,

at the moment I operate with a dedicated server which is serving many video streams (using NGINX 1.2.5 with MP4 module compiled).

The Server uses 4x 2 TB SATA3 Hard Drives with a RAID Controller, configured as RAID0 for maximum speed and space.

Usually, I have no problems, but when my network output speed reaches about 120mb/s and more, the server gets a high load average of 8.0 and this is still raising.

This is not caused by any process, like nginx, php or other. The average process load reaches on this load maximal 10%. Rather, I installed iotop and checked the I/O of my server.

NGINX uses up to 99 % of the IO and this leads to the server gets in a freezed / slow mode.

I searched the MP4 Module source code and found that the read of the MP4 File is done in the function ngx_http_mp4_read by calling
n = ngx_read_file(&mp4->file, mp4->buffer_start, mp4->buffer_size, mp4->offset); on line 909.

This uses the normal read() function of the system. Why are you not using AIO for this procedure ?

Like: n = ngx_file_aio_read(&mp4->file, mp4->buffer_start, mp4->buffer_size, mp4->offset, mp4->request->pool);

Or is there any reason why this is not implented ?

Also: have you some ideas to fix my high I/O problem ?

Thank you.
Re: MP4 Streaming Module with AIO - high IO
February 13, 2013 02:19AM
I am also interested in a solution for lowering IO if possible.
Let me know if there's any...
Re: MP4 Streaming Module with AIO - high IO
February 19, 2013 09:03PM
debian system


ulimit -SHn 65535
blockdev --setra 2048 /dev/sda
echo 2048 > /sys/block/sda/queue/nr_requests
echo deadline > /sys/block/sda/queue/scheduler
echo 0 > /sys/block/sda/queue/iosched/front_merges
echo 150 > /sys/block/sda/queue/iosched/read_expire
echo 1500 > /sys/block/sda/queue/iosched/write_expire
exit 0

The hope can help you! toadzhou@gmail.com
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 121
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready