首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用压力ng模拟工作负载

使用压力ng模拟工作负载
EN

Stack Overflow用户
提问于 2019-11-15 18:48:41
回答 1查看 1K关注 0票数 0

我想用压力来模拟工作量。最终目标是能够以不同任务的百分比加载系统。例如,50%的CPU,25%的IO等等。

所以我从这个命令开始。

代码语言:javascript
复制
sudo stress-ng -v --taskset 1 --sched fifo --sched-prio 80 --perf --all 2 --ioport 1 --ioport-ops 1000000 --matrix 1  -t 60s
代码语言:javascript
复制
stress-ng: debug: [2077] 2 processors online, 2 processors configured
stress-ng: debug: [2077] sched: setting scheduler class 'fifo', priority 80
stress-ng: info:  [2077] dispatching hogs: 1 ioport, 1 matrix
stress-ng: debug: [2077] cache allocate: default cache size: 4096K
stress-ng: debug: [2077] starting stressors
stress-ng: debug: [2077] 2 stressors spawned
stress-ng: debug: [2078] stress-ng-ioport: started [2078] (instance 0)
stress-ng: debug: [2079] stress-ng-matrix: started [2079] (instance 0)

但是,当我监视进程2078和2079时,我注意到只有进程2078在加载CPU。图1

当我换了两个压力源的顺序.

代码语言:javascript
复制
sudo stress-ng -v --taskset 1 --sched fifo --sched-prio 80 --perf --all 2 --matrix 1 --ioport 1 --ioport-ops 1000000   -t 60s
代码语言:javascript
复制
stress-ng: debug: [2084] 2 processors online, 2 processors configured
stress-ng: debug: [2084] sched: setting scheduler class 'fifo', priority 80
stress-ng: info:  [2084] dispatching hogs: 1 matrix, 1 ioport
stress-ng: debug: [2084] cache allocate: default cache size: 4096K
stress-ng: debug: [2084] starting stressors
stress-ng: debug: [2084] 2 stressors spawned
stress-ng: debug: [2085] stress-ng-matrix: started [2085] (instance 0)
stress-ng: debug: [2086] stress-ng-ioport: started [2086] (instance 0)
stress-ng: debug: [2085] stress-ng-matrix using method 'all' (x by y)

只有进程2085正在加载CPU。图2

这表明这两种压力源不是平行运行的。

我怎样才能获得压力源并行运行,而且,比例的两个任务?

是否有更好的开源工具来模拟工作负载?

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-11-16 12:08:18

压力源的设计是为了最大限度地利用资源,所以指定25%的I/O并不容易,因为我们必须估计100%的I/O是什么,然后适当地缩小。由于I/O率可能随时间而变化(因为它最终取决于具体的硬件变量),因此需要有一个二阶差分反馈循环才能使其正常工作,这超出了压力-ng所能做的范围。

另一种看待这个问题的方法是用CPU的数量来衡量事情的规模。假设您的系统上有4个CPU,那么CPU工作的2个CPU= 50%,I/O的一个CPU= 25%,那么运行:

代码语言:javascript
复制
stress-ng --cpu 2 --iomix 1

或者在一个8 CPU系统上,你可以做其他的事情,比如:

代码语言:javascript
复制
stress-ng --matrix 4 --hdd 2
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58882993

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档