0

I have 8GB RAM and 20GB swap. If I run

stress -m 1 --vm-bytes 8G --vm-keep

the system cannot be used for a few minutes. the mouse pointer does not use any more. and even after a few minutes, it is very unresponsive. Gnome system monitor shows 10GB Swap used. Why the system becomes so slow?

Edit: I just found this question Prevent Ubuntu from freezing, even if system memory is low

Martin
  • 11
  • Isn't that the point of the stress command? – Jos Dec 20 '19 at 09:49
  • "stress" takes a lot of RAM and the system should write this unused RAM to the swap-SSD to free the RAM for currently used application (foreground). I see no reason why should wait minutes for the system to react to mouse moves. – Martin Dec 20 '19 at 13:15
  • @Martin It takes minutes because reading pages back from swap takes time. – vidarlo Dec 20 '19 at 13:22

1 Answers1

4

It becomes slow because you use all the RAM for your stress test, and things gets written to swap.

Disk storage is orders of magnitude slower than RAM. RAM can handle bandwidths of 10's of GB per second. SSD's can handle single-digit gigabytes per second. Hard disks can manage hundreds of megabytes per second.

This is simply the expected behavior when you over-commit your memory by such an large amount.

vidarlo
  • 22,691