Out of curiosity, what do people recommend for OOM these days on Linux? My number one recurring issue on Ubuntu is me not noticing the memory usage, running out of memory and locking up my system (forcing a hard reboot and loss of unsaved work) EDIT: I'd preferably like an OOM handler that would freeze my system and pop up a little menu from which I could select which process to nuke
Buying more RAM?
There is an OOM kill count in Linux
61–66 of 66 posts
Re: There is an OOM kill count in Linux
#62Earlier quoted context omitted.
I've never had that problem. Maybe you don't setup much swap space as I would expect the system to run well enough to save your work and shutdown for most common leaks.
My previous Linux laptop with 8GB of RAM (2014–2017 or so, I think) I never even got round to setting up swap, and I only ran into problems two or three times total (when running two or three Firefox instances and Chromium and a VM taking 2GB and a bunch of other things running—some of the biggest consumers, namely browsers, actually notice if they’re using too much of your RAM and adjust how they work so they don’t…
Maybe there are reasons, but it is not nearly good enough -- I frequently run out of RAM and encounter OOM kills (prefer not to deal with linux swap), usually requiring a reboot. I really wish that I could just set an upper limit on (e.g.) firefox RAM usage -- 8GB for example -- instead of its insistence on using all of the unused RAM minus a couple to several hundred MB, which does not leave enough room for memory usage spikes. There might even be a way to set this buried somewhere in the config parameters, but I could never find it. It must be technically possible to set some limit because otherwise the browser would not be able to maintain a somewhat consistent usage just below the total system RAM.
Re: There is an OOM kill count in Linux
#63Out of curiosity, what do people recommend for OOM these days on Linux? My number one recurring issue on Ubuntu is me not noticing the memory usage, running out of memory and locking up my system (forcing a hard reboot and loss of unsaved work) EDIT: I'd preferably like an OOM handler that would freeze my system and pop up a little menu from which I could select which process to nuke
systemd-oomd [0]. You can also use facebook's oomd, but the systemd one is basically the same and slightly better. If you want, you can also write your own custom memory pressure handler using the recent PSI features: https://docs.kernel.org/accounting/psi.html The other, easier, answer is to buy more ram, if you simply have more memory than you will ever use (such as having 128GiB of memory when you only regularly u…
Wanna emphasize this mostly because it took me way too long to think of.
Was dealing with memory pressure regularly and constantly getting frustrated… then dropped an entire $60 or something to throw another 32GB in the machine and never think about my memory again.
Like a week later when I ran out of disk space again and was struggling to make room… same realization. Spent $75 for a 1TB NVME SSD dropped in my mailbox two days later and doubled my storage.
So we’re talking $135 to double my RAM and storage and stop wasting time and brain space on this stuff.
Re: There is an OOM kill count in Linux
#64Out of curiosity, what do people recommend for OOM these days on Linux? My number one recurring issue on Ubuntu is me not noticing the memory usage, running out of memory and locking up my system (forcing a hard reboot and loss of unsaved work) EDIT: I'd preferably like an OOM handler that would freeze my system and pop up a little menu from which I could select which process to nuke
This is one area where Windows is far superior to Linux as a desktop experience. By accident, I once wrote an infinite loop that just allocated a bunch of memory. As I ran the program my Windows system quickly became laggy and unresponsive. However, not completely. With a bit of patience I got Task Manager up and managed to kill the process and the system was back to normal within a minute. On Linux, I experience the…
Then I have stopped using swap partitions or swap files. For more than 20 years I have never used again any kind of swap, on a large variety of desktops, laptops and servers with Linux. I never had again any problem with unresponsiveness.
Nevertheless, I provision all the computers with generous amounts of DRAM, e.g. there are many years since I have last used a computer with less than 32 GB. In these conditions, OOM events are extremely rare.
While there are people who claim that there still exist cases when swap can be useful, I have never seen any evidence for this claim.
Re: There is an OOM kill count in Linux
#65Earlier quoted context omitted.
This is one area where Windows is far superior to Linux as a desktop experience. By accident, I once wrote an infinite loop that just allocated a bunch of memory. As I ran the program my Windows system quickly became laggy and unresponsive. However, not completely. With a bit of patience I got Task Manager up and managed to kill the process and the system was back to normal within a minute. On Linux, I experience the…
Indeed! I wonder why the system can't just stop giving the process memory when it's starting to become critical? (say, you're over 95% memory used) I really think a more general solution is treating memory (and CPU time as welL!) as a scarce resource, and programs should either: (1) Deal with having severely denied resources (default behavior); (2) Use a communication protocol to negotiate memory with the system. Neg…
There are already interfaces which can do some of what you are talking about: the most common is memory mapping backed by a file, swap, or filesystem caching. This is the most common form of 'optional' memory usage, and it's generally managed by the kernel. A lot of the kind of thing you are talking about can be mapped onto this abstraction. For cases where backing by a file doesn't make sense (e.g. it's cheaper to regenerate the cached data than to read it back from disk), if you are using a mmap-like interface, you can generally mark pages as 'don't need', which means they may be freed by the kernel if there is memory pressure, but won't be wiped immediately. Again the main issue is the use-cases where this represents a significant percentage of memory usage are pretty slim.
Re: There is an OOM kill count in Linux
#66Earlier quoted context omitted.
systemd-oomd [0]. You can also use facebook's oomd, but the systemd one is basically the same and slightly better. If you want, you can also write your own custom memory pressure handler using the recent PSI features: https://docs.kernel.org/accounting/psi.html The other, easier, answer is to buy more ram, if you simply have more memory than you will ever use (such as having 128GiB of memory when you only regularly u…
> The other, easier, answer is to buy more ram, if you simply have more memory than you will ever use (such as having 128GiB of memory when you only regularly use 30GiB), you'll rarely run into OOM issues. Wanna emphasize this mostly because it took me way too long to think of. Was dealing with memory pressure regularly and constantly getting frustrated… then dropped an entire $60 or something to throw another 32GB i…
We ran out of space, and then we realized we are a storage company.