mysql tookit之tcprstat

1.安装

wget http://github.com/downloads/Lowercases/tcprstat/tcprstat-static.v0.3.1.x86_64

cp tcprstat-static.v0.3.1.x86_64 /usr/bin/tcprstat
chmod +x /usr/bin/tcprstat

2.使用:

tcprstat -p 3306 -t 1 -n 5

bonding模式 虚拟网卡情况下需要

如果运行的时候提示 pcap: SIOCGIFFLAGS: bonding_masters: No such device。那说明没能自动提取服务器ip。需要使用-l参数手动指定。

tcprstat -p 3306 -n 0 -t 1 -l ip

原理:

基于libpcap捕获数据包,根据源ip+端口, 目标ip+端口 ,计算其最后1个入包和第1个出包的时间差 来计算响应耗时;

具体可以看下readme:
tcprstat ~

tcprstat is a pcap-based tool that extracts information about TCP response
times.

It works by sniffing for TCP “requests” (inbound packets) and measures the time
that it takes for sending a “response” (next outbound packet). While this
approach might seem too simple, it works for simple protocols that are based in
such request/response system, like HTTP and the MySQL protocol. In the future,
we may write more complex protocol decoding.

tcprstat sniffs for a while, and then shows some stats about the sniffed
packets, similar to the way top(1) works.

tcprstat uses libpcap to capture TCP. Due to many distros not shipping
libpcap >= 1.0.0, tcprstat ships libpcap 1.1.1 and uses it if it can’t find a
suitable version

The build process delivers a static version, tcprstat-static, with no external
linking (some castration is needed at libpcap) so it can be copied directly to
a server with no need for compilation tools.

tcprstat is released under the GPL, version 2 or 3.

总:

可以作为 redis ,mongo,mysql等真实耗时的工具,排除数据库RT高的怀疑。DBA可以甩锅了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值