[mythtv-users] Mythfrontend idle cpu consumption help
stichnot at gmail.com
Mon Nov 9 05:56:00 UTC 2009
On Tue, Nov 3, 2009 at 1:34 PM, Jim Stichnoth <stichnot at gmail.com> wrote:
> I have been noticing the same kind of behavior since moving to 0.22,
> which I am running on 3 IONITX frontends (one of which is also a slave
> backend). After booting up, the frontend consumes about 2% CPU
> displaying the main menu, which is fine. Over the next few days, this
> CPU usage gradually increases, until it's at around 10%. When it gets
> to 10%, the response time gets much worse. For example, from the main
> menu, selecting Watch Recordings may pause for 4-5 seconds while still
> displaying the main menu, then it displays a blank Recordings page for
> another 5+ seconds, and finally displays the recordings. The same
> sluggish performance happens for MythVideo as well.
> When it reaches this funk, restarting the frontend doesn't help. It
> comes back up consuming 10% CPU like before. I haven't found anything
> other than rebooting to get the zippy performance back. (Makes me
> feel like it's a Windows machine!)
> Any ideas for explaining this behavior?
[Responding to my own post.]
I again used the Intel VTune performance analyzer to have a look, when
the overall performance degraded after the machine was up a few days.
All the time was being spent in the sunrpc module, particularly the
rpcauth_lookup_credcache and generic_match functions. A web search
shows that this is a known NFS problem in the 2.6.27 kernel, which
what I'm using (MythDora 10.21).
My frontends are diskless NFS clients, so I guess this makes sense,
and may even explain why the problem gets worse over time and
restarting the frontend doesn't help.
Then I used "strace" to see what files are being accessed. Turns out
it's all a stat64 of /etc/localtime, about 70 times per second. I
don't know if this is something Myth is doing directly, or indirectly
through Qt. But if I set the TZ environment variable to the correct
value (in my case, 'America/Los_Angeles') and restart the frontend,
the performance problem mostly goes away. Running VTune again to
monitor the "idle" main menu shows mostly stuff related to the 70Hz
Pulse loop which I pointed out previously.
So setting the TZ environment variable to the appropriate value before
starting the frontend may be another thing to try for people seeing
sluggish UI performance *and* an unexpectedly high CPU usage when
sitting at the main menu.
More information about the mythtv-users