SSH compression for X11 forwarding

Zearin picture Zearin · Oct 19, 2012 · Viewed 17.2k times · Source

I’m on the East coast of the United States, SSHing into a server on the West coast.

I’ve managed to get X11 forwarding working so I can launch GUI apps for certain tasks where it’s helpful. However, for all the X11-forwarded apps (especially emacs!), there is so much lag between input (keystrokes, mouse clicks, etc.) and response that it sometimes goes from being incredibly frustrating to potentially harmful—when I intend to do A, but B happens because the lag is so great.

Is SSH compression a potential culprit? What kind of compression should I be using?

Answer

padub picture padub · Oct 19, 2012

X11 graphics take up a lot of bandwidth. If your remote host is some distance away (i.e. not on the LAN), then you'll probably suffer sluggishness in your exported X11 applications.

I'm not sure about SSH compression. Performance may depend on other factors, such as CPU performance. From the ssh man page:

     -C      Requests compression of all data (including stdin, stdout,
             stderr, and data for forwarded X11 and TCP connections).  The
             compression algorithm is the same used by gzip(1), and the
             “level” can be controlled by the CompressionLevel option for pro‐
             tocol version 1.  Compression is desirable on modem lines and
             other slow connections, but will only slow down things on fast
             networks.  The default value can be set on a host-by-host basis
             in the configuration files; see the Compression option.

Here are some other workarounds you can use to make things faster:

  • Instead of interacting with the GUI using X11 forwarding, consider something else that has better optimization/compression, such as VNC or NX/FreeNX.
  • Use the terminal version of emacs instead of the GUI version.