Question: I’ve been having this severe performance issue, both in Ubuntu 11.10, and Debian Wheezy:

If one process uses up a great deal of RAM (say, 3700 MB out of 3900 MB), the system quickly becomes unusable, with constant disk thrashing. It gets to the point where the window manager doesn’t respond, and killing the offending process takes several minutes. (Actually getting to a terminal, issuing pkill, waiting a while longer until the signal actually gets through)

This problem occurs even if the swap partition is completely disabled.

Investigating with iotop, it looks like most of the disk activity is disk read, going to processes such as google chrome, and the X window renderer. However, this is only limited information, as iotop no longer updates while the system is in full-thrash mode.


My question is:

1) what is causing the massive disk read?2) how can I prevent this from making the system unusable?

Answer: The system is moving data in RAM in and out of the hard drive to make way for other data in RAM. ?Disk operations are far slower than RAM operations, causing the system to slow down significantly. ?When your system is running out of physical memory, the system does this to expand the amount of “virtual” memory available, at the cost of performance. ?This condition is called thrashing.

Unfortunately, the only full solution to this problem is to add more RAM. ?Memory modules are relatively inexpensive; if you are consistently reaching the limits of available physical memory, you should add memory to your computer.

Edit: Because your system is low on physical memory, programs need to read from the hard drive more often, because free space in RAM is normally used to store files frequently or recently accessed to reduce disk reading. ?With low free RAM, fewer files can be cached, reducing performance. ?This is especially the case with applications like Chrome, which is quite memory- and I/O-intensive. ?Once again, adding RAM will increase performance. ?For more information on caching, see the Wikipedia article.