Linux – X11 forwarding over ssh applications very slow to start

gentoolinuxsshssh-tunnelx11forwarding

I have a server that is extremely slow (takes 3-5 minutes) at starting X11 applications over a forwarded X11 link. I have tried connecting to it with 2-3 different machines with different operating systems. After the applications start everything seems to be fine. I am connecting using trusted X11 forwarding (ssh -Y) and using cert based authentication (not that that should matter).

The operating system is Gentoo Linux on amd64. None of the applications give any messages related to the X environment (one shows nothing, another just a standard welcome message and the last an error message about a resource being in use (which the window that finally popped up told me about as well).

As per Bertera's suggestion I ran with the -v option. It doesn't print anything until the window shows up when it prints:

debug1: client_input_channel_open: ctype x11 rchan 3 win 87380 max 16384
debug1: client_request_x11: request from 127.0.0.1 43716
debug1: channel 1: new [x11]
debug1: confirm x11

Also, I have tested ssh port forwarding and it is extremely slow as well (and I'm guessing this could be the problem with the X11 forwarding).

Best Answer

What is the latency/RTT to the server (a simple ping would suffice)? What application you are trying to start?

X11 is a synchronous protocol, with serialized drawing call. If the latency is high or the application execute many drawing call, its load time will increase.

If you can, you should install freenx on the server and use a nx client (eg: remmina or nomachine.com client): they work by de-serializing X11 drawing calls, giving much improved performances.