Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH compression for X11 forwarding

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?

like image 573
Zearin Avatar asked Oct 19 '12 15:10

Zearin


People also ask

How do I enable X11 forwarding with SSH?

Go to Connection, select SSH, and then click Then, click on Browse to select the private key generated earlier If you are using key based authentication. Go to Connection, select SSH, and then click on Then, select enable X11 forwarding.

How do I make X11 forward faster?

First, you can use the compression option of OpenSSH client. With -C option, OpenSSH client will compress all data exchanged over SSH, including stdin , stdout , stderr and forwarded X11 sessions. You can also consider using less computation-heavy ciphers in SSH, so that less time is spent during encryption/decryption.

Why is X11 so slow?

There are primarily two reasons for X11 connections to be slow, both of which you touched on in your question: bandwidth and latency.

Does X11 use SSH?

SSH supports tunneling of X11 (X-Windows). This is also very useful if you want to open graphical displays from the remote machine on your local computer. To achieve this, an X11 server must be running on your local machine. The X11 connections are then tunneled and automatically encrypted by your SSH client.


2 Answers

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.
like image 104
padub Avatar answered Sep 18 '22 15:09

padub


As you specifically mentioned emacs: there is the command-line option

  -nw, --no-window-system
          Tell Emacs not to create a graphical frame.  If you  use
          this switch when invoking Emacs from an xterm(1) window,
          display is done in that window.

This can be much faster when working over ssh (as it only has to transfer character, not redraw the whole screen over X11).

like image 28
serv-inc Avatar answered Sep 20 '22 15:09

serv-inc