• 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负荷

    $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

  • 相关阅读:
    hdu2438 三分
    hdu3786 找出直系亲属 水题
    hdu3786 找出直系亲属 水题
    hdu4561 连续最大积
    hdu4561 连续最大积
    hdu4604 不错的子序列问题
    hdu4604 不错的子序列问题
    hdu4450 不错的贪心
    hdu1722 切蛋糕
    hdu3768 spfa+全排列
  • 原文地址:https://www.cnblogs.com/winner-0715/p/10243799.html
Copyright © 2020-2023  润新知