stress介绍
stress是一款压力测试工具,可以用它来对系统CPU,内存,以及磁盘IO生成负载
下载路径:
链接:https://pan.baidu.com/s/14MYLYPpiw8RATHchkjH3IA?pwd=lz52
提取码:lz52
stress的使用命令
-?, --help show this help statement
--version show version statement
-v, --verbose be verbose
-q, --quiet be quiet
-n, --dry-run show what would have been done
-t, --timeout N timeout after N seconds
--backoff N wait factor of N microseconds before work starts
-c, --cpu N spawn N workers spinning on sqrt()
-i, --io N spawn N workers spinning on sync()
-m, --vm N spawn N workers spinning on malloc()/free()
--vm-bytes B malloc B bytes per vm worker (default is 256MB)
--vm-stride B touch a byte every B bytes (default is 4096)
--vm-hang N sleep N secs before free (default none, 0 is inf)
--vm-keep redirty memory instead of freeing and reallocating
-d, --hdd N spawn N workers spinning on write()/unlink()
--hdd-bytes B write B bytes per hdd worker (default is 1GB)
以下是一些测试用例
1、测试CPU负荷
stree -c 6 #增加6个cpu进程,处理sqrt()函数函数,以提高系统CPU负荷
2、内存测试
stress -i 6 --vm 10 --vm-bytes 1G --vm-hang 60 --timeout 60s
#新增6个io进程,10个内存分配进程,每次分配大小1G,分配后不释放,测试60S
3、磁盘I/O测试
stress -d 1 --hdd-bytes 5G #新增1个写进程,每次写5G文件块