OpenVPN Speed Issue

September 12, 2016 7k views
VPN Firewall Ubuntu

Hi there,

I've setup OpenVPN and made it working following this tutorial ;

But when I do speed test on my local computer without VPN, I've got 25 mbits ( Expected ISP speed ) but when I do the test with VPN, it's around 15-16 mbits with 60ms ping. I understand the ping but internet speed shouldn't be that impacted.

Here you can see the speedtest runned on droplet,

Retrieving configuration...
Retrieving server list...
Testing from DigitalOcean (
Selecting best server based on latency...
Hosted by DEAC (Amsterdam) [2.18 km]: 4.038 ms
Testing download speed........................................
Download: 897.90 Mbit/s
Testing upload speed..................................................
Upload: 399.46 Mbit/s

Down here you can see the openvpn/server.conf

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server?
;proto tcp
proto udp

And here my UFW configuration, I use 80 and 8080 ports for my nginx webserver

Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
1194/udp                   ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
8080/tcp                   ALLOW       Anywhere
22 (v6)                    ALLOW       Anywhere (v6)
1194/udp (v6)              ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
8080/tcp (v6)              ALLOW       Anywhere (v6)

Thanks in advance

1 Answer

The results you are getting are about what is expected. There is something known as bandwidth delay product, which loosely translated basically means that the maximum throughput will be affected by the latency between the two hosts.

So for an example, if you have to hosts, let's say both are on a 1Gbps connection, if they were located within 1ms of each other then the maximum throughput between those hosts would be 1Gbps.

However, as the hosts are located geographically further apart and the latency between them increases then even if both hosts are on a 1Gbps connection, their maximum throughput begins to decrease. That means if you are 70ms apart, assuming standard packet sizes, you will get about 60% of the theoretical maximum throughput or about 600-800Mbps.

Given, that you are on a 25Mbps connection and then with 60ms latency to your VPN, to receive around 15Mbps is about what is expected given the latency.

If you want to improve your performance you would have to host your VPN somewhere closer to you so that you can get that latency down below 50ms and ideally around 20ms.

Also the decrease is non-linear, so the further away you are the more impact you will see.

Usually the 50ms-80ms is good enough to not notice a slowdown through use, but for heavy transfer, like streaming video there maybe some impact.

Lastly, you also need to consider the latency between the your VPN and the the final destination, as that will add another layer of latency.

Have another answer? Share your knowledge.