一、磁盘
dd命令测试读写性能 if – in file of – out file
1)dd测试写性能
10-243-14-95:~ # time dd if=/dev/zero of=test.file bs=8k count=128000 oflag=direct,nonblock
dd: error writing 'test.file': No space left on device
121916+0 records in
121915+0 records out
998727680 bytes (999 MB, 952 MiB) copied, 97.6907 s, 10.2 MB/s
real 1m37.694s
user 0m0.201s
sys 0m3.930s
2)dd测试读性能
10-243-14-95:~ # dd if=test.file of=/dev/null bs=8k count=128000 iflag=direct,nonblock
121915+0 records in
121915+0 records out
998727680 bytes (999 MB, 952 MiB) copied, 46.7931 s, 21.3 MB/sif
3)pidstat查看读写的进程
kB_rd/s :每秒从磁盘读取的KB
kB_wr/s :每秒写入磁盘KB
sort:-n 按数值比较,-r倒序,-k指定列,-t指定分隔符,-u去重
10-243-14-95:~ # pidstat -d | sort -nrk 4 |head
11:21:46 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command
11:21:10 0 1 35.87 522.13 100.04 4086 systemd
11:21:10 2100 41661 27.09 45.41 0.00 1092 gaussdb
11:21:10 2000 4753 8.62 291.22 40.78 0 java
11:21:10 2000 40819 4.73 12.28 0.23 0 java
11:21:10 2100 42875 0.19 32.77 0.00 688994 gaussdb
4)iostat查看所有磁盘读写的情况
10-243-14-95:~ # iostat
Linux 4.12.14-122.71-default (10-243-14-95) 07/25/22 _x86_64_ (16 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
19.83 0.14 10.6