Using -XX:ReservedCodeCacheSize=512m with the OverOps Agent

What is -XX:ReservedCodeCacheSize? Why does the OverOps agent need it when running our applications using Java 11 or higher?

The -XX:ReservedCodeCacheSize=512m parameter is important for the long-term performance of the JVM application. It controls the size of the JVM’s cache to keep jitted code, and if that cache gets filled up, the JVM can get into a state where it doesn’t clean it.

As a result, the application will decrease performance very drastically. The presence of the agent, as it uses bytecode instrumentation, can increase the usage of that cache, and thus could cause it to fill up unlike when the application runs without the agent.

The default value for that cache is low (roughly 48MB), so it could fill up when the agent is present.

The recommendation is to add this parameter to prevent issues in the future, and to adjust it on a case-by-case basis if it is preferred not to start with such a significant number.

Nonetheless, users can also let things run, and only if you see a steep performance degradation or a very high CPU usage can you add it.