skycaptain
skycaptain

Reputation: 9

how to control jvm heap usage rate to stay below 80% as much as possible?

Our springboot app is used for get large data and compress it. so it always needs large memory.But customer's Prometheus always monitor it and send alarm to us heap memory usage rate exceeds 80%.Though we know it won't oom and restart ... but we are boring to explain ,so we try to let GC occurs in advance ,avoiding threshold 80% . of course, as much as possile, not absolutely.

PS: jdk1.8 -XX:+UseG1GC -XX:MaxRAMPercentage=75

Upvotes: -1

Views: 451

Answers (1)

aled
aled

Reputation: 25837

If you ensure that your application doesn't create objects in the heap the usage of the heap memory should not increase. That's usually impractical and not really feasible in real life.

You could profile and try to minimize the usage of memory and the time it is kept in memory. However there are no guarantees how much success you will have.

Having said that, this is a common situation caused by wrong expectations from user of how the JVM memory works and how to monitor it. Educating your customer could be useful.

Another option could be monitor the memory patterns of the application in real life conditions and adjust the monitoring alarm to those conditions.

Upvotes: 0

Related Questions