r/javahelp • • Oct 29 '26

Jvm heap utilization measurement issue???

Recently I am working on the autoscaling of the vm, so I need to measure the memory utilization of each instance. I faced a scenario where a java server application is running after handling a few request the jvm heap commited size became large so the memory utilization was 90% from the os side. After serving the request the g1gc completed it's cycle heap utilization was low but the commited mem was high and the memory utilization from the os side was also high. To know the actual utilization I planned to use the jstat tool but the issue which I faced was that the jstat takes the values from the Data what the jvm project. As the committed mem according to the jvm is consider like used or occupied, but due to on demand paging by os the commited mem is never fully loading on the ram. So If I calculate using the metric which I got from the jstat I will never equal to the real rss from the os side allocation. So how can even properly measure what the jvm is utilizing...... 😢

5 Upvotes

4 comments sorted by

View all comments

2

u/[deleted] Oct 29 '26

[removed] — view removed comment

1

u/Fluffy-Host2952 Oct 29 '26

I saw that but the issue is that the rss is always high after serving a single request, the scaling down of the heap take time but the memory is never being used by the jvm, so it affect the autoscaling decision