SSH tunnel for socks5 proxy is slow with concurrent load

PROXYsocksssh

I ssh to a remote AWS server using Ubuntu. I use ssh's port forwarding capabilities to do this. I have tried forwarding a dynamic port (ssh -D) or a single port (ssh -L with dante running as a remote socks server). Both are equally slow. I also tried different ciphers (ssh -c).

Concurrent TCP connections pretty much do not work. For example, I can go to speedtest.net and start a test (which is fairly fast, probably maxes out my line speed) and if I try and do anything (i.e. load google.com) while the test is still running, all the additional connections seem to hang until the speed test is over.

I realize OpenSSH is single-threaded. Is this the problem? It doesn't even show up on my top. Same goes for sshd on the remote server — no processor hit.

Is there anyway to bump ssh performance or should I step up to OpenVPN or something better suited for this?

Best Answer

This is likely because every time SSH needs to setup a connection to the host it needs to go all the way to AWS then back out to the server you are trying to contact. Basically this adds the latency from your machine to the AWS machine and the AWS machine to the server your contacting.

Try ping the AWS machine from your workstation and record the latency, then ping the host your contacting from the AWS machine and record that latency. Add the two together and that is the theoretical maximum latency that you can achieve over that link. OpenVPN and SSH cannot beat this limit, however if your traffic is mostly HTTP then you could setup a caching squid server on the AWS machine, or your local machine to decrease the amount of requests that have to travel over this link.