线上问题

./pidstat -w
Linux 3.6.5-Broadcom Linux ((none)) 03/21/20 _armv7l_ (1 CPU)
15:04:17 UID PID cswch/s nvcswch/s Command
15:04:17 0 1 0.03 0.00 busybox
15:04:17 0 2 0.00 0.00 kthreadd
15:04:17 0 3 0.11 0.00 ksoftirqd/0
15:04:17 0 5 0.00 0.00 kworker/0:0H
15:04:17 0 6 0.02 0.00 kworker/u:0
15:04:17 0 7 0.00 0.00 kworker/u:0H
15:04:17 0 8 0.00 0.00 migration/0
15:04:17 0 9 0.00 0.00 khelper
15:04:17 0 10 0.00 0.00 kdevtmpfs
15:04:17 0 11 1.22 0.00 kworker/0:1
15:04:17 0 442 55.11 0.08 spi1-list
15:04:17 0 461 30.52 0.03 mtdblock1
15:04:17 0 1026 0.48 17.77 db-server
/var #./iostat
Linux 3.6.5-Broadcom Linux ((none)) 03/26/20 _armv7l_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle
11.18 0.00 3.47 1.60 0.00 83.74 Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
mtdblock3 0.10 4.69 0.00 0.00 2633845 0 0 #./iostat -d 1
Linux 3.6.5-Broadcom Linux ((none)) 03/26/20 _armv7l_ (1 CPU) Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
mtdblock3 0.10 4.69 0.00 0.00 2635418 0 0 Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
mtdblock3 7.44 299.17 0.00 0.00 362 0 0 Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
mtdblock3 9.09 422.73 0.00 0.00 465 0 0 Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
mtdblock3 2.91 189.32 0.00 0.00 195 0 0 ^C
#./pidstat -d 1 2
Linux 3.6.5-Broadcom Linux ((none)) 03/26/20 _armv7l_ (1 CPU) 15:23:15 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command 15:23:16 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command Average: UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command
#top
Mem: 162664K used, 75868K free, 0K shrd, 5516K buff, 27328K cached
CPU: 37% usr 11% sys 0% nic 0% idle 50% io 0% irq 0% sirq
Load average: 4.83 4.53 4.44 1/122 983
PID PPID USER STAT VSZ %VSZ %CPU COMMAND
1029 909 root S 113m 48% 6% /user/sbin/ops-
1026 909 root S 9588 4% 6% /user/sbin/ovsdb-server --remote=punix
442 2 root SW 0 0% 1% [spi1-list]
461 2 root SW 0 0% 1% [mtdblock1]
1187 909 root S 19812 8% 1% /user/sbin/logs -n /dev/user_log
1028 909 root S 24340 10% 1% /user/sbin/helper -n /dev/user_a
1055 909 root S 48688 20% 0% /user/sbin/lagd --pidfile --log-w
1119 909 root S 26016 11% 0% /user/sbin/clid
1056 909 root S 8680 4% 0% /user/sbin/arpmgrd --pidfile --log
1111 909 root S 3044 1% 0% /user/boa -d
3368 850 root S 1616 1% 0% /usr/sbin/drop
980 3401 root R 848 0% 0% top
1102 909 root S 37656 16% 0% /user/sbin/ops-loop
1118 909 root S 37192 16% 0% /user/sbin/confd
1033 909 root S 34724 15% 0% /user/sbin/pidfile
1044 909 root S 33116 14% 0% /user/sbin/xxxx
1039 909 root S 26344 11% 0% /user/sbin/vtysh -N
1169 909 root S 24512 10% 0% /user/sbin/nlack
1063 909 root S 23020 10% 0% /user/sbin/user
^C061 909 root S 13740 6% 0% /user/sbin/xxxxx

说明:IO 高,Cswch/s:每秒主动任务上下文切换数量 高, 但是看不到具体进程io数据,说明是内存 cache bufer导致io 高需要vmstat 工具查看。

附上:pidstat 用法:pidstat [ 选项 ] [ <时间间隔> ] [ <次数> ]

常用的参数:

  • -u:默认的参数,显示各个进程的cpu使用统计
  • -r:显示各个进程的内存使用统计
  • -d:显示各个进程的IO使用情况
  • -p:指定进程号
  • -w:显示每个进程的上下文切换情况
  • -t:显示选择任务的线程的统计信息外的额外信息

pidstat -u
使用-u选项,pidstat将显示各活动进程的cpu使用统计,执行”pidstat -u”与单独执行”pidstat”的效果一样。
pidstat -r
/var #./pidstat -r 1 3
Linux 3.6.5-Broadcom Linux ((none)) 03/26/20 _armv7l_ (1 CPU)

16:55:32 UID PID minflt/s majflt/s VSZ RSS %MEM Command
16:55:34 0 463 715.09 0.00 5232 2496 1.05 pidstat
16:55:34 0 909 8.49 0.00 8520 1276 0.53 xxxx
16:55:34 0 1026 16.98 0.00 9624 3672 1.54 xx-server
16:55:34 0 1028 47.17 0.00 24340 3932 1.65 xxx
16:55:34 0 1029 36.79 0.00 115900 29044 12.18 ops-xxx
16:55:34 0 1033 0.94 0.00 34724 3488 1.46 ops-xx
16:55:34 0 1039 6.60 0.00 26016 4512 1.89 eee
16:55:34 0 1044 3.77 0.00 33116 2120 0.89 ops-xxx
16:55:34 0 1055 9.43 0.00 48688 2392 1.00 xx-xx
16:55:34 0 1056 2.83 0.00 8680 2360 0.99 ops-xx
16:55:34 0 1063 12.26 0.00 23020 1952 0.82 xxx-xxx
16:55:34 0 1102 0.94 0.00 37656 2548 1.07 ops-xx-de
16:55:34 0 1118 10.38 0.00 37192 14432 6.05 xxx
16:55:34 0 1125 12.26 0.00 8552 1200 0.50 xx
16:55:34 0 1169 0.94 0.00 24512 1196 0.50 xxx
16:55:34 0 1187 0.94 0.00 19812 816 0.34 logs

使用-r选项,pidstat将显示各活动进程的内存使用统计
ID:进程标识符
Minflt/s:任务每秒发生的次要错误,不需要从磁盘中加载页
Majflt/s:任务每秒发生的主要错误,需要从磁盘中加载页
VSZ:虚拟地址大小,虚拟内存的使用KB
RSS:常驻集合大小,非交换区五里内存使用KB
Command:task命令名

pidstat -d 1 3
#./pidstat -d 1 3
Linux 3.6.5-Broadcom Linux ((none)) 03/26/20 _armv7l_ (1 CPU)

17:02:05 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command

17:02:06 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command

17:02:07 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command

Average: UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command

报告IO统计显示以下信息:
PID:进程id
kB_rd/s:每秒从磁盘读取的KB
kB_wr/s:每秒写入磁盘KB
kB_ccwr/s:任务取消的写入磁盘的KB。当任务截断脏的pagecache的时候会发生。
COMMAND:task的命令名

每个进程的上下文切换情况(-w)
pidstat -w -p 2831
./pidstat -w -p 1111 1 3
Linux 3.6.5-Broadcom Linux ((none)) 03/26/20 _armv7l_ (1 CPU)

17:05:05 UID PID cswch/s nvcswch/s Command
17:05:06 0 1111 13.59 0.00 boa
17:05:07 0 1111 34.65 21.78 boa
17:05:08 0 1111 41.58 117.82 boa
Average: 0 1111 29.84 46.23 boa
PID:进程id
Cswch/s:每秒主动任务上下文切换数量
Nvcswch/s:每秒被动任务上下文切换数量
Command:命令名

选择任务的线程的统计信息外的额外信息 (-t)
./pidstat -t -p 1026 1 3
Linux 3.6.5-Broadcom Linux ((none)) 03/26/20 _armv7l_ (1 CPU)

17:07:05 UID TGID TID %usr %system %guest %wait %CPU CPU Command
17:07:06 0 1026 - 0.00 0.00 0.00 0.00 0.00 0 xx-server
17:07:06 0 - 1026 0.00 0.00 0.00 0.00 0.00 0 |xxx-server

17:07:06 UID TGID TID %usr %system %guest %wait %CPU CPU Command
17:07:07 0 1026 - 6.93 0.99 0.00 0.00 7.92 0 xx-server
17:07:07 0 - 1026 6.93 0.99 0.00 0.00 7.92 0 |xx-server

TGID:主线程的表示
TID:线程id
%usr:进程在用户空间占用cpu的百分比
%system:进程在内核空间占用cpu的百分比
%guest:进程在虚拟机占用cpu的百分比
%CPU:进程占用cpu的百分比
CPU:处理进程的cpu编号
Command:当前进程对应的命令

最新文章

  1. es6 class
  2. Json的序列化与反序列化
  3. php课程---练习(发布新闻)
  4. ZoomBar 设计
  5. sql-select
  6. Http错误 404.3-Not Found....或者500.19 Internal Server Error
  7. php正则:匹配(),{},[]小括号,大括号,中括号里面的内容
  8. PYTHON ASYNCIO: FUTURE, TASK AND THE EVENT LOOP
  9. 3ds max 2016 新功能
  10. JavaScipt实现倒计时方法总结
  11. Jmeter==HTTP信息头管理器的作用
  12. 洛谷 [P1341]无序字母对
  13. 获取客户信息SQL
  14. flask模板
  15. 水晶报表,快速报表,rdlc报表
  16. git add.后回退 代码丢失
  17. git怎么fork一个仓库并pull request
  18. Spring mvc前台后台传值
  19. Centos7部署ntp服务器同步时间以及直接将本地时间同步为北京时间
  20. centos7+apache+svn配置 踩坑,注意权限问题。apache应用目录checkout应用 必须用这个命令:svn co file:///home/svn/test/ test ,通过svn add * &amp;&amp;commit 及任意修改都是不行的

热门文章

  1. rs485转以太网转换器
  2. Prometheus入门教程(二):Prometheus + Grafana实现可视化、告警
  3. java中的t怎么用
  4. 使用python编写正逆序乘法表
  5. 微信小程序 - 重置checkbox样式
  6. 不是计算机专业的,可以转专业甚至转行学IT吗?答案揭晓~
  7. git删除缓存区中文件
  8. Layui treeSelect 回写与对应选中
  9. Chrome FeHelper 插件下载地址
  10. Linux服务器部署redis常见问题处理