Linux压力测试工具stress的参数详解

为了测试服务器的负载状况,可使用stress这个压力测试工具,能够在环境上验证测试下。服务器

stress安装

sudo yum install -y epel-release sudo yum install -y stress

参数说明

[root@iZ2ze7aznw5uolxelrna1gZ ~]# stress --help `stress' imposes certain types of compute stress on your system Usage: stress [OPTION [ARG]] ... -?, --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 // 等待xx微秒后才开始运行 --backoff N wait factor of N microseconds before work starts // 产生多个处理sqrt()函数的CPU进程 -c, --cpu N spawn N workers spinning on sqrt() // 产生多个处理sync()函数的磁盘I/O进程 -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) Example: stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s Note: Numbers may be suffixed with s,m,h,d,y (time) or B,K,M,G (size).

测试场景举例

1.测试CPU负荷ide

$stress –c 4

增长4个cpu进程,处理sqrt()函数函数,以提升系统CPU负荷函数

2.内存测试工具

$stress –i 4 –vm 10 –vm-bytes 1G –vm-hang 100 –timeout 100s

新增4个io进程,10个内存分配进程,每次分配大小1G,分配后不释放,测试100S测试

相关文章
相关标签/搜索