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

-vm N in command line, but only one worker #377

Closed Cautreoxit closed 7 months ago

Cautreoxit commented 7 months ago

Hi, I am using stress-ng --vm 1 --vm-bytes 1200M --timeout 10 --vm-keep on my virtual machine, which has memory below: image It could finish correctly. When I changed 1200 to 1500, it showed no enough memory. It was as my expected, because the free space added was more than 1200M but less than 1500M. Then I changed 1500 back to 1200, and changed --vm 1 to --vm 2. I thought it would fail again, because in my expection, it means creating two workers, each of which occupy 1200M in the whole 10s, so they would consume 2400M in total. But when I executed it, it did not fail, and when I checked my vmstat_output which constantly monitored my system, the output was similar to --vm 1. So, it seemed that there is no actual difference between --vm 1 and --vm 2 in my machine. Why? And if I want to use --vm 2, should I make some configurations? Thank you very much! It is important and urgent for me, so I would appreciate if you could help me soon.

ColinIanKing commented 7 months ago

Hi, it appears the manual is incorrect and I will correct that later today. The --vm-bytes option selects the total memory to use shared amongst all the N workers rather than memory to use per worker. Hence for a setting of 1500M this will be divided by the number of workers, so for --vm 2 this will be 750M per worker.

ColinIanKing commented 7 months ago

Note one can use a % of the machine's memory for the vm-bytes option, e.g --vm-bytes 90% which means allocate 90% of available free memory and share it between the N vm workers

Cautreoxit commented 7 months ago

I see. Thank you very much! And I am wondering why such a popular and long-time tool has an error in manual, while no one has proposed it haha.

ColinIanKing commented 7 months ago

I guess nobody reads the manual ;-)