背景

最近看到 v2fly 上面多了蛮多新玩法。综合个人隐蔽性需求,将对以下搭配使用 iperf, speedtest mini, v2ray, clash premium 和 speedtest-cli 进行测速。

测速方式来自:https://steemit.com/cn/@v2ray/3cjiux

只考虑这两种隐蔽性强和兼容相对广泛的搭配。

比如 VLESS+WEB 通过分流器的操作,识别起来比较方便,WireShark就可以很简单的区分,故不考虑。

HTTP 协议TLSv2ray inbound协议加密
HTTP/2YESH2Cnone
HTTP/2YESH2CAES-128-GCM
HTTP 1.xYESWSnone
HTTP 1.xYESWSAES-128-GCM

本次测试的目的

测试 VMess 基于 HTTP 隐藏的各种加密方式,在常规传输过程中的参考速度。

测试方法

  • 在两台 2c4h16g 4Gbps 的 Oracle VM.Standard.E4.Flex 虚拟机上面分别搭建 基于 HTTP 1.x 和 HTTP/2 v2ray 服务端以及 speedtest mini服务端,并在一台2c4h16g 4Gbps 的 Oracle VM.Standard3.Flex 虚拟机搭建服务端,使用 speedtest-cli 通过代理进行测速。
  • 如何判断真的走了代理?查看服务端和客户端的 网卡流量信息 和 v2ray 日志信息

测试环境

V2Ray Core 版本 v4.44.0

Clash 版本:Clash 2022.01.27 linux amd64 with go1.18beta1 Thu Jan 27 13:02:53 UTC 2022

speedtest-cli 2.1.2 Python 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]

系统均使用 Ubuntu 20.04,并开启 BBR

VM 都设置为 CPU 可突发,突发基线为 50%

  • 2 x Oracle VM.Standard.E4.Flex 2c4h16g 4Gbps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Architecture:                    x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 40 bits physical, 48 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 25
Model: 1
Model name: AMD EPYC 7J13 64-Core Processor
Stepping: 1
CPU MHz: 2445.406
BogoMIPS: 4890.81
Virtualization: AMD-V
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 128 KiB
L1i cache: 128 KiB
L2 cache: 1 MiB
L3 cache: 16 MiB
NUMA node0 CPU(s): 0-3
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Full AMD retpoline, IBPB conditional, IBRS_FW, STIBP conditional, RSB filli
ng
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
  • 1 x Oracle VM.Standard3.Flex 2c4h16g 4Gbps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Architecture:                    x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 40 bits physical, 57 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 106
Model name: Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz
Stepping: 6
CPU MHz: 2593.966
BogoMIPS: 5187.93
Virtualization: VT-x
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 64 KiB
L1i cache: 64 KiB
L2 cache: 8 MiB
L3 cache: 16 MiB
NUMA node0 CPU(s): 0-3
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected

测速工具

基本信息

Hostv2rayspeedtest-mini
n3kr.google.comserverserver
n4kr.google.comserverserver
n5kr.google.comclientclient
  • iperf3 可以查看客户端和服务端为 4Gbps 的带宽
  • speedtest-cli 的测速结果也基本如此
序号上传下载
03695.282651.07
137432528.95
23737.462526.12
33720.52518.34
43707.662169.3
53696.482668.12
63740.512534.96
73623.872178.24
83651.622278.35
93681.292627.53

Vmess 测速

  • 测速命令
1
2
3
4
5
6
7
8
9
three (){
for i in {1..$1}
do
eval $2
sleep 5
done
}
three 10 "speedtest-cli --mini http://n3kr.google.com --csv"
# speedtest-cli --mini http://138.2.114.253:80 --csv-header
  • 测速节点使用 speedtest mini 搭建,详见 →

h2 测速的过程中原版客户端出了点奇奇怪怪的问题,后续都换成了 clash premium 进行测试

HTTP/2+TLS+H2C+AUTO+WEB

测试过程中 此种测试模式出现过服务端被打挂的情况

https://github.com/Dreamacro/clash/releases/tag/premium

  • three 20 "speedtest-cli --mini http://n4kr.google.com --csv"
序号下载上传
01076.262231.14
11078.071844.21
21065.162322.42
31091.962508.72
41066.281718.2
51087.61513
61047.81628.8
71091.551880.86
81076.291597.85
91088.292505.67
101080.982045.66
111061.32531.48
121071.671211.68
131061.072367.3
141080.411783.14
151068.841295.37
161084.671853.48
171070.992470.81
181056.121826.57
191075.171855.11

HTTP/2+TLS+H2C+NONE+WEB

测试过程中 此种测试模式出现过服务端被打挂的情况

https://github.com/Dreamacro/clash/releases/tag/premium

  • three 20 "speedtest-cli --mini http://n4kr.google.com --csv"
序号下载上传
0963.342111.67
1977.81724.18
2945.921629.36
3963.281378.45
4954.781723.26
5972.521910.12
6962.82213.12
79612104.75
8953.152176.02
9961.771243.26
10996.411521.64
11975.142414.55
12972.161720.12
13972.961478.24
14996.411649.12
15970.11860
16978.041719
17962.622077.84
18959.151891.93
19959.181909.39

HTTP/2+TLS+H2C+AES-128-GCM+WEB

  • three 20 "speedtest-cli --mini http://n4kr.google.com --csv"
序号下载上传
01072.171728.56
11077.941688.53
21090.052240.06
31081.831629.94
41090.172013.98
51063.471975.27
6246.051874.91
71063.882011.35
81074.731903.28
91105.142267.92
101073.032054.66
111078.881472.24
121078.271920.74
131070.271822.1
141068.51832.75
151077.011870.06
161094.161855.11
171073.31972.83
181061.91856.69
191004.172513.06

HTTP1.x+TLS+WS+NONE+WEB

  • three 20 "speedtest-cli --mini http://n4kr.google.com --csv"
  • clash
  • Clash HTTP1.x+TLS+WS+NONE+WEB
序号下载上传
01882.921267.29
11883.45934.95
21886.13492.51
31901.5383.79
41874.9414.77
51874.42370.57
61910.24307.24
71877.43637.83
81869.76361.3
91897.932059.06
101889.591005.95
111873.72276.55
121893.87372.17
131879.64226.87
141896.91142.58
151882.131007.48
161874.78366.35
171880.322021.74
181901.971766.16
191877.77950.76

  • Clash HTTP1.x+TLS+WS+AUTO+WEB
序号下载上传
01887.991871.85
11868.47380.05
21876.472409.5
31882.282029.39
41865.411821.91
51868.341157.13
61871.73489.02
71885.191850.75
81859.452485.44
91876.981934.64
101685.45364.68
111873.0578.48
1218571973.31
131870.481829.71
141736.281656.51
151874.781971.4
161856.34675.46
171869.512069.49
181856.84515.95
191879.482031.77

  • v2ray client
序号下载上传
01870.21706.89
11910.88438.43
21891.06677.95
31884.05756.88
41920.39172.93
51921.31619.55
61882.68697.71
71920.67154.28
81828.46196.31
91926.01468.58
101901.83647.56
111889.04617.24
121921.461630.4
131905.1262.38
141899.19204.08
151914.48600.8
161924.44462.51
171890.84429.16
181923.15110.51
191861.36660.72

HTTP1.x+TLS+WS+AES-128-GCM+WEB

  • three 20 "speedtest-cli --mini [http://n3kr.google.com](http://n3kr.google.com/) --csv"
  • clash
01829.871848.88
11856.461862.17
21883.04962.03
31880.8285.32
41874.221843.67
51886.13452.37
61884.271679.2
71877.982068.18
81866.52438.04
91861.991761.73
101881.631622.57
111890.39543.63
12280.412282.18
131843.481100.14
141867.5594.3
151884.06233.99
161849.242343.5
171885.6128.86
181841.05344.33
191868.43421.24

  • v2ray client
序号下载上传
01844.75462.54
11900.02154.19
21866.2471.44
31873.19455.46
41899.42671.59
51868.68102.96
61886.71175.74
71833.61202.97
81852.31331.49
91867.581285.72
101884.361376.54
111831.86416.34
121872.34179.22
131867.741349.64
141830.08718.3
151880.34177.74
161896.96608.69
171908.0218.55
181859.84170.36
191878.93196.64

结论

  • 单看 HTTP 1.x 的话,无论是 NONE、AUTO还是 AES-128-GCM,下载都区别不大,上传貌似 AUTO 要好一点,推荐 Clash HTTP1.x+TLS+WS+AUTO+WEB
  • 单看 HTTP/2 的话,AUTO 和 AES-128-GCM 在下载时略优于 NONE,上传貌似 AES-128-GCM略优一点,平均速度三种都差不多,抖动的话AES-128-GCM小点。
  • 不知道是 HTTP/2 目前线程数量有限还是怎么,下载只有 HTTP 1.x 的一半。速度倒是差不多有后者的两倍。

推荐配置

  • 对于大带宽、延迟一般的机器还是使用传统的 WSS(HTTP1.x+TLS+WS+AUTO+WEB)
  • 对于带宽有限、延迟较低的机器,推荐使用 H2(HTTP/2+TLS+H2C+AES-128-GCM+WEB)

其他

  • 完整测速结果:https://docs.google.com/spreadsheets/d/1VFJYjQUpd0rIOSmXn8ecEiKWwzEZui5Mo7COdqhKiq8/edit?usp=sharing
  • 配置文件:https://github.com/IITII/v2ray_banchmark