To check the result of the configured periodical checks and RAM releasing you can use a special Loader application.
1. Follow the link to download Loader.war archive with the testing application.
2. Upload this .war archive to the Jelastic Cloud.
3. Deploy this Loader application to the environment with the Java application.
4. Open Config files and navigate to server > variables.conf file in order to check the Jelastic Java agent settings.
In our case, we changed the period value to 60 seconds to get a faster result.
If you also edit the configurations, then do not forget to Save the changes and Restart the server.
5. After that, open the application in a browser and add the following parameters to the link:
6. Now you can navigate to the Statistics where after some time you’ll see the results.
When you request the application, the memory usage increases by 500 MB due to the parameters added to the app link. Such an amount of RAM is going to be used during 300 seconds (also due to stated parameter).
And after that, the memory usage will decrease as the Jelastic Java agent calls Full GC. This is performed because the Jelastic GC agent recognizes the possibility to release some RAM as the app completed its active processes and does not require the full amount of memory.
You can request the testing application again in order to load the memory several times and check the process of its release.
7. As we switched on the debug mode for our Java agent, we can also track the process in the Log files.
The amount of available free memory (in bytes) can be seen in the catalina logs
Hence, using this method, you can improve your application memory management which will lead to a reduction of RAM consumption by JVM. As a result, you will save your money and increase the performance of your application. Enjoy!