There's a huge latency when I try to connect to our server (Ubuntu server through SSH from a client PC (windows 7 + putty: 192.168.53.X) in a LAN. It takes like a minute for the password prompt to show up. There's also a huge latency when I try to connect to the mySQL database running on the same server. This server is also running SAMBA but this is running very smooth.

Here you can find our network diagram: link text

Any help would be appreciated.


edit here /etc/ssh/sshd_config and change or add UseDNS no

After that restart service ssh demon

then tray again if problem is some

Tray to change or add /etc/ssh/ssh_config in the host * section

CheckHostIP no

  • Thanks, UseDNS no fixed the SSH problem! But i'm still having latency problems when connecting to the mySQL server or when I use remote desktop (VNC), any idea? Dec 1 '10 at 13:20

mysql service should be started with --skip-name-resolve or you can set the option in /etc/mysql/my.cnf. For ssh you should make sure UseDNS is set to "no" in /etc/ssh/sshd_config

  • skip-name-resolve was allready in my.cnf could it be something else? Dec 1 '10 at 13:51
  • any ipv4 address conflicts on that lan segment?
    – user237419
    Dec 1 '10 at 14:29
  • No, but the ip of our server is changed. Before it was because it was on another network. Now it is I've allready changed the bind-addres to this ip in my.cnf but this makes no difference Dec 1 '10 at 14:39
  • any entries in the hosts_allow/deny file on the server that could trigger a resolve process? if negative, i suppose you already checked the icmp response times between hosts and they look ok? arping is also a good tool on lan
    – user237419
    Dec 1 '10 at 14:58
  • hosts_deny and hosts_allow are commented out. I can also ping to the server from any client. Dec 1 '10 at 15:37

I have been able to reduce latency to my ubuntu server with the following:

# echo 1 > /proc/sys/net/ipv4/tcp_low_latency
# echo 1 > /proc/sys/net/ipv4/tcp_sack
# echo 1 > /proc/sys/net/ipv4/tcp_timestamps
# echo 1 > /proc/sys/net/ipv4/tcp_window_scaling

or like this if you want it to stick across reboots:

# echo 'net.ipv4.tcp_low_latency = 1' >> /etc/sysctl.conf
# echo 'net.ipv4.tcp_window_scaling = 1' >> /etc/sysctl.conf
# echo 'net.ipv4.tcp_timestamps = 1' >> /etc/sysctl.conf
# echo 'net.ipv4.tcp_sack = 1' >> /etc/sysctl.conf

RTT on ping went from average of a couple hundred ms (max was sometimes over 1000 ms) down to 1 to 2 ms.

  • 1
    These are useful options, but it's important to understand what they do, and whether or not they'll help, before messing with them. (In this case as seen in the accepted answer the problem wasn't network stack latency, it was slow DNS lookups.)
    – voretaq7
    Nov 16 '12 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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