I'm running a large EC2 instance with ubuntu that is basically used to provide email services (IMAP, webmail access, etc) to some people.
This server was previously hosted somewhere else but was moved to AWS because we needed a better performance, the problem is that it nevers works ok.
The usage of resources in the instance are very low (we have plenty of free RAM, disk space, minimum CPU usage, etc), nevertheless it takes a VERY long time to connect to the instance via SSH (around 2 minutes to connect). After logging in, executing 'sudo su -' takes another 2 minutes to complete. After that, I don't experience any delay working on the opened shell.
Also, making a webmail connection (I'm using Squirrelmail) is extremely slow; the same for connecting to the IMAP server.
I thought that the problem could be a DNS issue, so I've added 'UseDNS=no' in /etc/ssh/sshd_config, installed a local caching webserver (using dnsmasq package), and added al reverse DNS records of the domain but I still having the same problems, so I think my guess is wrong.
Has anybody got any suggestion about the possible cause of this behaviour? Any clue will be much appreciated.