0 Replies Latest reply on Nov 22, 2017 3:14 AM by Daniel Fb

    Wildfly 10 (JDK 8) - Optimizing the JVM CodeCache for continuous hotdeploy (ReservedCodeCacheSize)

    Daniel Fb Newbie



      A few weeks ago we faced higher use of CPU after some days running our apps in Wildfly.

      Looking at Thread Dump, we find out that C2 Compiler Thread was the suspect.


      Analising the JVM memory pool we realized that, while using Wildfly with 28 applications deployed, the 250m default ReservedCodeCacheSize JVM parameter was not enough. So we set it to 380m.

      Ok. After 3 weeks, we had no more problems.


      All good? Not yet. The system is up and running after 3 weeks for now.


      But every time we deployed a new version of some application (undeploy the .war a deploy the new one) the use of CodeCace increases. In fact, after the undeploy the CodeCache does not descrease. And after the deploy of the new version, the CodeCache increase. The use of CodeCache only increases.

      That is, then at some point, after several hotdeploys the memory for the CodeCache will reach the ReservedCodeCacheSize and we'll need to restart the Wildfly.


      I know that Wildfly has no control over the CodeCache, that is all managed by the JVM.


      What I'm wondering is, are there any configurations that may be useful in order to stop the CodeCache from hitting the maximum size?