This is @YouZan systemtap toolkit to online analyze the complicated problem on production with heavy load. All tools are based on the amazing linux tracing/probing tool systemtap.
Any guys which want to know what the hell it is in the user space and kernel space should be to learn systemtap which is awesome tool:)
It’s used to collecting which tcp packet being retransmit
[root@localhost systemtap-toolkit]# ./tcp-retrans
Printing tcp retransmission
10.0.2.15:49896 -> 172.17.9.41:80 state:TCP_SYN_SENT rto:0 -> 1000 ms
10.0.2.15:49896 -> 172.17.9.41:80 state:TCP_SYN_SENT rto:1000 -> 2000 ms
10.0.2.15:49896 -> 172.17.9.41:80 state:TCP_SYN_SENT rto:2000 -> 4000 ms
who-open-file
It’s used to find who is opening the specified file
[root@localhost systemtap-toolkit]# ./who-open-file -f 123 -t 10000
Collecting who is opening filename 123
cat(13740) is opening the filename: "123"
cat(13741) is opening the filename: "123"
telnet(8062) is connecting to AF_INET@192.168.33.10:1800
telnet(8063) is connecting to AF_INET@192.168.33.10:1800
telnet(8064) is connecting to AF_INET@192.168.33.10:1800
telnet(8065) is connecting to AF_INET@192.168.33.10:1800
telnet(8066) is connecting to AF_INET@192.168.33.10:1800
telnet(8067) is connecting to AF_INET@192.168.33.10:1800
telnet(8068) is connecting to AF_INET@192.168.33.10:1800
telnet(8069) is connecting to AF_INET@192.168.33.10:1800
telnet(8070) is connecting to AF_INET@192.168.33.10:1800
sample-bt
It’s from agentzh and be used to sampling the backtrace in the user space and kernel space.
$ ./sample-bt -p 8736 -t 5 -u > a.bt
WARNING: Tracing 8736 (/opt/nginx/sbin/nginx) in user-space only...
WARNING: Missing unwind data for module, rerun with 'stap -d stap_df60590ce8827444bfebaf5ea938b5a_11577'
WARNING: Time's up. Quitting now...(it may take a while)
WARNING: Number of errors: 0, skipped probes: 24
systemtap-toolkit
NAME
systemtap-toolkit
Description
This is @YouZan systemtap toolkit to online analyze the complicated problem on production with heavy load. All tools are based on the amazing linux tracing/probing tool systemtap.
Any guys which want to know what the hell it is in the user space and kernel space should be to learn systemtap which is awesome tool:)
Table of Contents
requirements
We need systemtap and dwarf. some scripts are working on kernel space and other is working on the user space.
For kernel space, we need kernel debuginfo like
kernel-debuginfo-3.10.0-327.28.3.el7.x86_64.For user space, we need user application debuginfo like
redis-debuginfo-2.8.19-2.el7.x86_64.For redhat* linux version, we can install as the following:
contribute
You can choose the ways as the following to help this project.
thanks
Special thanks to @brendangregg、 @agentzh and @fche. All we have learn for systemtap is from their amazing blog posts and projects:)
tcp-passive-syn-ack-time
It’s used to measure the time of syn packet to ack packet on the server side in the tcp-3-shakehands(Thanks tcpguide).
tcp-active-syn-ack-time
It’s used to measure the time of syn packet to ack packet on the client side in the tcp-3-shakehands(Thanks tcpguide).
tcp-retrans
It’s used to collecting which tcp packet being retransmit
who-open-file
It’s used to find who is opening the specified file
who-ctxswitch-process
Tracing context switch for specified process.
syscall-connect
It’s used to tracing syscall.connect
sample-bt
It’s from agentzh and be used to sampling the backtrace in the user space and kernel space.
watch-var
It’s used to monitor function param changing.
tcp-trace-packet
Like tcpdump, it’s used to tracing tcp packet with more detail include tcp flag.
ngx-req-watch
It tracing the userland, which can watch and filter by specified condition nginx request in real time
stracelike
Like strace. But it’s based on the systemtap
redis-watch-req
It tracing the userland, which can watch and filter by specified condition redis request in real time
libcurl-watch-req
It traceing the userland, which can watch and filter by specified condition request for softawre which are based on the libcurl like
curlandphp.pdomysql-watch-query
It traceing the userland, which can watch and filter by specified condition request for php’s pdo mysql driver.
phpredis-watch-req
It traceing the userland, which can trace the php redis request
io-process-top
It traceing io Read|Write with the view of process(pid).