Memory Issues in Metaspace for Java 8 Applications Deployed on WIlfly 8.2.1

Description of the problem

I noticed that each deployment of one of our Java8 applications on Wildfly 8.2.1 uses approximately 30-40 MB from the memory pool in the metadata. This is good, but the fact is that as soon as I redistribute the same application, the use of Metaspace memory increases by the same 30-40 MB, while the old memory already allocated will not be released.

I would not even notice this, but the fact is that we have ~ 20 applications, and from time to time I need to redistribute up to 10 of them simultaneously. This, in turn, leads to a terrible picture.

enter image description here It basically shows that two redeployments of ~ 10 applications.

I'm not sure why the GC cannot free the memory allocated for old classes. This server has a total of 16 GB of physical memory, so I can redeploy all applications up to 20-40 times, that's all. The application server will reach the limit and stop responding to any commands.

Therefore, I would be very grateful if someone would help me understand what could be an urgent problem:

  • Is this a Java8 issue? (jdk 1.8.0_40-b26)
  • Is this a Wildfly 8.2.1 problem?
  • Or is it as simple as possible to answer that the reason is my code base? If so, then could you direct me, what could be the actual reason?

Additional information about my codebase

1) Together with Wildfly I use 2 stand-alone HornetQ servers, each application uses ~ 5 channels with at least 5 simultaneous consumers on each. This, in turn, results in at least 25 threads for each application and at least 25 * 20 = 500 threads.

2) For all low level JMS operations I use Spring JMS.

+5
source share
2 answers

WildFly 10.0.0.Final "java.lang.OutOfMemoryError: Metaspace" occurs and will be fixed. See the Agile Board of Wildfly guide.

https://issues.jboss.org/browse/WFLY-6173

+1
source

To empirically determine where and if you have a leak (you may not have a leak - these can only be legitimate classes loaded during deployment for legitimate reasons), you can try to take a bunch of dump at the right time (i.e. before or after an increase in the metaprocess). Then take another pile of heap. Diff two heaps of dumps with a tool like MAT or Yourkit . The difference between them will tell you which classes are loading.

Leaks in the metapass are quite rare, because you only have so many classes to download, but it can be something quite exotic when playing.

Let me know what you find and happy hunting! It's fun.: -)

+1
source

Source: https://habr.com/ru/post/1234030/


All Articles