43

I ssh on remote host but terminal performance is poor. Symbols I am typing are not shown immediately, but with some delay. Sometimes two symbols are shown at one time after delay.

closed as off topic by sysadmin1138 Jul 10 '11 at 23:50

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Mosh is a good ssh replacement to prevent this issue: mosh.mit.edu – Steven C. Howell Jul 4 '15 at 1:03
  • 6
    ssh server... why was this closed? its clearly a server issue. Sure some of the answers here are opinion based, but the question should be fine. – j0h Jan 7 '16 at 13:58
  • 5
    Why is this question closed? In my case it was def server side - a closed UDP port 67/68. There was DHCP enabled on a generic Vultr image, it was trying to renew pub IP constantly, but being blocked by CSF. Allowing those ports seemed to solve it, speedy SSH (and other network services) once again. Keep an eye out for that if you use that or other default/similar VPS images. – dhaupin Aug 18 '16 at 20:32
  • 5
    This is clearly a (common) networking problem. I believe there is no reason to close it, and it is definitely not off topic. Even (particularly) when the problem can have multiple causes which are difficult to identify. – mivk Sep 3 '16 at 9:54

11 Answers 11

17

High latency is another cause of poor ssh performance. I highly recommend using mtr as a better replacement for traceroute. It should be able to give you some idea of where your network problems might occur.

13

Disabling X11 forwarding if you don't need it (ssh -x) and enabling compression (ssh -C) can also speed up your session.

9

I can think of two possible causes:

  1. Packet loss on the connection
  2. High load on the server.
3

I tried to measure network performance by soon discovered that terminal was fine. What has happened?

We have a load balancing between two Internet channels router. Sometimes it routes my ssh traffic through wan1 and sometimes through wan2. I proposed, that there is something wrong with only one channel. So I measured network performance with mtr (great tool!) for two channels separately.

yeah! wan2 has 21 hops with 110 ms and wan1 has 15 with only 21 ms! wan2 latency is the problem.

3

Use Compression and CompressionLevel of 9. That should help a little. You can configure these parameters in /etc/ssh/ssh_config. But if actual network is very poor this tricks wont do much good.

2

The most obvious cause for this behaviour is link that is either saturated or dropping packets. How many hops do you have from your workstation to the machine you are ssh'ing into? Have you analyzed a traceroute, if applicable?

2

If you are using OpenSSH on a long-fat-pipe (high bandwidth + high latency) make sure you're using at least version 4.7 on both sides because it contains fixes to make OpenSSH use a bigger tcp window size.

 * The SSH channel window size has been increased, and both ssh(1)
   sshd(8) now send window updates more aggressively. These improves
   performance on high-BDP (Bandwidth Delay Product) networks.

This can be important if you want to use the connection to its full potential because otherwise a sender may have to wait for acks before it can continue sending.

1

As already said by others, it can come from latency, loss on you network, slow server.
Sometime you see 2 characters at one type because modern TCP stack use an algorithm called Naggle.

  • 1
    Nagle's algorithm is always disabled on interactive applications like telnet & SSH – LapTop006 Jul 3 '09 at 8:22
  • 1
    You don't have enough information to say 'always'. We don't know what ssh client/server he is using. We don't know the OS he is running. etc. With some OS a kernel level setting could have impact on TCP_NODELAY set at application level. – radius Jul 3 '09 at 9:00
1

It could also be some SSH Brute Force attempt that throttles your connection. Every time my session runs slow I check the logs and in quite a number of cases someone is trying passwords like crazy.

1

Misconfigured DNS can cause this. The server will respond just fine once logged in, and upload and download files fairly fast, but SSH logins will be slow.

  • 1
    I found I can drop an IP entry in /etc/hosts for a server that has a slow SSH login and usually that speeds up the initial connection. But the real fix is to get the DNS working properly. – ServerChecker May 6 '10 at 7:55
1

One thing to look at is simply server memory. I was running an Ubuntu VM with 256Mb of memory and SSH was really sluggish. Doubling this to 512Mb solved the problem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.