I'm totally confused about the memory metrics provided by free
command in linux. currently I receive the following metrics:
total used free shared buff/cache available
Mem: 1.9Gi 624Mi 759Mi 8.0Mi 603Mi 1.2Gi
- it is showing 759Mi free memory which is relatively large. it is defined to be the unused memory and available memory is defined to be the memory available for starting new app without swapping. how available is larger than free? and is unused part of available memory?
- buff/cache is 603Mi. as I understand it is also counted in available memory. but how? suppose I want to start an app which needs 1.2Gi memory (entire available memory), then what happens to the data currently in buff/cache? they get cleared from RAM? and in this case how the system continues to do buffering and caching without having any memory left?!
Linuxatemyram.com is an excellent read for such. But basically you are correct that RAM in that Available is released without any delays. But as you pointed out, there is now the concern of buffering and caching. Which may or may not negatively impact your server's performance.
Thus far other than benching this yourself I do not understand personally how to accurately capacity plan RAM demands for such.