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?
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.
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.
There are primarily two reasons for X11 connections to be slow, both of which you touched on in your question: bandwidth and latency.
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.
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:
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With