The CPU load is generated inside the target container's cgroup, so it is capped by the container's CPU limit. The load percentage is relative to that limit; for a container without a CPU limit it is relative to the CPUs the container may use on the host.
The host's resources are still shared between containers. Neighbouring workloads can be affected through shared node resources (for example CPU time they would otherwise burst into, CPU caches or memory bandwidth), especially on overcommitted nodes or when the target container has no CPU limit.
Use Cases
Test your application's resilience to high CPU load
Parameters
Parameter
Description
Default
Load on Container CPU
How much CPU load should be inflicted?
80%
Container CPUs
How many workers should be used to stress the CPU?
All Cores
Duration
How long should CPU be consumed?
30s
Frequently Asked Questions (FAQs)
Q: My container has a limit of 500m, set the attack to 100% load but only observe 35-45% CPU usage. Why?
A:stress-ng under the hood generates the load and tries to meet the targeted load, but the Kernel scheduler may assign fewer CPU time slots to the process, resulting in lower CPU usage than desired. For target containers with a higher limit, the desired CPU load is more likely to be met.