We are working on a new application which is still in non-prod. We are using java 8. The issue we are facing is the non-heap increases gradually, with in few days to a point that it crashes the linux system.
Our application is running on tomcat and we use a automated deployment method. As part of troubleshooting we did the below test.
XMX = 4gb
Restarted the Tomcat to give it a fresh start. application started with below stats
- Heap usage = 1.5gb
- non-heap = 200mb
Without any user testing after tomcat restart, we did a automated deployment, same code just deployed again and noticed the non-heap doubled.
- Heap usage = 1.5gb
- non-heap = 400mb
we repeated the deployments multiple times and each time, the non heap increases. Non just the deploy, but just starting/stopping the application(not the tomcat) also increases the non-heap by 200mb.
Basically we narrowed our issue to, when ever we do a deployment the non heap increases. Important thing to note is we don't restart tomcat during the auto deployment. I'm looking for suggestions on should I include the tomcat restart step after each deployment ? or should I include the XX:MaxMetaspaceSize parameter to put a threshold to non heap ?
we have been monitoring our regular heap usage and there are no issues. Garbage collection happens in regular intervals and reclaims the space. But this is not the case with NON-HEAP, even when the GC happens no space is reclaimed from the NON-heap.