LinHES Forums
http://forum.linhes.org/

make mythcommflag jobs less invasive
http://forum.linhes.org/viewtopic.php?f=3&t=16352
Page 1 of 1

Author:  eweaver [ Fri Sep 07, 2007 4:57 pm ]
Post subject:  make mythcommflag jobs less invasive

If you have a low end box, things will chug along when the commercial flagger is running. KnoppMyth sets the process's cpu priority to 17 (low-priority) but does not change the io priority (disk access, etc).

To also change the io priority i did this (as root):

Code:
apt-get update
apt-get install schedutils


Now add a cronjob (also as root):

Code:
*/5 * * * * ps aux | grep commflag | grep -v grep | awk '{print $2}' | xargs -I {} -i ionice -c2 -n7 -p{}


Every five minutes the system will check for commflag jobs and make them even nicer.

Author:  mihanson [ Sun Sep 09, 2007 4:48 pm ]
Post subject: 

Are you sure this command is right? I was reading the man page on ionice and it states:

Quote:
This program sets the io scheduling class and priority for a program. As of this writing, Linux supports 3 scheduling classes:

Idle. A program running with idle io priority will only get disk time when no other program has asked for disk io for a defined grace period. The impact of idle io processes on normal system activity should be zero. This scheduling class does not take a priority argument.

Best effort. This is the default scheduling class for any process that hasn't asked for a specific io priority. Programs inherit the CPU nice setting for io priorities. This class takes a priority argument from 0-7, with lower number being higher priority. Programs running at the same best effort priority are served in a round-robin fashion.

Real time. The RT scheduling class is given first access to the disk, regardless of what else is going on in the system. Thus the RT class needs to be used with some care, as it can starve other processes. As with the best effort class, 8 priority levels are defined denoting how big a time slice a given process will receive on each scheduling window.

If no arguments or just -p is given, ionice will query the current io scheduling class and priority for that process.
Options

-c
The scheduling class. 1 for real time, 2 for best-effort, 3 for idle.
-n
The scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data.
-p
Pass in a process pid to change an already running process. If this argument is not given, ionice will run the listed program with the given parameters.


I'm thinking you want to use -c3 to give mythcommflag idle priority access? :?:

Author:  eweaver [ Sun Sep 09, 2007 5:00 pm ]
Post subject: 

Idle priority might be too aggressive; if you are recording/playing back a lot the commflag job might never get enough time to run. But it's worth a shot.

Author:  crushinator [ Sun Sep 09, 2007 6:27 pm ]
Post subject: 

This MythTV mailing list post decribes setting the "ionice" right at the moment that the mythcommflag process is launched. Does this work the same or better than the crontab approach? It seems like it would be more immediate. But do you think it would actually work?

Quote:
So, my thought was to use ionice to tell the jobs to only use idle hard disk time on MediaServer. I was effectively able to do this for MediaServer's jobs by running mythbackend as root and changing the command for transcode and commflag in mythtv-setup. They look like this...

Commflag :
Code:
ionice -c 3 mythcommflag -j %JOBID% -V %VERBOSELEVEL%

Transcode :
Code:
ionice -c 3 mythtranscode -j %JOBID% -V %VERBOSELEVEL% -p %TRANSPROFILE%


So, local commflag and transcode jobs should be using idle hard drive time only. However, nfsd (the NFS daemon) is still running at the normal ionice priority. I found out how to change the nice level of nfsd, but I can't figure out how to change the ionice level.


Also, after mihanson described "idle priority," I wonder if there is an equivalent "idle" mode for the CPU nice level? or is nice=19 for mythcommflag as good as it gets in terms of letting recordings and playback proceed uninterrupted?

Author:  eweaver [ Sun Sep 09, 2007 7:20 pm ]
Post subject: 

See this post: http://kerneltrap.org/node/11778 . There's apparently no way to completely idle a CPU job. (Note that they are also saying that the new Linux scheduler will mitigate the need for using Realtime priority threads for the front-end; this will probably affect KnoppMyth R6. It's good because I've had stability problems possibly related to real-time threads).

Setting ionice at the beginning should be pretty much the same as the cronjob unless mythcommflag is multithreaded in a weird way.

The cronjob would be an easy way to renice the nfs daemon though or whatever other boot process he wanted... otherwise you would perhaps have to mess around in /etc/init.d with whatever rc.d script starts the daemon.

Note that in that post he mentions re-nicing the jobs to higher priorities when no higher-priority tasks are running. As far as I can tell that won't accomplish anything at all.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/