LinHES Forums http://forum.linhes.org/ |
|
mythcommflag, mythfilldatabase causing playback jerkyness? http://forum.linhes.org/viewtopic.php?f=6&t=19126 |
Page 1 of 1 |
Author: | nmcaullay [ Mon Oct 20, 2008 7:25 pm ] |
Post subject: | mythcommflag, mythfilldatabase causing playback jerkyness? |
Hi all, I've been using R5.5 for a while now, and its been going swimmingly. Over the last few nights the playback of SD recordings has been jerky at regular intervals... seemingly every few minutes.. "top" reveals that mythtranscode is causing issues, hogging the CPU. So, I pause the commercial detection jobs using the frontend, and playback is fine. Then shortly after, mythfilldatabase cranks up, and that causes playback problems... only for a minute or two, though... through all of this 3 SD shows are being recorded, although that doesnt take much CPU, so i dont think that is causing the problems. My playback profile is set to "Slim", and it works fine most of the time. Things ive tried to fix by tweaking 1) disabled RRD. A few months ago (when installing R5.5) I had to tweak the scripts to stop regular jerky playback when RRD got motherboard/cpu temperature. That tweak worked fine at the time. I thought that the symptoms were the same, so i totally disabled it... didnt seem to make any difference. Things im contemplating trying 1) Changing the "CPU usage" setting from LOW to MEDIUM, following this post http://mysettopbox.tv/phpBB2/viewtopic.php?t=16990 2) Implementing the bigbro babysiter script variation in this post http://mysettopbox.tv/phpBB2/viewtopic.php?t=13614&postdays=0&postorder=asc&highlight=babysitter&start=15 My question is, have either of these tweaks been implemented by anyone else? Has the babysitter script been added to R5.5 anyway? I'm at work, so cant "try" anything, was sort of casting for ideas/experience before i get home. Cheers, Nathan |
Author: | nmcaullay [ Tue Oct 21, 2008 6:35 pm ] |
Post subject: | |
I've gone with option 2), and so far so good. Evertime a recording starts, the commflagging starts shortly after, and then within a minute it has been reniced to 19, which seems to not interfere with playback which is great. Have only tried it one night, with not much recording going on, but looks good so far. Nathan |
Author: | nmcaullay [ Tue Oct 21, 2008 6:41 pm ] |
Post subject: | |
Just incase anyone is interested, here is the babysit_commflag.sh that i implemented on my box (cut-n-paste from the above post). To check that is is working you can use top to see the nice values of mythcommflag/mythfilldatabase, or look at the /var/log/mythtv/babysit_commflag.log to see the processes that are being reniced... Code: #!/bin/bash
# Installation: ALL AS ROOT # cp babysit_commflag.sh /usr/local/bin # chmod +x /usr/local/bin/babysit_commflag.sh # Usage: Add to crontab (crontab -e): # * * * * * /usr/local/bin/babysit_commflag.sh >>/var/log/mythtv/babysit_commflag.log 2>&1 LIST=( mencoder ffmpeg mythtranscode mythcommflag vamps mythfilldatabase ) ps -Al|while read PROCESS; do PRIORITY=`echo $PROCESS | awk '{ print $8 }'` NAME=`echo $PROCESS | awk '{ print $14 }'` PID=`echo $PROCESS | awk '{ print $4 }'` listnum=${#LIST} for ((i=0;i<$listnum;i++));do if [ "$NAME" = "${LIST[${i}]}" ]; then if [ "$PRIORITY" -lt "19" ]; then renice 19 -p $PID fi break fi done done |
Author: | chael [ Wed Nov 26, 2008 10:39 pm ] |
Post subject: | Updated renice script runs at boot |
nmcaullay wrote: Just incase anyone is interested, here is the babysit_commflag.sh that i implemented on my box (cut-n-paste from the above post).
I ran with Nathan's version of the script a bit and came up with something that may be useful to the rest of you... First, I run it from rc.d instead of cron, so as not to fill up my system logs. Second, I made it check for new processes every 10 seconds to catch them faster. Here are the steps to install it (as root): 1. Create the script /etc/init.d/babysit-commflag: Code: #! /bin/sh ### BEGIN INIT INFO # Provides: babysit-commflag # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: 2345 # Default-Stop: 016 # Short-Description: Renice low priority tasks for better system performance ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/bin/babysit_commflag.sh NAME="babysitter" DESC="Babysitter" SHELL=/bin/bash test -x $DAEMON || exit 0 set -e USER=mythtv RUNDIR=/var/run/mythtv ARGS="" EXTRA_ARGS="" NICE=0 ARGS="$ARGS $EXTRA_ARGS" mkdir -p $RUNDIR chown -R $USER $RUNDIR case "$1" in start) echo -n "Starting $DESC: $NAME" if start-stop-daemon --quiet --stop --signal 0 --exec $SHELL $DAEMON then echo " already running." exit fi start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \ --background --make-pidfile \ --chuid $USER --nicelevel $NICE --exec $SHELL $DAEMON -- $ARGS echo "." ;; stop) echo -n "Stopping $DESC: $NAME " start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \ --chuid $USER --exec $SHELL $DAEMON -- $ARGS test -e $RUNDIR/$NAME.pid && rm $RUNDIR/$NAME.pid echo "." ;; restart|force-reload) echo -n "Restarting $DESC: $NAME" start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \ --chuid $USER --exec $SHELL $DAEMON -- $ARGS || : ignore errors echo "." sleep 3 start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \ --background --make-pidfile \ --chuid $USER --nicelevel $NICE --exec $SHELL $DAEMON -- $ARGS echo "." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 NOTE: I run the script as the user mythtv, since all of the processes I want to renice are run as mythtv on my KnoppMyth R5.5 box. If this is not the case for you, change USER=mythtv to USER=root in the script. 2. Make the script executable: Code: chmod 0755 /etc/init.d/babysit-commflag 3. Install the rc.d script: Code: update-rc.d babysit-commflag defaults 91 4. Create the script /usr/local/bin/babysit_commflag.sh: Code: #!/bin/bash # Version: 26 November 2008 # # Installation: ALL AS ROOT # cp babysit_commflag.sh /usr/local/bin # chmod +x /usr/local/bin/babysit_commflag.sh # # Usage: Executed from /etc/init.d/babysit-commflag at boot # Processes to renice # NOTE: mythfilldatabase is truncated in ps -Al output on my R5.5 system LIST=( mencoder ffmpeg mythtranscode mythcommflag vamps mythfilldatabase mythfilldatabas ) # Log file to write (change to /dev/null for no log) LOG=/var/log/mythtv/babysit_commflag.log # Number of seconds to wait between checking for processes to renice SLEEP=10 touch $LOG while true; do ps -Al|while read PROCESS; do PRIORITY=`echo $PROCESS | awk '{ print $8 }'` NAME=`echo $PROCESS | awk '{ print $14 }'` PID=`echo $PROCESS | awk '{ print $4 }'` listnum=${#LIST} for ((i=0;i<$listnum;i++));do if [ "$NAME" = "${LIST[${i}]}" ]; then if [ "$PRIORITY" -lt "19" ]; then echo -n "$NAME: " >> $LOG renice 19 -p $PID >> $LOG fi break fi done done sleep $SLEEP done 5. Make the script executable: Code: chmod 0755 /usr/local/bin/babysit_commflag.sh 6. Run it the first time: Code: /etc/rc5.d/S91babysit-commflag start Whenever it renices a process, it will write a line to /var/log/mythtv/babysit_commflag.log that looks like this: Code: mythcommflag: 15728: old priority 17, new priority 19
If you don't want a log, just change LOG=/var/log/mythtv/babysit_commflag.log to LOG=/dev/null in the script. Enjoy, Chael |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |