systemtap发行版本提供了socktop,用于监控socket套接字之间的通信,具体如下:
[root@db-42 ~]# socktop -h USAGE: socktop [-d] [-i interval] [-N num] [-P protocol]... [-f family]... [-t stype]... [-n pname]... [-p pid]... [-u username]... [-h] -d # print network device traffic (default: off) -i interval # interval in seconds between printing (default: 5) -N num # number of top processes and devices to print (default: 10) -f family # this protocol family only (default: all) -P protocol # this protocol only (default: all) -t stype # this socket type only (default: all) -n pname # this process name only (default: all) -p pid # this process ID only (default: all) -u username # this user only (default: all) -h # print this help text Protocol Families: LOCAL, INET, INET6, IPX, NETLINK, X25, AX25, ATMPVC, APPLETALK, PACKET Protocols: TCP, UDP, SCTP, IP, FC, ... (see /etc/protocols for complete list) Socket Types: STREAM, DGRAM, RAW, RDM, SEQPACKET, DCCP, PACKET
Description
socket() creates an endpoint for communication and returns a descriptor.
The domain argument specifies a communication domain; this selects the protocol family which will be used for communication. These families are
defined in <sys/socket.h>. The currently understood formats include:
Name | Purpose | Man page |
AF_UNIX, AF_LOCAL | Local communication | unix(7) |
AF_INET | IPv4 Internet protocols | ip(7) |
AF_INET6 | IPv6 Internet protocols | ipv6(7) |
AF_IPX | IPX – Novell protocols | |
AF_NETLINK | Kernel user interface device | netlink(7) |
AF_X25 | ITU-T X.25 / ISO-8208 protocol | x25(7) |
AF_AX25 | Amateur radio AX.25 protocol | |
AF_ATMPVC | Access to raw ATM PVCs | |
AF_APPLETALK | Appletalk | ddp(7) |
AF_PACKET | Low level packet interface | packet(7) |
具体安装过程如下,在安装systemtap的前提下:
[root@db-42 ~]# uname -r 2.6.18-194.el5 [root@db-42 ~]# wget ftp://bo.mirror.garr.it/pub/1/slc/updates/slc5X/x86_64/debug/kernel-debuginfo-2.6.18-194.el5.x86_64.rpm --2013-04-23 11:38:06-- ftp://bo.mirror.garr.it/pub/1/slc/updates/slc5X/x86_64/debug/kernel-debuginfo-2.6.18-194.el5.x86_64.rpm => `kernel-debuginfo-2.6.18-194.el5.x86_64.rpm' Resolving bo.mirror.garr.it... 193.206.140.34, 2001:760:ffff:b0::34 Connecting to bo.mirror.garr.it|193.206.140.34|:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD /pub/1/slc/updates/slc5X/x86_64/debug ... done. ==> SIZE kernel-debuginfo-2.6.18-194.el5.x86_64.rpm ... 181856666 ==> PASV ... done. ==> RETR kernel-debuginfo-2.6.18-194.el5.x86_64.rpm ... done. Length: 181856666 (173M) 100%[========================================================================================================================================>] 181,856,666 5.07M/s in 5m 33s 2013-04-23 11:43:48 (533 KB/s) - `kernel-debuginfo-2.6.18-194.el5.x86_64.rpm' saved [181856666] [root@db-42 ~]# rpm -ivh kernel-debuginfo-2.6.18-194.el5.x86_64.rpm warning: kernel-debuginfo-2.6.18-194.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:kernel-debuginfo ########################################### [100%] [root@db-42 ~]# wget ftp://bo.mirror.garr.it/pub/1/slc/updates/slc5X/x86_64/debug/kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm --2013-04-23 11:38:50-- ftp://bo.mirror.garr.it/pub/1/slc/updates/slc5X/x86_64/debug/kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm => `kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm' Resolving bo.mirror.garr.it... 193.206.140.34, 2001:760:ffff:b0::34 Connecting to bo.mirror.garr.it|193.206.140.34|:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD /pub/1/slc/updates/slc5X/x86_64/debug ... done. ==> SIZE kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm ... 32845933 ==> PASV ... done. ==> RETR kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm ... done. Length: 32845933 (31M) 100%[========================================================================================================================================>] 32,845,933 52.6K/s in 45s 2013-04-23 11:39:41 (711 KB/s) - `kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm' saved [32845933] [root@db-42 ~]# rpm -ivh kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm warning: kernel-debuginfo-common-2.6.18-194.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:kernel-debuginfo-common########################################### [100%]
eg:
session 1: SQL> insert into t10 select * from t10; 76074 rows created. SQL> / 152148 rows created. SQL> / 304296 rows created. SQL> / 608592 rows created. SQL> / 1217184 rows created. SQL> / 2434368 rows created. [root@db-42 ~]# socktop -d -i 5 ======================= Tue Apr 23 11:50:07 2013 ======================== ------------------------------- PROCESSES ------------------------------- PID UID #SEND #RECV SEND_KB RECV_KB PROT FAMILY COMMAND 28990 1001 18190 18190 130058 128882 TCP INET extract 29003 1100 18185 18185 128881 130058 TCP INET6 oracle 29001 1100 5 5 1 0 TCP INET6 oracle 2376 1001 1 0 1 0 TCP INET6 sshd 23653 1001 3 0 0 0 TCP INET extract 28834 1001 6 0 0 0 UDP INET6 oracle 28814 1001 0 6 0 0 UDP INET6 oracle -------------------------------- DEVICES -------------------------------- DEV #XMIT #RECV XMIT_KB RECV_KB lo 49559 49559 262136 261458 eth0 9 8 1 0 ========================================================================= [root@db-42 ~]# ps -ef |grep 29003 root 5682 2418 0 12:53 pts/0 00:00:00 grep 29003 grid 29003 1 0 Mar21 ? 00:04:52 oracle+ASM (LOCAL=NO) [root@db-42 ~]# socktop -f LOCAL -i 5 -d ======================= Tue Apr 23 11:56:03 2013 ======================== ------------------------------- PROCESSES ------------------------------- PID UID #SEND #RECV SEND_KB RECV_KB PROT FAMILY COMMAND 4862 1100 3 4 0 1 IP LOCAL lsnrctl 21128 1100 4 3 1 0 IP LOCAL tnslsnr -------------------------------- DEVICES -------------------------------- DEV #XMIT #RECV XMIT_KB RECV_KB lo 85 85 348 347 eth0 10 9 1 0 =========================================================================
可以清楚的看到在batch insert 过程中ASM process正处于频繁的活动中。