When to upgrade RAM based on free output

Solution 1:

Able to get an answer for one my question

In case available is close to 0, will it end up in a System crash?

On testing in one of my servers, where I loaded the memory with almost full as below

sys> free -h
              total        used        free      shared  buff/cache   available
Mem:            11G         11G        135M         25M        187M         45M
Swap:            0B          0B          0B

Able to see my application alone (which consumed more memory) got killed by the Out of memory killer which can be referred in kernel logs

dmesg -e

[355623.918401] [21805] 553000 21805 69 21 2 0 0 rm
[355623.921381] Out of memory: Kill process 11465 (java) score 205 or sacrifice child
[355623.925379] Killed process 11465 (java), UID 553000, total-vm:6372028kB, anon-rss:2485580kB, file-rss:0kB, shmem-rss:0kB

https://www.kernel.org/doc/gorman/html/understand/understand016.html

The Out Of Memory Killer or OOM Killer is a process that the linux kernel employs when the system is critically low on memory. This situation occurs because the linux kernel has over allocated memory to its processes. ... This means that the running processes require more memory than is physically available.