Very slow transfer speeds

Need help configuring your VPN? Just post here and you'll get that help.
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
dancos
OpenVPN User
Posts: 11
Joined: Thu Nov 03, 2016 9:28 pm

Very slow transfer speeds

Post by dancos » Thu Nov 03, 2016 10:22 pm

Hello OpenVPN community,

I've been struggling with this for the past days and I have not made any progress so far. The configuration of OpenVPN was delightfully straight forward and pretty much everything worked out of the box. The only thing wrong with the installation are the transfer speeds. Without OpenVPN "iperf" reports about 300 mbps download speed. As soon as OpenVPN is involved the speed drops to anywhere between 10 and 70 mbps depending on different mtu/crypto configurations.
I've been able to reproduce the issue in a simple adhoc VPN.
Server (Debian 8):

Code: Select all

openvpn --dev tun --proto udp --port 11000 --secret static.key --ifconfig 192.168.222.11 192.168.222.10
iperf -c 192.168.222.10
Client (Ubuntu 16.04):

Code: Select all

openvpn --dev tun --proto udp --port 11000 --secret static.key --ifconfig 192.168.222.10 192.168.222.11 --remote server.ip
iperf -s
This gives me about 35 mbps on a link that should be 300 mbps. The situation is much worse when using tcp at 2-11 mbps. I've experimented with countless combinations of tun-mtu/fragment/mssfix/sndbuf/rcvbuf and many more, the maximum I've ever reached was about 60-70 mbps by adding the following parameters:

Code: Select all

--txqueuelen 15000 --tcp-queue-limit 128 --cipher aes-256-cbc
CPU usage on the client is <50% and on the server it's <20%. I've tried different ports as well (443 for example) and iperf over an SSH tunnel gives me almost the full 300 mbps.

While researching this issue I've found people who have the same problem with no solution, people who had to change a tun-mtu or buf setting and the issue was gone, people who say that this is normal and people who say that the overhead should be max 10%. None of the setting changes I've found have helped.

If anyone has any idea as to what might be causing the slowdown and how we can get at least 100mbps out of the VPN that would be greatly appreciated!

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 2835
Joined: Fri Jun 03, 2016 1:17 pm

Re: Very slow transfer speeds

Post by TinCanTech » Thu Nov 03, 2016 11:16 pm


dancos
OpenVPN User
Posts: 11
Joined: Thu Nov 03, 2016 9:28 pm

Re: Very slow transfer speeds

Post by dancos » Fri Nov 04, 2016 5:39 am

Thank you for your reply. That Wiki entry has helped me run this one-line VPN setup for testing as well as the "--cipher aes-256-cbc" parameter which gave some improvement but the speed remains 70mbps or lower. Changes to mtu values generally made the speed worse, no matter the value.
Even with encryption completely disabled (--cipher none --auth none) the speed remains below 70 mbps (and below 11 mbps using tcp). Outside of the VPN the connection to the same box is still at 300 mbps.

dancos
OpenVPN User
Posts: 11
Joined: Thu Nov 03, 2016 9:28 pm

Re: Very slow transfer speeds

Post by dancos » Sat Nov 05, 2016 6:23 pm

Maybe as a general question, can this behavior be reproduced by anyone? I.e. using the commands mentioned, can you get almost full link speed?
Searching for a cause for normal behavior would be rather pointless :D

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 2835
Joined: Fri Jun 03, 2016 1:17 pm

Re: Very slow transfer speeds

Post by TinCanTech » Sat Nov 05, 2016 7:05 pm

If you can describe your network in more detail maybe a bottle neck can be identified.

Personally, I get exactly what I pay for out of my internet while using openvpn.

Pippin
OpenVPN Expert
Posts: 248
Joined: Wed Jul 01, 2015 8:03 am

Re: Very slow transfer speeds

Post by Pippin » Sat Nov 05, 2016 9:44 pm

In addition to ^^^^

CPU?
CPU supports AES-NI?

dancos
OpenVPN User
Posts: 11
Joined: Thu Nov 03, 2016 9:28 pm

Re: Very slow transfer speeds

Post by dancos » Sun Nov 06, 2016 5:32 am

Thank you for your replies. It's a Linux workstation on a gigabit network behind an ASUS RT-AC68U router that connects to a remote server (ping 17-20 ms, 1 gbps bandwidth) through cable internet (400/40 mbps).
Both CPUs support AES-NI, Server:
Intel(R) Xeon(R) CPU E3-1246 v3 @ 3.50GHz
Client:
Intel(R) Core(TM) i5-6260U CPU @ 1.80GHz

Even though my upload is vastly slower than the download I get better upload speed: Download I get about 33 mbps (355 mbps without VPN), upload 38 mbps (41 mbps without VPN). The next test is going to be hooking up the workstation directly to the cable modem, I'll post an update if this makes a difference :)
/Edit: Download is about 36 mbps without the router, so minimal difference.

dancos
OpenVPN User
Posts: 11
Joined: Thu Nov 03, 2016 9:28 pm

Re: Very slow transfer speeds

Post by dancos » Sun Nov 06, 2016 6:19 am

Another interesting test, using the "shaper" option on the server, when it's set to 5000000 (40 mbps) the speed stays the same (36 mbps, same for any shaper value above that). When set to 2500000 (20 mbps) the speed still stays the same, so I get 36 mbps with a 20 mbps limit (and OpenVPN says "Output Traffic Shaping initialized at 2500000 bytes per second").
Reducing shaper to 1250000 (10 mbps) finally limits the bandwidth and I get 10 mbps.

Version information, Server:
OpenVPN 2.3.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Nov 12 2015
library versions: OpenSSL 1.0.1t 3 May 2016, LZO 2.08
Client:
OpenVPN 2.3.10 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Feb 2 2016
library versions: OpenSSL 1.0.2g 1 Mar 2016, LZO 2.08

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 2835
Joined: Fri Jun 03, 2016 1:17 pm

Re: Very slow transfer speeds

Post by TinCanTech » Sun Nov 06, 2016 1:00 pm

Server Max. upload speed ?

dancos
OpenVPN User
Posts: 11
Joined: Thu Nov 03, 2016 9:28 pm

Re: Very slow transfer speeds

Post by dancos » Sun Nov 06, 2016 1:23 pm

Max upload speed of the server would be 1 gbps, 200 mbps guaranteed.

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 2835
Joined: Fri Jun 03, 2016 1:17 pm

Re: Very slow transfer speeds

Post by TinCanTech » Sun Nov 06, 2016 1:30 pm

Try this on your server and then client:
https://sourceforge.net/speedtest/

dancos
OpenVPN User
Posts: 11
Joined: Thu Nov 03, 2016 9:28 pm

Re: Very slow transfer speeds

Post by dancos » Sun Nov 06, 2016 2:52 pm

I believe this is located in the US while the server and client are in Europe. Still the speeds I see are over 200 mbps. Also, iperf between the two gives me 355 mbps server->client and 41 mbps client->server with a ping of about 20 ms.

Pippin
OpenVPN Expert
Posts: 248
Joined: Wed Jul 01, 2015 8:03 am

Re: Very slow transfer speeds

Post by Pippin » Sun Nov 06, 2016 4:59 pm

Asus router has Trend Micro AI?
If so, disable helps?

And yes, test going directly out the "front door"

dancos
OpenVPN User
Posts: 11
Joined: Thu Nov 03, 2016 9:28 pm

Re: Very slow transfer speeds

Post by dancos » Sun Nov 06, 2016 9:36 pm

Thank you, none of the special functions are enabled. I did test hooking the client directly to the cable modem, it gave me +2-3 mbps but that could also just be variance. Interestingly download seems to be slower than upload even though in terms of bandwidth it should be 10x faster.

Pippin
OpenVPN Expert
Posts: 248
Joined: Wed Jul 01, 2015 8:03 am

Re: Very slow transfer speeds

Post by Pippin » Tue Nov 08, 2016 1:32 pm

Sounds like mtu issue.

One time i helped a user having same issue of speed in one direction being bad.
fragment and mssfix did not help any.
Eventually found out that his laptop had the mtu of his network adaptor not standard (1500), it was set to 1300.
Setting it back to default solved the problem.

Post Reply