

5·
4 days agoLinux aggressively caches things.
4 GB of RAM is not running out of memory.
If you start using swap, you’re running into a situation where you might run out of memory.
If oomkiller starts killing processes, then you’re running out of memory.


This is the job for the OS.
You can run most Linux systems with stupid amounts of swap and the only thing you’ll notice is that stuff starts slowing down.
In my experience, only in extremely rare cases are you smarter than the OS, and in 25+ years of using Linux daily I’ve seen it exactly once, where
oomkillerkilled runningmysqldprocesses, which would have been fine if the developer had used transactions. Suffice to say, they did not.I used a 1 minute cron job to reprioritize the process, problem “solved” … for a system that hadn’t been updated for 12 years but was still live while we documented what it was doing and what was required to upgrade it.