I am using stress --hdd 1 --timeout 10s -v to stress the IO/disk on an Ubuntu system. Sometimes when running this command, I get something like:
stress: info: [16420] dispatching hogs: 0 cpu, 0 io, 0 vm, 1 hdd
...
stress: info: [16420] successful run completed in 13s
and other times I got something like:
...
stress: info: [16390] successful run completed in 31s
With iostat -yx 1 open in a separate terminal, I can indeed see that the %util and aqu-sz size stay high for roughly that longer-than-specified amount of time. I also see the mmcqd/0 process at the top of top.
How can I get the IO stress to stop within +2 seconds of the --timeout argument given in the stress command?
I have tried stuff like timeout 10 stress --hdd 1 --timeout 10s -v; pkill stress; pkill mmcqd;
without much success. Is there a way to purge the IO queue?
Thanks!
I'm the author of stress-ng. The timeout option will send a SIGALRM to the stressor, however the stressor may be blocked on pending I/O such as waiting for writes or reads or syncs to complete. Basically, a write/read/sync system call has been made and we are at the mercy of when the kernel will complete these actions before handling the signal. After the stressor handles the SIGALRM signal it then completes the stressor loop and will tidy up any files it has used and again, this may take a while if there are of files or the kernel takes a while to unlink the files from the file system.
Hence the delay. There is no easy way around this.