Stress test CPU for load, capacity planning, and chaos scenarios with stress-ng, stress, and sysbench.
Agentic Workflow: Read -> Reason -> Act (cpu-stress-testing)
You are Cpu Stress Testing (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for cpu-stress-testing
- Domain: Stress test CPU for load, capacity planning, and chaos scenarios with stress-ng, stress, and sysbench.
- stress-tools: Drive CPU to saturation with stress-ng, stress, and sysbench and monitor utilization —
stress-ng --cpu 8 --timeout 60s
- monitoring: Monitor CPU utilization and thermal/load behavior during the stress window —
top -bn1 | head -15
- Check
knowledge and prerequisites: mpstat, stress, stress-ng, sysbench
2. Reason — think for cpu-stress-testing
- For
stress-tools: Drive CPU to saturation with stress-ng, stress, and sysbench and monitor utilization — decide which checks to run
- For
monitoring: Monitor CPU utilization and thermal/load behavior during the stress window — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with cpu-stress-testing tools
- Tools:
Glob, Grep, Read, Stress-ng, Sysbench (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
cpu-stress-testing:d102f57a
CPU Stress Testing
Saturate CPU in a controlled way to validate capacity and resilience.
When to Use
- Capacity planning for API servers
- Testing autoscaling and CPU alerts
- Chaos scenarios: CPU spike during deployments
Install
# Debian/Ubuntu
sudo apt install stress-ng sysbench stress
# macOS
brew install stress-ng
Stress Runs
# All cores, 60 seconds
stress-ng --cpu 8 --timeout 60s
# 80% load on 4 cores
stress-ng --cpu 4 --cpu-load 80 --timeout 30s
# Classic stress
stress --cpu 4 --timeout 60
# sysbench prime test
sysbench cpu --cpu-max-prime=20000 --threads=4 run
Metrics
stress-ng --cpu 8 --timeout 60s --metrics-brief
mpstat -P ALL 1 5
vmstat 1 5
top -bn1 | head -15
Measuring Saturation
stress-ng reports bogo-ops per second as a throughput proxy; sysbench reports total time and events per second.
Testing
# Verify alert fires at 90%+ utilization during the window
stress-ng --cpu 4 --cpu-load 95 --timeout 120s
Best Practices
- Never run stress tests on production without approval
- Use --cpu-load to simulate realistic partial saturation
- Run a baseline before the test
- Pair with monitoring to correlate latency and CPU
- Set hard timeouts to avoid runaway load
- Use --metrics-brief for machine-readable results
- Check thermal throttling on physical hosts
Capabilities
stress-tools
Drive CPU to saturation with stress-ng, stress, and sysbench and monitor utilization
Parameters:
workers (string): Number of CPU workers
timeout (string): Duration such as 60s or 1m
Commands:
stress-ng --cpu 8 --timeout 60s
stress-ng --cpu 4 --cpu-load 80 --timeout 30s
sysbench cpu --cpu-max-prime=20000 --threads=4 run
stress --cpu 4 --timeout 60
Examples:
- stress-ng --cpu 8 --timeout 60s
- stress-ng --cpu 4 --cpu-load 75 --timeout 120s --metrics-brief
- sysbench cpu --cpu-max-prime=10000 --threads=1 run
monitoring
Monitor CPU utilization and thermal/load behavior during the stress window
Parameters:
interval (string): Sample interval in seconds
Commands:
top -bn1 | head -15
mpstat -P ALL 1 5
stress-ng --cpu 8 --timeout 60s --metrics-brief
vmstat 1 5
Examples:
- top -bn1 | head -15
- mpstat -P ALL 1 3
- vmstat 1 5
References
1---2name: "cpu-stress-testing"3description: "Stress test CPU for load, capacity planning, and chaos scenarios with stress-ng, stress, and sysbench. Use when working with stress tools, monitoring, api or when the user mentions stress tools, monitoring, api."4license: "MIT"5compatibility: "Requires mpstat, stress, stress-ng, sysbench, top, vmstat."6metadata:7 source: https://skillmd.com/skills/opknock/cpu-stress-testing8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(mpstat:*) Bash(stress:*) Bash(stress-ng:*) Bash(sysbench:*) Bash(top:*) Bash(vmstat:*)"12---1314Stress test CPU for load, capacity planning, and chaos scenarios with stress-ng, stress, and sysbench.1516## Agentic Workflow: Read -> Reason -> Act (cpu-stress-testing)1718You are **Cpu Stress Testing** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `cpu-stress-testing`21- Domain: Stress test CPU for load, capacity planning, and chaos scenarios with stress-ng, stress, and sysbench.22- **stress-tools**: Drive CPU to saturation with stress-ng, stress, and sysbench and monitor utilization — `stress-ng --cpu 8 --timeout 60s`23- **monitoring**: Monitor CPU utilization and thermal/load behavior during the stress window — `top -bn1 | head -15`24- Check `knowledge` and `prerequisites: mpstat, stress, stress-ng, sysbench`2526### 2. Reason — think for `cpu-stress-testing`27- For `stress-tools`: Drive CPU to saturation with stress-ng, stress, and sysbench and monitor utilization — decide which checks to run28- For `monitoring`: Monitor CPU utilization and thermal/load behavior during the stress window — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `cpu-stress-testing` tools32- Tools: `Glob`, `Grep`, `Read`, `Stress-ng`, `Sysbench` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `cpu-stress-testing:d102f57a`3536# CPU Stress Testing3738Saturate CPU in a controlled way to validate capacity and resilience.3940## When to Use4142- Capacity planning for API servers43- Testing autoscaling and CPU alerts44- Chaos scenarios: CPU spike during deployments4546## Install4748```bash49# Debian/Ubuntu50sudo apt install stress-ng sysbench stress51# macOS52brew install stress-ng53```5455## Stress Runs5657```bash58# All cores, 60 seconds59stress-ng --cpu 8 --timeout 60s6061# 80% load on 4 cores62stress-ng --cpu 4 --cpu-load 80 --timeout 30s6364# Classic stress65stress --cpu 4 --timeout 606667# sysbench prime test68sysbench cpu --cpu-max-prime=20000 --threads=4 run69```7071## Metrics7273```bash74stress-ng --cpu 8 --timeout 60s --metrics-brief75mpstat -P ALL 1 576vmstat 1 577top -bn1 | head -1578```7980## Measuring Saturation8182stress-ng reports bogo-ops per second as a throughput proxy; sysbench reports total time and events per second.8384## Testing8586```bash87# Verify alert fires at 90%+ utilization during the window88stress-ng --cpu 4 --cpu-load 95 --timeout 120s89```9091## Best Practices9293- Never run stress tests on production without approval94- Use --cpu-load to simulate realistic partial saturation95- Run a baseline before the test96- Pair with monitoring to correlate latency and CPU97- Set hard timeouts to avoid runaway load98- Use --metrics-brief for machine-readable results99- Check thermal throttling on physical hosts100101## Capabilities102103### stress-tools104Drive CPU to saturation with stress-ng, stress, and sysbench and monitor utilization105106**Parameters:**107- `workers` (string): Number of CPU workers108- `timeout` (string): Duration such as 60s or 1m109110**Commands:**111- `stress-ng --cpu 8 --timeout 60s`112- `stress-ng --cpu 4 --cpu-load 80 --timeout 30s`113- `sysbench cpu --cpu-max-prime=20000 --threads=4 run`114- `stress --cpu 4 --timeout 60`115116**Examples:**117- stress-ng --cpu 8 --timeout 60s118- stress-ng --cpu 4 --cpu-load 75 --timeout 120s --metrics-brief119- sysbench cpu --cpu-max-prime=10000 --threads=1 run120121### monitoring122Monitor CPU utilization and thermal/load behavior during the stress window123124**Parameters:**125- `interval` (string): Sample interval in seconds126127**Commands:**128- `top -bn1 | head -15`129- `mpstat -P ALL 1 5`130- `stress-ng --cpu 8 --timeout 60s --metrics-brief`131- `vmstat 1 5`132133**Examples:**134- top -bn1 | head -15135- mpstat -P ALL 1 3136- vmstat 1 5137138## References139- [stress-ng reference](https://manpages.ubuntu.com/manpages/trusty/man1/stress-ng.1.html)140- [sysbench documentation](https://github.com/akopytov/sysbench)