[winswitch] very high CPU use of xpra

Antoine Martin antoine at nagafix.co.uk
Sun Sep 8 13:06:53 BST 2013


On 07/09/13 15:14, Thomas Koch wrote:
> Hi,
>
> xpra uses a lot of CPU resources on my virtual server, running the xpra debian package 0.10.1+dfsg-1 rebuilt
>  against Wheezy stable. Xpra spawns 10 child threads (processes?) when one program (like firefox) is running.
The Xpra *server* spawns 6+ threads on top of the main thread:
* 4 for networking, 2 in and 2 out: one for IO and one for
(de)compression/parsing or formatting - *for each client connected*.
* one for encoding pixel data (x264, png, etc)
* one for background performance calculations (only if encoding is in use)
* gstreamer will create a few threads of its own to handle sound (if
enabled)

Since the main thread handles the UI, it is therefore active at least
when the UI is (and more), all the other threads operate as workqueues
and will not be active unless they have something to do - that is unless
there is something to compress or send/receive, etc.
What is less obvious is that even when there is no sound being played,
we still get sound data from pulseaudio and route it compressed to the
client, which also uses up resources (again, only if enabled).

> Three of the child threads seem to run a loop at full steam and consume each around 10% of CPU resources
> (see below).
"loop at full steam [...] 10% of CPU" - those two statements contradict
each other.

>  Also the pulseaudio process consumes around 10%. 
Then turn sound off? Or complain to pulseaudio? Not much *we* can do.

> Is there anything I can do to further
> investigate this or are you aware of this problem.
Those are probably the sound threads. If so, turn off sound and they
will disappear completely.

Note: firefox also has some little widgets that are constantly spinning
and causing screen updates, it could be that too or at least making it
worse.
If the window is not shown (ie: minimized) then those screen updates
will also stop causing CPU and network load since they will not be
forwarded to the client.

> (snip)

Cheers
Antoine



More information about the shifter-users mailing list