Java Memory Agent Save

Java Memory Agent for Container RAM Usage Optimization

Project README
java-memory-agent

Java Memory Agent Add-On

The Java Memory Agent package implements automatic RAM usage optimization for Java-powered stacks of any type (application servers, databases, etc) by adjusting the most essential Java memory parameters according to the amount of resources, allocated to a container.

What it is intended for?

This add-on is designed to optimize any custom Java server (i.e. hosted with Docker containers or on top of VPS). Herewith, it is applicable not only to application server stacks (e.g. Tomcat, WildFly, GlassFish, etc), but to any Java-powered instance as well (e.g. Neo4j or Cassandra databases).

Note: Jelastic-managed Java stacks are provisioned with a similar tuning out-of-box, thus their additional optimization with this add-on is not needed.

To learn more about Jelastic Add-ons and their usage, refer to the linked guide.

Java Memory Agent Add-On Specific

To implement the required configurations, the following changes are applied by this add-on upon installation:

  • supervisor.sh - intercepts java command on a shell level to analyze and substitute default start options with optimized ones
  • memoryConfig.sh - adjusts the most essential Java parameters, like: -Xmx, -Xms, -Xmn, -Xmaxf, -Xminf, -XX:MaxPermSize and GC type; herewith, parameters defined via environment variables won’t be changed
  • javaagent - performs periodical Full GC calls to reduce the memory usage and release unused RAM back to OS. To disable this functionality please define environment variable VERT_SCALING=false.

In addition, the Java Memory Agent by Jelastic considers all the specific issues of Java hosting within containers (e.g. incorrect memory limits determination, native non-heap memory usage, RAM adjustment on a fly, etc.). This allows to improve stability and reliability of your application in general.

Note: Upon add-on installation, the corresponding server should be restarted with new parameters, which will cause a brief downtime of the service it runs.

In order to avoid this, consider to increase the number of instances within a target environment layer so that the required changes could be applied sequentially, by restarting them one-by-one.

Herewith, the originally used application parameters are automatically backed up and could be easily restored with a simple add-on removal, if needed (see the details within the dedicated section below).

How to Install Java Memory Agent to Jelastic Environment

The Java Memory Agent add-on can be applied to the required server by importing the manifest.jps file above.

java-agent-installation

Within the appeared form, use the appropriate drop-down lists to specify the environment and Java-running server that should be optimized:

  • Environment name - choose a target environment within your account
  • Nodes - select the corresponding environment layer with the required server

Click Install when ready and wait a few minutes for your application memory usage to be properly adjusted by Jelastic.

java-agent-installed

After the successful installation, you can open the embedded statistic monitoring tool to track your server’s RAM consumption with new settings.

How to Restore the Initial Java Parameters

Upon installation, the Java Memory Agent add-on automatically preserves the previously used Java settings within a dedicated backup file. Consequently, these configs can be effortlessly restored through the add-on removal, if needed.

java-agent-uninstall

For that, click on the Add-ons button next to the corresponding environment layer to open the same-named tab and select the Uninstall option within the Java Memory Agent menu.

Open Source Agenda is not affiliated with "Java Memory Agent" Project. README Source: jelastic-jps/java-memory-agent

Open Source Agenda Badge

Open Source Agenda Rating