GemFire: How to effectively monitor and interpret "free" and "cached" memory
search cancel

GemFire: How to effectively monitor and interpret "free" and "cached" memory

book

Article ID: 294467

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

How can I use free and cached memory readings to determine if my GemFire cluster is vulnerable to heap or memory issues?    In linux, one can use various command, commonly "free - h" or other flavors.

Environment

Product Version: 10.0
OS: Linux

Resolution

It is important to know how to interpret data output from such memory related commands.   Specifically, many become concerned when they observe "free" memory going very low in system.

While that may be prudent, and sometimes warranted, it requires further analysis.  There are a couple common phrases that can help lend insight.

1. "free" memory is wasted memory.

An operating system is designed to utilize all resources at its disposal to achieve optimal behavior and performance.    "free" memory, is therefore essentially wasted from that perspective.     Thus, an OS will often take "free" memory very low approaching zero to achieve that goal.

2. "cached" memory IS "free" memory

Even as an OS will take free memory quite low at times doing its thing, that doesn't mean your system is becoming vulnerable necessarily.    An OS will cache more and more memory over time, keeping it stored/saved for future reference if needed.   That is all to optimize performance of the complete system.

Still, it would be incomplete unless the OS protected the system from running out of resources, including free memory.    Thus, when needing to satisfy a memory allocation, the OS can use "cached" memory to satisfy such allocations if needed or appropriate.

Therefore, when assessing risk regarding low free memory, one really needs to consider the sum total of "free"+"cached".     If sufficiently high, there is no real cause for concern.

Finally, one can examine the degree of swapping.   It is certainly accurate to consider excessive swapping as a cause for concern, potentially driven by insufficient memory provisioned.   This can be especially true if one has set "swappiness" in the system to 0, or to very low values, yet still experiencing pages being swapped out.    Related article on swappiness, how to set it, etc.:

https://www.howtogeek.com/449691/what-is-swapiness-on-linux-and-how-to-change-it/

Some level of swapping can always occur, based upon decisions being made by an OS to swap out rarely accessed pages, etc.   Unless you observe any negative impact, this too is simply just the OS operating as designed to deliver best behavior based on all of the data and heuristics it has.