Reputation: 675
What is the meaning of mem and mem.free in Spring Boot metrics exposed via /metrics endpoint?
We are load testing a new Spring Boot microservice deployed in three nodes, mem for each box is always around 250M out of 4G total in VM, mem.free under unrealistic load like 100 times of normal load can go down to 15M and slowly recovers after the test.
They are not heap memory because Spring Boot Metrics report them separately and they are not Java process itself because from command line I can see no matter how big the load, it stays at 16% of 4G which is about 900MB. Here is /metrics call response snippet:
{
mem: 227657,
mem.free: 44280,
processors: 2,
instance.uptime: 80393579,
uptime: 80414405,
systemload.average: 0.03,
heap.committed: 133632,
heap.init: 61440,
heap.used: 89351,
heap: 872448,
nonheap.committed: 96688,
nonheap.init: 2496,
nonheap.used: 94025,
nonheap: 0,
threads.peak: 109,
threads.daemon: 34,
threads.totalStarted: 183,
threads: 63,
classes: 10079,
classes.loaded: 10155,
classes.unloaded: 76,
.... }
Grafana mem.free screenshot for last 24 hours, the lowest point is during that heavy load testing (15MB!)
Grafana cpu and memory usage report is shown below which tells me CPU under stressed during that period which is understandable. However Java process memory (only 1 Spring boot running in that box) is stable:
So again what is the meaning of mem and mem.free in Spring Boot metrics?
Upvotes: 12
Views: 19725
Reputation: 116041
mem
is the total amount of memory that the JVM is currently using. It is the sum of two values:
The value of getUsed()
from MemoryMXBean.getNonHeapMemoryUsage()
mem.free
is the amount of memory that's available to the JVM. It's a single value:
To see more of the details, take a look at Spring Boot's SystemPublicMetrics
class.
Upvotes: 22