stress-ng
This benchmark measures the throughput of CPUCPU: Central Processing UnitThe general-purpose processor of a computer, which runs the operating system and programs. A CPU has one or more physical cores, and with SMT each core runs two or more hardware threads.WikipediaGlossary, memory, and kernel-heavy
workloads with stress-ng. It runs 85 curated stressors in seven categories,
each for 5 seconds (15 seconds for stream), first with one worker and then
with one worker per available CPU. A second mode runs the cpu stressor at
increasing worker counts to trace how throughput scales across cores.
This benchmark reports stress-ng bogo ops/sstress-ng bogo ops/s: bogus operations per secondThe throughput metric of stress-ng: how many times a stressor completes its own unit of work per second. Each stressor defines that unit differently, so the values compare only within one stressor and one stress-ng version.stress-ng man pageGlossary (bogus operations per second) for
each stress-ng stressorstress-ng stressorOne stress test of stress-ng, such as cpu, memcpy, or fork, selected with a command-line option of the same name and run by one or more worker processes.stress-ng man pageGlossary and worker count, as one JSONJSON: JavaScript Object NotationA text format for structured data, built from objects (key-value pairs), arrays, strings, numbers, booleans, and null. Most languages and tools read and write it, which makes it a common format for API responses and benchmark output.JSONGlossary document. The scaling
mode prints one <workers>,<bogo ops/s> line per worker count.
Purpose
Spare Cores Navigator publishes empirical performance measurements for over 5,000 cloud server types, such as raw CPU speed, memory bandwidth, and compression throughput. This benchmark covers a wide range of CPU and memory work in one run, from integer and floating-point math to sorting, hashing, and memory bandwidth.
It also includes a hypervisor category: stressors such as context switches,
page faults, system calls, and timers, whose throughput on a VMVM: virtual machineA computer emulated in software on a physical host, with its own OS and a share of the host's CPUs, memory, and storage. Most cloud servers are VMs.WikipediaGlossary is dominated by
hypervisor overhead. These stressors are meant to expose differences in
virtualization overhead across providers.
The Navigator's Inspector uses the scaling mode to determine a server type's
SCoreSCore: Spare Cores scoreA CPU speed score of a server type in Spare Cores Navigator, used to compare the speed of server types. It is measured with the cpu stressor of stress-ng at increasing worker counts. The single-core SCore is the result with one worker; the multi-core SCore, the raw multi-core CPU speed that SCore means on its own, is the highest result.Glossary (Spare Cores score): its raw multi-core CPU speed, for comparing the
speed of server types. See
CPU Scaling Loop.
The stress-ng-longrun image pins an older
stress-ng version for an experimental 24-hour run on a few server types. The
run shows the following:
- sustained CPU throughput over time
- throttling on shared-coreshared-coreDescribes a cloud server type whose vCPUs share physical cores with other servers, often with a guaranteed baseline of only a fraction of a core. Such server types are cheaper, but their CPU performance can vary with the load of neighboring servers or be limited by CPU credits.Google Cloud shared-core machine typesGlossary server types
- noisy-neighbor variance by time of day
Limitations
These results are synthetic stress-ng throughput figures, not application
performance. The following are the main limitations:
- Not Comparable Across Stressors:
Each stressor counts its own kind of operation, so compare bogo ops/s only
for the same stressor and the same
stress-ngversion. - No Single Score: The stressor suite reports one value per stressor and worker count, and does not combine them.
- Short, Single Runs: Each stressor
runs once for 5s (15s for
stream), with no warm-up and no repetitions. - Logical CPUs, Not Physical Cores:
The multi-worker run uses one worker per logical CPU available to the
container, even though the output field is named
physical_cpus. - Missing Results Are
null: A stressor that fails, times out, or is not supported on the CPU architecture is recorded asnull, and the run still succeeds.
Usage
The image has no default command. Append the stressor suite's command after the image name:
docker run --rm ghcr.io/sparecores/stress-ng:main \
-c 'python3 /usr/local/bin/run_stressng_benchmarks.py' > stress-ng.json
Production also runs the command under nice -n -20niceA Unix command that runs a program with a changed scheduling priority, from -20 (highest) to 19 (lowest). Raising a process's priority above the default needs the CAP_SYS_NICE capability, which root has.man pageGlossary, which needs
--privileged. See Production Setup for
the production commands, including the CPU scaling loop.
The stressor suite took about 7 to 66 minutes in production, about 15 minutes at the median. See Run Duration.
Settings
The following settings shorten a run, for example for a quick check; see the full environment-variable reference for details:
STRESSNG_QUICK=1runs each stressor for 2 seconds instead of 5 seconds (streamstill runs for 15 seconds).STRESSNG_LIMIT=<N>runs only the first N stressors in alphabetical order.
Results
The stressor suite prints one JSON document to stdoutstdoutThe standard output stream of a process, one of the three standard streams with stdin and stderr. Programs write their results to it; a shell can redirect it to a file or another program, such as > results.jsonl, while logs on stderr still reach the terminal.WikipediaGlossary when the run ends.
The JSON document's main fields are the following:
stressors.<name>holds one entry per worker count:"1", and the CPU count for the multi-worker run. Each entry is{"bogo_ops_per_sec": <value>}, the total across all workers, ornullif the run failed.categorieslists the stressors in each of the seven categories.meta.physical_cpusis the worker count of the multi-worker run, andmeta.stressor_countthe number of stressors run.
See Output for every field.
Workloads
This benchmark runs the following workloads:
- Stressor Suite:
run_stressng_benchmarks.pyruns 85 stressors in seven categories, each with one worker and then one worker per CPU. - CPU Scaling Loop: The
cpustressor with the stress-ng div16 methodstress-ng div16 methodA method of thestress-ngcpustressor, selected with--cpu-method div16, in which each operation runs 50,000 16-bit unsigned integer divisions. Integer division takes many CPU cycles and depends little on memory, so it loads the core's arithmetic units directly.stress-ng man pageGlossary runs for 10 seconds at each worker count from 1 up to the CPU count, withcount.awkpicking the counts.
For more information on stressor categories and run order, see Workloads.
Design History
The CPU scaling loop uses the div16 method of the cpu stressor. We ran
every --cpu-method on selected x86_64AMD64The 64-bit version of the x86 instruction set architecture, introduced by AMD in 2003 and also implemented by Intel, which runs most cloud servers. Linux distributions and Docker name it amd64 or x86_64.WikipediaGlossary and Arm servers, with and without SMTSMT: Simultaneous MultithreadingA CPU technique that runs two (or more) hardware threads on one physical core, sharing its execution units, e.g. Intel Hyper-Threading. It raises throughput when a thread stalls, but the threads compete for the core. Cloud vendors usually sell each thread as a vCPU.WikipediaGlossary
(Simultaneous Multithreading). Other methods scaled more or less than
expected: on a server with 2 vCPUsvCPU: virtual CPUA CPU of a virtual machine, the unit in which cloud vendors sell compute. It is usually one hardware thread of a physical core with SMT, so two vCPUs may share one physical core.WikipediaGlossary and SMT, some reached up to 1.8 times the
single-worker throughput with two workers, while div16 stayed at about the
single-worker throughput.
The stressor suite came with an upgrade from stress-ng 0.17.08 to 0.20.01.
At first, only a subset of 23 stressors also ran with all CPUs; now every
stressor does.
See the changelog for the changes to this benchmark.
References
See the full list of references used in this documentation.