ColinIanKing / stress-ng

This is the stress-ng upstream project git repository. 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.
https://github.com/ColinIanKing/stress-ng
GNU General Public License v2.0
1.82k stars 290 forks source link

How long does it take for stress-ng to get to a certain cpu load? #412

Closed kmmelcher closed 4 months ago

kmmelcher commented 4 months ago

I'm doing some experiments with stress-ng and I'm trying to understand its behaviour.

I'm running this command:

$ stress-ng --cpu 1 --cpu-load 70 --timeout 15m

This will cause the stress-ng tool to run for 15min using 70% of one CPU right? But as far as I know the 70% cpu usage won't be achieved automatically since stress tests needs to start up to get to that desired cpu usage, right? Any idea how long does it take to get to that desired cpu? Are we talking about 1-2 minutes or 5-10 seconds?

ColinIanKing commented 4 months ago

it depends on several factors, the kernel being used, the scheduler being used, the scheduling HZ rate (250, 300 or 1000 Hz), the processor speed and number of processors. Should be within 60 seconds, but it may vary. Also, it's hard to get an exact load when processors have frequency scaling and turbo speeds since this changes the amount of work done per scheduling quanta so it may have some jitter. The code uses a first degree feedback loop, so it may suffer from some oscillation in the short term until it reaches a steady state.

I suggest using the stress-ng --vmstat 1 option to see how the load is varying over time.

kmmelcher commented 4 months ago

Thanks @ColinIanKing!