Skip to content

Benchmarks

Jason Lyu edited this page Apr 2, 2022 · 2 revisions

Introduce

Host connects to iPerf server with a 10G network card

Platform A (Host)

Docker container

  • OS: Arch Linux
  • CPU: Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz
  • Interfaces:
    • eth0: 172.17.0.3
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.3  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:ac:11:00:03  txqueuelen 0  (Ethernet)
        RX packets 862435  bytes 112455267 (107.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1215554  bytes 11083124435 (10.3 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Platform B (iPerf3 Server)

Physical machine

  • OS: Synology Linux
  • CPU: Intel(R) Atom(TM) CPU C3538 @ 2.10GHz
  • Servers:
    • Socks5 server listen on: 0.0.0.0:1080
    • iPerf3 server listen on: 0.0.0.0:5201
  • Interfaces:
    • ovs_eth4: 192.168.0.1
    • ovs_eth5: 192.168.1.1
ovs_eth4  Link encap:Ethernet  HWaddr 6C:92:BF:32:4C:2E  
          inet addr:192.168.0.1  Bcast:192.168.0.7  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:9000  Metric:1
          RX packets:1549731 errors:0 dropped:0 overruns:0 frame:0
          TX packets:747607 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:56500520306 (52.6 GiB)  TX bytes:274417116 (261.7 MiB)

ovs_eth5  Link encap:Ethernet  HWaddr 6C:92:BF:32:4C:2F  
          inet addr:192.168.1.1  Bcast:192.168.1.7  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:9000  Metric:1
          RX packets:21290414 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12056862 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:240109208206 (223.6 GiB)  TX bytes:8133459597 (7.5 GiB)

Pre-configuration

We create TUN interface on Host.

  • Name: tun0
  • IP: 198.18.0.1
  • MTU: 9000

And then, ip route add 192.168.1.1 dev tun0

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 9000
        inet 198.18.0.1  netmask 255.254.0.0  destination 198.18.0.1
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)
        RX packets 1290355  bytes 63071148 (60.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2059447  bytes 11076291809 (10.3 GiB)
        TX errors 0  dropped 14 overruns 0  carrier 0  collisions 0

Benchmark

Note: we test upload/download speed with different number of connections, and we test multiple times to get an average result.

Raw Speed

First, we test raw connection speed from Host to server using iperf3. And it reaches about >9 Gbits/sec (as expected).

Upload

$ iperf3 -c 192.168.0.1
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   0.00-10.00  sec  7.30 GBytes  6.27 Gbits/sec    9             sender
[  5]   0.00-10.00  sec  7.29 GBytes  6.26 Gbits/sec                  receiver

$ iperf3 -c 192.168.0.1 -P 10
- - - - - - - - - - - - - - - - - - - - - - - - -
[SUM]   0.00-10.00  sec  7.97 GBytes  6.84 Gbits/sec  6453             sender
[SUM]   0.00-10.00  sec  7.91 GBytes  6.79 Gbits/sec                  receiver

Download

$ iperf3 -c 192.168.0.1 -R
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   0.00-10.00  sec  10.9 GBytes  9.41 Gbits/sec   11             sender
[  5]   0.00-10.00  sec  10.9 GBytes  9.40 Gbits/sec                  receiver

$ iperf3 -c 192.168.0.1 -R -P 10
- - - - - - - - - - - - - - - - - - - - - - - - -
[SUM]   0.00-10.00  sec  11.0 GBytes  9.42 Gbits/sec  167             sender
[SUM]   0.00-10.00  sec  11.0 GBytes  9.41 Gbits/sec                  receiver

badvpn-tun2socks

Second, we test the badvpn-tun2socks project, which is directly installed using pacman on Arch Linux.

  • Version: BadVPN tun2socks 1.999.130
  • Command Line: badvpn-tun2socks --tundev tun0 --socks-server-addr 192.168.0.1:1080 --netif-ipaddr 198.18.0.1 --netif-netmask 255.255.254.0

Upload

$ iperf3 -c 192.168.1.1   
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   803 MBytes   674 Mbits/sec    0             sender
[  5]   0.00-10.00  sec   802 MBytes   673 Mbits/sec                  receiver

$ iperf3 -c 192.168.1.1 -P 10
- - - - - - - - - - - - - - - - - - - - - - - - -
[SUM]   0.00-10.00  sec   944 MBytes   792 Mbits/sec   10             sender
[SUM]   0.00-10.00  sec   939 MBytes   788 Mbits/sec                  receiver

Download

$ iperf3 -c 192.168.1.1 -R               
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   0.00-10.00  sec  3.35 GBytes  2.88 Gbits/sec    0             sender
[  5]   0.00-10.00  sec  3.34 GBytes  2.87 Gbits/sec                  receiver

$ iperf3 -c 192.168.1.1 -R -P 10
- - - - - - - - - - - - - - - - - - - - - - - - -
[SUM]   0.00-10.00  sec  3.45 GBytes  2.96 Gbits/sec    1             sender
[SUM]   0.00-10.00  sec  3.34 GBytes  2.87 Gbits/sec                  receiver

go-tun2socks

Then, we download the go-tun2socks binary from its original repo.

  • Version: v1.16.11
  • Command Line: tun2socks-linux-amd64 -proxyServer 192.168.0.1:1080 -tunName tun0 -tunPersist

Upload

$ iperf3 -c 192.168.1.1   
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   0.00-10.00  sec   394 MBytes   331 Mbits/sec    0             sender
[  5]   0.00-10.00  sec   393 MBytes   329 Mbits/sec                  receiver

$ iperf3 -c 192.168.1.1 -P 10
- - - - - - - - - - - - - - - - - - - - - - - - -
[SUM]   0.00-10.00  sec   399 MBytes   335 Mbits/sec   10             sender
[SUM]   0.00-10.01  sec   392 MBytes   329 Mbits/sec                  receiver

Download

$ iperf3 -c 192.168.1.1 -R
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   0.00-10.00  sec  2.62 GBytes  2.25 Gbits/sec    0             sender
[  5]   0.00-10.00  sec  2.61 GBytes  2.24 Gbits/sec                  receiver

$ iperf3 -c 192.168.1.1 -R -P 10
- - - - - - - - - - - - - - - - - - - - - - - - -
[SUM]   0.00-10.00  sec  3.00 GBytes  2.58 Gbits/sec   14             sender
[SUM]   0.00-10.00  sec  2.91 GBytes  2.50 Gbits/sec                  receiver

tun2socks

Finally, let's test this project!

  • Version: v2.3.2
  • Command Line: tun2socks-linux-amd64 -device tun0 -proxy socks5://192.168.0.1:1080

Upload

$ iperf3 -c 192.168.1.1   
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   0.00-10.00  sec  3.40 GBytes  2.92 Gbits/sec  951             sender
[  5]   0.00-10.00  sec  3.38 GBytes  2.91 Gbits/sec                  receiver

$ iperf3 -c 192.168.1.1 -P 10
- - - - - - - - - - - - - - - - - - - - - - - - -
[SUM]   0.00-10.00  sec  5.55 GBytes  4.76 Gbits/sec   84             sender
[SUM]   0.00-10.02  sec  5.53 GBytes  4.74 Gbits/sec                  receiver

Download

$ iperf3 -c 192.168.1.1 -R
- - - - - - - - - - - - - - - - - - - - - - - - -
[  5]   0.00-10.00  sec  3.53 GBytes  3.03 Gbits/sec    0             sender
[  5]   0.00-10.00  sec  3.51 GBytes  3.02 Gbits/sec                  receiver

$ iperf3 -c 192.168.1.1 -R -P 10
- - - - - - - - - - - - - - - - - - - - - - - - -
[SUM]   0.00-10.00  sec  8.60 GBytes  7.38 Gbits/sec    1             sender
[SUM]   0.00-10.00  sec  8.51 GBytes  7.31 Gbits/sec                  receiver

Summary

For all scenarios of usage, tun2socks performs best.

It archives:

  • 70% raw speed upload
  • 78% raw speed download

benchmark