前言

      stress-ng是一个Linux命令行工具,用于测试系统的稳定性和性能。它可以模拟CPU、内存、磁盘、网络、文件系统等方面的负载,以测试系统在高负载下的表现。

       stress-ng支持多种负载模式,包括CPU计算、内存分配、磁盘读写、网络测试、文件系统测试等。用户可以根据自己的需求选择相应的负载模式,并设置负载级别、持续时间等参数来控制测试的强度和时长。

       使用stress-ng可以帮助系统管理员和开发人员发现系统中的性能和稳定性问题,以便及时采取措施进行优化和修复。同时,stress-ng也可以用于测试硬件设备的性能和可靠性,以评估其适用性和可靠性。

       stress-ng的官方项目地址:https://github.com/ColinIanKing/stress-ng

1.stress-ng特性QA       

     stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces. Stress-ng features:

  • 300+ stress tests
  • 80+ CPU specific stress tests that exercise floating point, integer, bit manipulation and control flow
  • 20+ virtual memory stress tests
  • 40+ file system stress tests
  • 30+ memory/CPU cache stress tests
  • portable: builds on Linux (Debian, Devuan, RHEL, Fedora, Centos, Slackware OpenSUSE, Ubuntu, etc..), Solaris, FreeBSD, NetBSD, OpenBSD, DragonFlyBSD, Minix, Android, MacOS X, Serenity OS, GNU/Hurd, Haiku, Windows Subsystem for Linux and SunOs/Dilos/Solaris. with gcc, musl-gcc, clang, icc, icx, tcc and pcc.
  • tested on alpha, armel, armhf, arm64, hppa, i386, m68k, mips32, mips64, power32, ppc64el, risc-v, sh4, s390x, sparc64, x86-64

stress-ng was originally intended to make a machine work hard and trip hardware issues such as thermal overruns as well as operating system bugs that only occur when a system is being thrashed hard. Use stress-ng with caution as some of the tests can make a system run hot on poorly designed hardware and also can cause excessive system thrashing which may be difficult to stop.

stress-ng can also measure test throughput rates; this can be useful to observe performance changes across different operating system releases or types of hardware. However, it has never been intended to be used as a precise benchmark test suite, so do NOT use it in this manner.

Running stress-ng with root privileges will adjust out of memory settings on Linux systems to make the stressors unkillable in low memory situations, so use this judiciously. With the appropriate privilege, stress-ng can allow the ionice class and ionice levels to be adjusted, again, this should be used with care.

     上面是节选自项目README文件的说明部分,接下来我们会以此对stress-ng的各项特性做出概述性说明,然后在后续文档逐步深入stress-ng这一优秀的开源测试工具。


1.1stress-ng与stress的关系QA

       streess-ngstress工具的迭代版本,是在stress工具基础之上的新版本。

1.2stress-ng支持的测试项QA

       stress-ng将以多种可组合的方式对系统进行压力测试。 它旨在测试计算机的各个子系统以及各种操作系统内核接口。 目前的stress-ng已支持:

  • 300+ 压力测试项
  • 80+ 特定于CPU的压力测试项,执行浮点数、整数、位操作和控制流20+ 虚拟内存压力测试项
  • 40+ 文件系统压力测试项
  • 30+ 内存/CPU缓存压力测试项
  • 还可以测量测试吞吐率; 这对于观察不同操作系统版本或硬件类型的性能变化很有用。 但是,它从未打算用作精确的基准测试套件,所以不要以这种方式使用它


1.3stress-ng移植QA

 stress-ng可移植于以下操作系统:

       基于Linux(Debian、Devuan、RHEL、Fedora、Centos、SlackwareOpenSUSE、Ubuntu等)、Solaris、FreeBSD、NetBSD、OpenBSD、DragonFlyBSD、Minix、Android、MacOSX、SerenityOS、GNU/Hurd,Haiku,Linux和SunOs/Dilos/Solaris的Windows系统

 stress-ng支持的编译器:

        gcc、musl-gcc、clang、icc、icx、tcc和pcc

stress-ng支持以下架构:

       alpha、armel、armhf、arm64、hppa、i386、m68k、mips32、mips64、power32、ppc64el、risc-v、sh4、s390x、sparc64、x86-64

1.4stress-ng使用注意事项QA

       stress-ng最初旨在让机器努力工作并解决硬件问题,例如热超限以及操作系统错误,这些问题仅在系统受到重创时才会发生。 请谨慎使用stress-ng,因为某些测试可能会使系统在设计不佳的硬件上运行过热,并且还会导致可能难以停止的过度系统抖动。

       在以root权限运行stress-ng时将,stress-ng会调整Linux系统上的内存不足设置,使压力源在内存不足的情况下无法被杀死,因此请谨慎使用。 通过适当的权限,stress-ng可以允许调整ionice classionice level,同样,这也应该小心使用。

尾言

      本文写作的目的,是为了研究stress-ng的负载设计原理,所以对于编译、安装,网络上有很多帖子,所以本文不再赘述!

      因为限于作者的说平,文章可能存在疏漏之处,希望发现的大神,可以不吝赐教,thanks:)