SSH consumes CPU

Just a little hint that might be useful to anyone developing, optimising or generally worried about CPU usage / xruns.

If you run ssh with x-forwarding then any engines that support a GUI will attempt to display that GUI on your remote display. This will only succeed if you are running an x-server on that remote display.

This activity will increase the CPU load significantly due to the engine’s GUI consuming CPU and its updates causing ssh to consume CPU. In my experiments today using Pianoteq I observed that pianoteq ran at an average of 63% CPU usage headless but 75% with the GUI displayed and ssh-server ran at 0.2% CPU headless but 10% with the GUI displayed.

Tests run with less CPU hungry engines like zynaddsubbfx give similar percentage overhead but the gross effect is obviously lower due to the scale.

As you can see, the engine itself has ~ 20% overhead which kinda makes sense (though not desirable) but ssh really ramps up using ~500% overhead and significant amounts of the poor RPi’s resources.

X-forwarding was on for all of these tests with Zynthian GUI displayed on the remote display throughout.

All measurements done with same zynseq loop playing on RPi4 running Pianoteq 6.6.0 (Trial) with Steinway D Jazz preset. 2 Putty ssh connections and Xming x-server running on Windows 10 Professional.

There is a feature request submitted to work around this but for now, be aware of this when you are using ssh x-forwarding. The normal amongst you may never notice this (but the new normal means normal is not what it was!!!).

I don’t think we need any extra option on zynthian side.
If you do a “normal” SSH, there is no problem at all. By forwarding the X11 thru SSH you are telling zynthian to try to display the engine’s GUI. Simply don’t forward the X11 session, by not using the “-Y” or “-X” flag, or the corresponding option for Xming or other X11 server on windows/Mac.

Regards,

But you must use x-forwarding to see the Zynthian GUI which is the use case I am describing here. If a user wants to present the Zynthian GUI on their remote display, currently there is no option to disable the engines’ also displaying their GUI.

1 Like

OK! Sorry … i never considered this use case because i never used …
I will think about it …