Nomad memory graph is showing high memory uses than the process is actually using

I have a docker image which is running a jar inside. It is a service type job.
The resource memory allocation to the nomad job is 25GB as at some points there can be too many requests to the running service but most of the time it is not the case.
Though, The nomad memory graph always shows high memory uses which is misleading. In order to confirm it, we also checked the heap dump or the process but it is not taking as much memory as the nomad process is showing. So, can someone explain why this is happening or am I missing something?

Hi @divya2661!

The memory reported by Nomad is the total memory usage as required to constrain the container to its allowed memory. That includes the rss (which is where the heap is), cache, swap, and kernel memory allocated to the process. Depending on your workload, the process might be causing a lot of page cache to be used up.

If you want a more fine-grained look at the allocation’s memory usage, you might want to take a look at the Allocation Metrics from Nomad’s telemetry endpoints.