Change allocated memory in Glassifish using asadmin tool

Hi there,

I want to share my experience in changing the settings for the allocated memory in Glassifish. In particular, changing the amount of initial memory (-Xms) and changing the maximum memory (-Xmx) allocated to Glassfish.

To do so I used the asadmin CLI tool which is part of the Glassfish installation. It is found in the bin directory.
First run ./asadmin to start the asadmin console. Next, using the command
list the command-line options that are passed to the Java application launcher when GlassFish Server is started. Check, the actual value of the settings you want to change. Say you see that your Glassfish is set with initial allocated memory of 1536 MB. In such case, in the list you should see -Xms1536m.
Then, run the following command to add your preferred value:
create-jvm-options '-Xms3g'
This will add the ‘Xms3g’ setting to the Glassifish settings options. Next, you need to delete the previous settings '-Xms1536m'. To delete, run the following command:
delete-jvm-options '-Xms1536m'
You are done! The changes to take effect, you need to restart the Glassfish. To restart run:
restart-domain domain1

Maybe a bit complicated, but this is how I change Glassifish JVM settings.

This entry was posted in hacking, programming. Bookmark the permalink.

Comments are closed.