3 ms·
The key point is that if you have no swap, and you run low on memory, then the OS has no choice but to throw away stuff that is clean. This includes stuff that
by mnw21cam 7y ago
The key point is that if you have no swap, and you run low on memory, then the OS has no choice but to throw away stuff that is clean. This includes stuff that is being actively used right now, like the code that is in your processes. So your system will still thrash, even though it has no swap, because it is trying to load pages of running code in on-demand, while constantly throwing them away again because it doesn't have enough space. This will incapacitate a server even more thoroughly than if there is swap, and the working set is larger than physical memory. The more RAM a server has, the more severe this incapacitation will be.
For this reason, you want an OOM killer to kill stuff way earlier than when you actually run out of RAM, because if you ever reach that point it is too late. I use a program called earlyoom, which has saved my server from having to have the big red button pushed quite a few times, when fumble-fingered PhD students "accidentally" consume all the RAM in their pet projects.
- scottlamb 7y ago> I use a program called earlyoom, which has saved my server from having to have the big red button pushed quite a few times, when fumble-fingered PhD students "accidentally" consume all the RAM in their pet projects. Along those lines, take a look at this: [1] > Pressure stall information were added to Linux 4.20 as a way to quantify resource pressure in the system in a better way than the traditional load average. PSI aggregates and reports the overall wallclock time in which the tasks in a system (or cgroup) wait for cpu, io or memory. > This release [Linux 5.2] lets users to configure sensitive thresholds and use poll() and friends to be notified when a certain pressure thresold is breached within a user-defined time window. With this mechanism, Android can monitor for, and ward off, mounting memory shortages before they cause problems for the user. For example, using memory stall, monitors in userspace like the low memory killer daemon (lmkd) can detect mounting pressure and kill less important processes before device becomes visibly sluggish. In memory stress testing psi memory monitors produce roughly 10x less false positives compared to vmpressure. I haven't tried it yet, but it sounds promising. [1] https://kernelnewbies.org/Linux_5.2#Improved_Presure_Stall_Information_for_better_resource_monitoring https://kernelnewbies.org/Linux_5.2#Improved_Presure_Stall_I...