存储相关的Metrics
disk
/proc/diskstats
$ cat /proc/diskstats
8 0 sda 19845 144 2468979 81307 5380 1084 181174 47385 0 19839 128640
8 1 sda1 168 0 48862 7580 10 0 4136 192 0 1151 7772
8 2 sda2 19612 144 2416997 73544 4757 1084 177038 44181 0 18997 117673
11 0 sr0 0 0 0 0 0 0 0 0 0 0 0
253 0 dm-0 19443 0 2407493 73345 5693 0 175134 58916 0 19577 132260
253 1 dm-1 206 0 7024 393 238 0 1904 8073 0 1385 8466
前3项是主设备号,次设备号和设备名称。 后面11个域的描述如下:
Name units description
---- ----- -----------
read I/Os requests 完成的读请求次数
read merges requests 在IO队列中合并的IO次数,对于机械盘来讲,IO合并对性能帮助太大了,
innodb设计中change buffer,double write都有IO合并的影子在里面
read sectors sectors 读取过的扇区数
read ticks milliseconds 读取耗费的总时间
write I/Os requests 完成的写次数
write merges requests 合并的写次数,write merges/(write I/Os)越大,对IO子系统帮助越大
write sectors sectors 写入的扇区数
write ticks milliseconds 写操作耗费的总时间
in_flight requests 当前的IO请求数
io_ticks milliseconds 该设备花在实际IO操作上的时间
time_in_queue milliseconds IO请求在该设备上锁耗费的所有时间
详细描述
第1个域:读完成次数 —– 读磁盘的次数,成功完成读的总次数。
(number of issued reads. This is the total number of reads completed successfully.)
第2个域:合并读完成次数, 第6个域:合并写完成次数。为了效率可能会合并相邻的读和写。从而两次4K的读在它最终被处理到磁盘上之前可能会变成一次8K的读,才被计数(和排队),因此只有一次I/O操作。这个域使你知道这样的操作有多频繁。
(number of reads merged)
第3个域:读扇区的次数,成功读过的扇区总次数。
(number of sectors read. This is the total number of sectors read successfully.)
第4个域:读花费的毫秒数,这是所有读操作所花费的毫秒数(用__make_request()到end_that_request_last()测量)。
(number of milliseconds spent reading. This is the total number of milliseconds spent by all reads (as measured from __make_request() to end_that_request_last()).)
第5个域:写完成次数 —-写完成的次数,成功写完成的总次数。
(number of writes completed. This is the total number of writes completed successfully.)
第6个域:合并写完成次数 —–合并写次数。
(number of writes merged Reads and writes which are adjacent to each other may be merged for efficiency. Thus two 4K reads may become one 8K read before it is ultimately handed to the disk, and so it will be counted (and queued) as only one I/O. This field lets you know how often this was done.)
第7个域:写扇区次数 —- 写扇区的次数,成功写扇区总次数。
(number of sectors written. This is the total number of sectors written successfully.)
第8个域:写操作花费的毫秒数 — 写花费的毫秒数,这是所有写操作所花费的毫秒数(用__make_request()到end_that_request_last()测量)。
(number of milliseconds spent writing This is the total number of milliseconds spent by all writes (as measured from __make_request() to end_that_request_last()).)
第9个域:正在处理的输入/输出请求数 — -I/O的当前进度,只有这个域应该是0。当请求被交给适当的request_queue_t时增加和请求完成时减小。
(number of I/Os currently in progress. The only field that should go to zero. Incremented as requests are given to appropriate request_queue_t and decremented as they finish.)
第10个域:输入/输出操作花费的毫秒数 —-花在I/O操作上的毫秒数,这个域会增长只要field 9不为0。
(number of milliseconds spent doing I/Os. This field is increased so long as field 9 is nonzero.)
第11个域:输入/输出操作花费的加权毫秒数 —– 加权, 花在I/O操作上的毫秒数,在每次I/O开始,I/O结束,I/O合并时这个域都会增加。这可以给I/O完成时间和存储那些可以累积的提供一个便利的测量标准。
(number of milliseconds spent doing I/Os. This field is incremented at each I/O start, I/O completion, I/O merge, or read of these stats by the number of I/Os in progress (field 9) times the number of milliseconds spent doing I/O since the last update of this field. This can provide an easy measure of both I/O completion time and the backlog that may be accumulating.)
Mount point
从 /proc/self/mountinfo 读取 mount信息,用链表保存。
$ cat /proc/self/mountinfo
17 61 0:16 / /sys rw,nosuid,nodev,noexec,relatime shared:6 - sysfs sysfs rw
18 61 0:3 / /proc rw,nosuid,nodev,noexec,relatime shared:5 - proc proc rw
19 61 0:5 / /dev rw,nosuid shared:2 - devtmpfs devtmpfs rw,size=497268k,nr_inodes=124317,mode=755
20 17 0:15 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:7 - securityfs securityfs rw
21 19 0:17 / /dev/shm rw,nosuid,nodev shared:3 - tmpfs tmpfs rw
22 19 0:11 / /dev/pts rw,nosuid,noexec,relatime shared:4 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
23 61 0:18 / /run rw,nosuid,nodev shared:22 - tmpfs tmpfs rw,mode=755
24 17 0:19 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:8 - tmpfs tmpfs ro,mode=755
25 24 0:20 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:9 - cgroup cgroup rw,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd
NFS
- /proc/mdstat 这个文件包含了由md 设备驱动程序控制的RAID 设备信息。
- /proc/net/rpc/nfsd
- /proc/net/rpc/nfs
文件系统
- ZFS /proc/spl/kstat/zfs/arcstats
- btrfs /sys/fs/btrfs
IPC
IPC(Inter-Process Communication)主要手段:信号量、共享内存、消息队列,管道,socket等。
IPC按形式上分可分成4种不同的IPC形式:
- 消息传递(管道、FIFO命名管道、消息队列)
- 同步(互斥量、条件变量、读写锁、文件和记录锁、信号量)
- 共享内存(匿名的和具名的)
- 远过程调用(Solaris门和SunRPC)
ipcs -s:观察信号量信息。文件:/proc/sysvipc/sem ipcs -m:观察共享内存信息。文件:/proc/sysvipc/shm ipcs -q:观察消息队列信息。文件:/proc/sysvipc/msg
来源:oschina
链接:https://my.oschina.net/guopei/blog/4259658