[mythtv-users] Mythfilldatabase during recording screws up recordings.

Douglas Peale Douglas_Peale at comcast.net
Tue Apr 5 06:36:47 UTC 2011


On 04/04/2011 07:47 PM, Douglas Peale wrote:
> On 04/04/2011 03:01 PM, Alex Butcher wrote:
>> On Mon, 4 Apr 2011, Douglas Peale wrote:
>>
>>> On 04/04/2011 01:48 PM, Alex Butcher wrote:
>>>> On Sun, 3 Apr 2011, Douglas Peale wrote:
>>>>
>>>>> Is there any way to prevent mythfilldatabase from running simultaneous to a recording? Can something be done in the scheduler to
>>>>> keep them separate?
>>>> Why not use ionice? I run mysqld, mythfrontend and mythbackend with 'ionice
>>>> -c 2' and run all the IO-heavy tasks run by MythArchive and my commflagging
>>>> wrapper script with 'ionice -c 3' so that they don't disrupt recordings or
>>>> playback.  mythfilldatabase is probably another candidate for the same
>>>> treatment, so I've just enabled that on my system.
>> [...]
>>
>>> Care to elaborate on how you implement this?
>> --- /etc/rc.d/init.d/mythbackend.fedora	2011-01-20 23:08:09.650056748 +0000
>> +++ /etc/rc.d/init.d/mythbackend	2011-02-12 20:09:09.233178903 +0000
>> @@ -36,7 +36,8 @@
>>     fi
>>     export MYTHCONFDIR="$MYTHTV_HOME"
>>     export HOME="$MYTHTV_HOME"
>> -  daemon $binary $OPTIONS
>> +  # add ionice -c 2 -n 0 AJB20110120
>> +  daemon ionice -c 2 -n 0 $binary $OPTIONS
>>     RETVAL=$?
>>     echo
>>     [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
>>
>>
>> --- /etc/rc.d/init.d/mysqld.fedora	2011-01-20 23:08:24.259515784 +0000
>> +++ /etc/rc.d/init.d/mysqld	2011-01-20 23:11:11.200950806 +0000
>> @@ -96,7 +96,8 @@
>>   	# and some users might prefer to configure logging to syslog.)
>>   	# Note: set --basedir to prevent probes that might trigger SELinux
>>   	# alarms, per bug #547485
>> -	$exec   --datadir="$datadir" --socket="$socketfile" \
>> +	# add ionice -c 2 -n 1 AJB20110120
>> +	ionice -c 2 -n 1 $exec   --datadir="$datadir" --socket="$socketfile"
>> \
>>   		--pid-file="$mypidfile" \
>>   		--basedir=/usr --user=mysql >/dev/null 2>&1 &
>>   	safe_pid=$!
>>
>> For mythfrontend, it'll depend on how you start and restart it, but
>> essentially you want to prefix it with "ionice -c 2 -n 0" like mythbackend.
>>
>>> In myth backend setup, under "General" on the Mythfilldatabase page there is a line for "mythfilldatabase program:" and a line
>>> for "mythfilldatabase arguments:", so there is no place I can alter the command line to include ionice.
>>>
>>> I suppose I could replace the mythfilldatabase.sh script with my own that calls mythfilldatabase.sh, but then I would have to
>>> figure out how to make sure my script passes the proper options to the mythfilldatabase.sh script. Risky for one with minimal
>>> script writing experience.
>> Exactly. I use this:
>>
>> #!/bin/sh
>> echo "mythfilldatabase started `date`"
>>>> /var/lib/mythtv/mythfilldatabase.log
>> echo "Parameters:" >>/var/lib/mythtv/mythfilldatabase.log
>> for i in $*
>> do
>>  	/bin/echo -n "<$i> " >>/var/lib/mythtv/mythfilldatabase.log
>> done
>> echo "User: `whoami`" >>/var/lib/mythtv/mythfilldatabase.log
>> echo "Groups: `groups`" >>/var/lib/mythtv/mythfilldatabase.log
>> echo "PWD: `pwd`" >>/var/lib/mythtv/mythfilldatabase.log
>> echo "Environment: " >>/var/lib/mythtv/mythfilldatabase.log
>> export >>/var/lib/mythtv/mythfilldatabase.log
>>
>> su -c "ionice -c 3 nice /usr/bin/mythfilldatabase $*" mythtv
>>
>> HTH,
>> Alex
>> _______________________________________________
> Thanks. I'm using Ubuntu though so I will have to do some improvising. It is unlikely I'll be able to use your changes directly.
> I think the most important is to get mysql running at idle IO class. As far as I can tell, -c 2 -n 0 is the default for processes.
>
>
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
(I replied to Rob Smiths post, but instead of going to the mailing list, it seems to have gone only to Rob Smith)

I have come to the conclusion that the only thing I should need to do is to change the ionice of mythbackend to -c 2 -n 0. Since
the default is -c 2 -n 4 (I had misread the ionice man page previously), this should make mythbackend writes higher priority
than any other user task.

Mythbackend is started by upstart. I was thinking I could edit /etc/init/mythtv-backend.conf, but then I realized that this
would get overwritten every time MythTV updated (nearly every day since I use a daily build PPA).

Any suggestions on how to make this change so it will stay changed?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20110404/865a5bc9/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
Url : http://www.mythtv.org/pipermail/mythtv-users/attachments/20110404/865a5bc9/attachment.bin 


More information about the mythtv-users mailing list