我是靠谱客的博主 着急溪流,这篇文章主要介绍定位网络丢包内核路径的几种方法,现在分享给大家,希望可以做个参考。

第一个是 dropwatch

# dropwatch -lkas
Initializing kallsyms db
dropwatch> start
Enabling monitoring...
Kernel monitoring activated.
Issue Ctrl-C to stop monitoring
1 drops at icmp_rcv+11c (0xffffffff8193bb1c) [software]
1 drops at icmp_rcv+11c (0xffffffff8193bb1c) [software]
1 drops at icmp_rcv+11c (0xffffffff8193bb1c) [software]
1 drops at icmp_rcv+11c (0xffffffff8193bb1c) [software]

第二个是 perf 监视 kfree_skb 事件

shell> perf record -g -a -e skb:kfree_skb
shell> perf script

第三个是tcpdrop

Linux bcc/eBPF tcpdrop

第四个是systemtap脚本

/usr/share/doc/systemtap-1.6/examples/network/dropwatch.stp

#!/usr/bin/stap
############################################################
# Dropwatch.stp
# Author: Neil Horman <nhorman@redhat.com>
# An example script to mimic the behavior of the dropwatch utility
# http://fedorahosted.org/dropwatch
############################################################
# Array to hold the list of drop points we find
global locations
# Note when we turn the monitor on and off
probe begin { printf("Monitoring for dropped packetsn") }
probe end { printf("Stopping dropped packet monitorn") }
# increment a drop counter for every location we drop at
probe kernel.trace("kfree_skb") { locations[$location] <<< 1 }
# Every 1 seconds report our drop locations
probe timer.sec(1)
{
printf("n")
foreach (l in locations-) {
printf("%d packets dropped at %sn",
@count(locations[l]), symname(l))
}
delete locations
}

最后

以上就是着急溪流最近收集整理的关于定位网络丢包内核路径的几种方法的全部内容,更多相关定位网络丢包内核路径内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(124)

评论列表共有 0 条评论

立即
投稿
返回
顶部