子进程频繁创建 linux性能优化学习之一

首先实用sar
运行测试程序之前

# sar -w 2
Linux 5.4.0-26-generic (rlk)    2022年05月28日  _x86_64_        (4 CPU)

06时13分05秒    proc/s   cswch/s
06时13分07秒      0.00    211.50
06时13分09秒      0.00    257.50
06时13分11秒      0.00    230.00
06时13分13秒      0.00    175.50
运行测试程序之后
06时13分25秒    386.00   9949.00
06时13分27秒    403.50  10759.50
06时13分29秒    400.50  10353.00
06时13分31秒    405.50  10423.50
06时13分33秒    414.50  10687.00
06时13分35秒    431.00  10841.50
06时13分37秒    420.50  11696.50
06时13分39秒    432.50  10746.50

-w的含义详见 man sar

-w     Report task creation and system switching activity.

              proc/s
                     Total number of tasks created per second.

              cswch/s
                     Total number of context switches per second.

proc是子进程创建的频率

然后用下述命令查看是什么子进程被频繁创建

# execsnoop-bpfcc
PCOMM            PID    PPID   RET ARGS
sh               628915 613382   0   
sh               628916 613374   0   
stress           628918 628915   0 /usr/local/bin/stress -t 1 -d 1
stress           628919 628916   0 /usr/local/bin/stress -t 1 -d 1
sh               628917 613373   0   
sh               628922 613396   0   
stress           628923 628917   0 /usr/local/bin/stress -t 1 -d 1
stress           628925 628922   0 /usr/local/bin/stress -t 1 -d 1
sh               628924 613387   0   
stress           628928 628924   0 /usr/local/bin/stress -t 1 -d 1
sh               628930 613374   0   
stress           628932 628930   0 /usr/local/bin/stress -t 1 -d 1

由此可见,大量的stress子进程被频繁创建

# pstree | grep stress
        |                 |         `-xxx---sh---stress

由此可见, stress是由父进程xxx创建

参考
bcc工具之execsnoop
https://blog.csdn.net/qq_33894122/article/details/108186999

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值