笔者用过多家公有云的网络,包括但不限于aws,阿里云以及腾讯云。
对网络的性能和常见问题,分享下经历过的问题和经验。
目前我们在公有云上买到的服务器,一般网卡类型都是virtio,这个可以通过ethtool -i eth1获取。
[root@VM_52_246_centos:~]# ethtool -i eth1
driver: virtio_net
version: 1.0.0
firmware-version:
bus-info: 0000:00:03.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
一部分是网卡本身性能,除了各个厂商底层实现的限制外,还有以下我们可控的因素。
[root@VM_52_246_centos:~]# ethtool -l eth1
Channel parameters for eth1:
Pre-set maximums:
RX: 0
TX: 0
Other: 0
Combined: 2
Current hardware settings:
RX: 0
TX: 0
Other: 0
Combined: 2
该参数一般系统规格有关。队列数不少于cpu数时性能最高,但在队列数大于16之后,性能提升不会那么明显了。
[root@VM_52_246_centos:~]# ethtool -g eth1
Ring parameters for eth1:
Pre-set maximums:
RX: 256
RX Mini: 0
RX Jumbo: 0
TX: 256
Current hardware settings:
RX: 256
RX Mini: 0
RX Jumbo: 0
TX: 256
这个参数一般出厂会设置为最优。
我们如果突发流量不大,有时也可以手动调小,这样pps会更高,缓存亲和性会更好。
如果突发流量大,那么最好保持最大值。
查看网卡队列的中断
[root@VM_52_246_centos:~]# cat /proc/interrupts | grep virtio | grep input
45: 3038319 0 0 0 0 0 0 0 PCI-MSI-edge virtio0-input.0
47: 1 2032771 0 0 0 0 0 0 PCI-MSI-edge virtio0-input.1
查看中断亲和性
[root@VM_52_246_centos:~]# cat /proc/irq/45/smp_affinity
01
[root@VM_52_246_centos:~]# cat /proc/irq/47/smp_affinity
02
从结果看,是绑定到了不同的cpu。这样性能比较高。
[root@VM_52_246_centos:~]# cat /sys/class/net/eth1/queues/rx-0/rps_cpus
ff
[root@VM_52_246_centos:~]# cat /sys/class/net/eth1/queues/rx-1/rps_cpus
ff
在cpu数大于队列数的情况下,开启rps会得到更好的网络性能。这里表示,2个队列,收包软中断会重分发到8个cpu上。
以上是使用公有云服务器,通用的一些设置检查,也是影响virtio网络性能的关键因素。
对于不在意成本的用户,可以买到独享服务器,设置裸金属服务器,这种情况下,网络性能会更好。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。