Apr 29, 2014

[memo] How to add/delete jvm options for glassfish

I need to modify jvm options of glassfish(2.1). I asked Google and found the following URLs.
http://docs.oracle.com/cd/E19879-01/820-4332/create-jvm-options-1/index.html
http://docs.oracle.com/cd/E19879-01/820-4332/delete-jvm-options-1/index.html

Here is my example.
set ASADMIN="/usr/local/glassfish/glassfish-es-v2_1_1/bin/asadmin"
set PASSWORD="/home/glassfish/.passwd"
set USER="admin"
set HOST="localhost"
set PORT="4848"
foreach i (`seq -w 1 10`)
${ASADMIN} delete-jvm-options --host ${HOST} --port ${POST} --user ${USER} --passwordfile ${PASSWORD} --target instance-${i} \\-XX\\:NewRatio=2:\\-XX\\:SurvivorRatio=8
${ASADMIN} create-jvm-options --host ${HOST} --port ${POST} --user ${USER} --passwordfile ${PASSWORD} --target instance-${i} \\-XX\\:NewRatio=1:\\-XX\\:SurvivorRatio=4:\\-Xms1024m:\\-XX\\:CMSInitiatingOccupancyFraction=70
end
view raw gistfile1.sh hosted with ❤ by GitHub


Current glassfish has NewRatio and SurvivorRatio. So I deleted them and add new options like below.
-XX:NewRatio=1
-XX:SurvivorRatio=4
-Xms1024m
-XX:CMSInitiatingOccupancyFraction=70

Apr 17, 2014