[mythtv-users] Software RAID and ionice

Richard Freeman r-mythtv at thefreemanclan.net
Sat May 26 11:19:40 UTC 2007


Craig Huff wrote:
> Richard,
> 
> I have been seeing IOBOUND errors on my system, so I would be
> interested in learning about ionice and how you used it (before you
> upgraded to a RAID array).
> 

I'll assume you're familiar with nice - which changes the execution 
priority for a process.  However, it has the limitation that it really 
only affects CPU-time, and if there is contention for the disk all 
processes get treated approximately equally.

Newer kernels support the CFQ IO scheduler (which needs to be enabled - 
check /sys/block/hda/queue/scheduler (or whatever device you're writing 
to) to see what scheduler is in use.  The default can be changed in your 
kernel config at compile time, and you can also write "cfq" into that 
file to change the setting (assuming your kernel has support for cfq 
built in).

Once CFQ is enabled the kernel will start paying attention to ionice 
values.  You need to obtain ionice - such as from:
http://rlove.org/schedutils/
Your distribution might have it in a package, for gentoo it is in 
schedutils.

Then you need to add ionice to whatever script starts mythbackend to 
make use of it.  Ionice has a number of niceness levels and three 
classes (realtime, best-effort, and idle) - in general processes in a 
higher class completely dominate processes in a lower class - the 
default is best-effort.

Here is what I've done:

1.  Add this to the init.d script that launches mythbackend - to the 
start of the line that launches mythbackend:
ionice -c 1 -n 3 nice -n -10

2.  Add this to the start of the mythtv-setup commercial flagger command 
and transcoder command settings:
ionice -n 7 nice -n 20

Then, in general if I'm doing really io-intensive operations on my myth 
backend I run programs using ionice -c 3 - that puts them in the idle class.

Oh, one limitation of ionice is that you can only change the class 
(real/best/idle) if you're root - that is why I don't drop the class on 
my myth background jobs - my mythbackend doesn't run as root, so it 
can't spawn idle-class jobs.  Since my init.d script runs as root I can 
put mythbackend itself into the realtime class.

That's all there is to it (I think).  Not a whole lot can go wrong other 
than just making myth or its jobs not start at all if you have a typo in 
your syntax.


More information about the mythtv-users mailing list