一堆实用程序来简化 linux 网络故障排除和性能调整。
项目描述
netutils-linux
它是简化 Linux 网络故障排除和性能调整的有用工具,旨在帮助Carbon Reductor 技术支持和自动化整个 linux 性能调整过程开箱即用(好的,除了具有多个网络设备的最佳 RSS 布局检测)。这些实用程序可能对具有繁重网络工作负载的数据中心和 Internet 服务提供商有用(您可能不会在台式计算机上看到效果)。它现在已在生产中使用,部署了 300 多个,并为我们节省了大量的硬件和软件设置调试时间。灵感来自packagecloud 的博文。
安装
你需要pip。
pip install netutils-linux
用法
查看本指南以了解使用情况。
实用程序
监控
所有这些顶级实用程序都不需要 root 权限或 sudo 使用。因此,如果您关心安全性,您可以作为非特权用户安装和使用它们。
pip install --user netutils-linux
关于 CPU 和设备组的高亮颜色的简要说明:绿色和红色用于 NUMA 节点,蓝色和黄色用于 CPU 插槽。屏幕截图来自具有不同硬件的不同主机。
网络顶
这个 repo 中最有用的工具,包括几乎所有的 linux 网络堆栈性能指标,并允许监控设备和 CPU 的中断、软中断、网络处理统计信息。基于以下文件:
/proc/interrupts(默认隐藏具有少量 irqs/second 的向量)
/proc/net/softnet_stat - CPU 之间的数据包分布和错误/压缩率。
/proc/softirqs(仅 NET_RX 和 NET_TX 值)。
/sys/class/net/<NET_DEVICE>/statistic/<METRIC>文件(可以指定单位,默认为 mbits)
如果您只想查看特定指标,还有单独的实用程序:irqtop、softirq-top、softnet-stat-top、link-rate。
snmptop
基本的 /proc/net/smmp 文件观察器。
调音
RSS-阶梯
为通常在 CPU0 上开箱即用的 NIC rx/tx 队列的 IRQ自动设置smp_affinity_list )。
基于 lscpu 的输出。
在多处理器系统的情况下,它还支持双/四梯形图(但您最好明确指定队列计数 == 每个插槽的核心作为 NIC 驱动程序的参数)。示例输出:
# rss-ladder eth1 0
- distributing interrupts of eth1 (-TxRx-) on socket 0
- eth1: irq 67 eth1-TxRx-0 -> 0
- eth1: irq 68 eth1-TxRx-1 -> 1
- eth1: irq 69 eth1-TxRx-2 -> 2
- eth1: irq 70 eth1-TxRx-3 -> 3
- eth1: irq 71 eth1-TxRx-4 -> 8
- eth1: irq 72 eth1-TxRx-5 -> 9
- eth1: irq 73 eth1-TxRx-6 -> 10
- eth1: irq 74 eth1-TxRx-7 -> 11
自动售货机
在 NIC 的所有 NIC 的 rx 队列的本地 NUMA 节点的所有可用 CPU 上启用 RPS。对于网卡便宜的小型服务器可能会有好处。您也可以显式传递--cpus或--cpu-mask。示例输出:
# autorps eth0
Using mask 'fc0' for eth0-rx-0.
最大化 CPU 频率
将每个 CPU 缩放调控器模式设置为性能,并将最大缩放值设置为最小缩放值。因此,您将能够使用处理器的所有功能(对延迟敏感的系统很有用)。
rx 缓冲区增加
rx-buffers-increase 实用程序,在避免丢失/丢失 pkts 和保持低延迟之间找到并设置折衷值。
示例输出:
# ethtool -g eth1
Ring parameters for eth1:
Pre-set maximums:
RX: 4096
...
Current hardware settings:
RX: 256
# rx-buffers-increase eth1
run: ethtool -G eth1 rx 2048
# rx-buffers-increase eth1
eth1's rx ring buffer already has fine size.
# ethtool -g eth1
Ring parameters for eth1:
Pre-set maximums:
RX: 4096
...
Current hardware settings:
RX: 2048
硬件及其配置等级。服务器信息
与 lshw 非常相似,但设计用于服务器的网络处理角色。
服务器信息
➜ vscale-vm git:(folding) ✗ server-info --show
cpu:
info:
Architecture: x86_64
BogoMIPS: 4399
Byte Order: Little Endian
CPU MHz: 2199
CPU family: 6
CPU op-mode(s): 32-bit, 64-bit
CPU(s): 1
Core(s) per socket: 1
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36
clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon
rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm
abm 3dnowprefetch tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust
bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat
Hypervisor vendor: KVM
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 25600K
Model: 79
Model name: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
NUMA node(s): 1
NUMA node0 CPU(s): 0
On-line CPU(s) list: 0
Socket(s): 1
Stepping: 1
Thread(s) per core: 1
Vendor ID: GenuineIntel
Virtualization: VT-x
Virtualization type: full
layout:
<s>'0'</s>: <s>'0'</s>
disk:
vda:
model: null
size: 21474836480
type: HDD
memory:
devices:
<s>'0x1100'</s>:
size: <s>'512'</s>
speed: 0
type: RAM
size:
MemFree: 78272
MemTotal: 500196
SwapFree: 0
SwapTotal: 0
net:
eth0:
buffers:
cur: 256
max: 256
conf:
ip: <s>''</s>
vlan: false
driver:
driver: virtio_net
version: 1.0.0
queues:
own: []
rx: []
rxtx: []
shared: []
tx: []
unknown: []
服务器整体评分
➜ vscale-vm git:(folding) ✗ server-info --rate --server
server: 1.7666666666666664
子系统评级
➜ vscale-vm git:(folding) ✗ server-info --rate --subsystem
cpu: 4.5
disk: 1.0
memory: 1.0
net: 1.3333333333333333
system: 1.0
设备评级
➜ vscale-vm git:(folding) ✗ server-info --rate --device
cpu:
BogoMIPS: 2
CPU MHz: 2
CPU(s): 1
Core(s) per socket: 1
L3 cache: 9
Socket(s): 1
Thread(s) per core: 10
Vendor ID: 10
disk:
vda: 1.0
memory:
devices:
<s>'0x1100'</s>: 1.0
size: 1.0
net:
eth0: 1.3333333333333333
system:
Hypervisor vendor: 1
Virtualization type: 1
设备的详细评级
➜ vscale-vm git:(folding) ✗ server-info --rate
cpu:
BogoMIPS: 2
CPU MHz: 2
CPU(s): 1
Core(s) per socket: 1
L3 cache: 9
Socket(s): 1
Thread(s) per core: 10
Vendor ID: 10
disk:
vda:
size: 1
type: 1
memory:
devices:
<s>'0x1100'</s>:
size: 1
speed: 1
type: 1
size:
MemTotal: 1
SwapTotal: 1
net:
eth0:
buffers:
cur: 1
max: 1
driver: 2
queues: 1
system:
Hypervisor vendor: 1
Virtualization type: 1
如何贡献?
关闭问题
欢迎任何帮助。只需用“我想帮忙,我该如何解决这个问题?”来评论一个问题。开始。