linux KVM 来宾网络性能比主机慢

Moa*_*fat 4 linux kvm-virtualization

我有一个基于 KVM Linux 的虚拟机,因为主机的网络性能以 1 Gbps(在内部网络上)完美运行,并且使用 iperf 工具显示网络在主机上运行完美,但来宾的网络性能很慢因为 iperf 结果非常奇怪,因为它不是 100 Mbps 也不是 1 Gbps,而是最大值在 350 到 500 Mbps 之间。这是运行的结果iperf -c servername -P 15

[ ID] Interval       Transfer     Bandwidth
[ 17]  0.0-10.0 sec  68.6 MBytes  57.5 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  18.6 MBytes  15.5 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  5]  0.0-10.0 sec  61.9 MBytes  51.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[ 11]  0.0-10.0 sec  16.0 MBytes  13.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[ 10]  0.0-10.0 sec  24.3 MBytes  20.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[ 15]  0.0-10.0 sec  20.2 MBytes  16.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[ 12]  0.0-10.0 sec  30.2 MBytes  25.3 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  36.2 MBytes  30.3 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  8]  0.0-10.0 sec  23.6 MBytes  19.8 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  9]  0.0-10.0 sec  24.2 MBytes  20.3 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[ 14]  0.0-10.0 sec  31.0 MBytes  25.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  7]  0.0-10.0 sec  16.6 MBytes  13.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  6]  0.0-10.0 sec  18.8 MBytes  15.7 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[ 13]  0.0-10.0 sec  13.3 MBytes  11.2 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[ 16]  0.0-10.0 sec  29.6 MBytes  24.8 Mbits/sec
[SUM]  0.0-10.0 sec    433 MBytes    363 Mbits/sec
Run Code Online (Sandbox Code Playgroud)

我测试了不同的网络模型,最好的结果是使用virtio模型,任何人都可以帮助获得网络的全部性能并且达到 1 Gbps。

我想补充一点,当我执行命令时,brctl show我得到了 fbridge 名称

bridge id       STP enabled interfaces
br0     8000.d067e5fb7dec   no      eth0
                            vnet0
                            vnet1
                            vnet2
br2     8000.d067e5fb7dee   no      eth1
virbr0      8000.000000000000   yes
Run Code Online (Sandbox Code Playgroud)

这会影响客人的网速吗?

小智 5

尝试更改以太网驱动程序设置。

/sbin/ethtool --offload eth0 gso off tso off sg off gro off 
Run Code Online (Sandbox Code Playgroud)

如果半虚拟化网络驱动程序性能较低,请验证主机系统上 GSO 和 TSO 功能的设置。半虚拟化网络驱动程序要求禁用 GSO 和 TSO 选项以获得最佳性能。