Monday, August 17, 2009

Quick hit JVM heap size change

if you tasked to change the JVM heap size in approximately 2,500 servers today.

# Update the Heap size
# ./ -lang jython -f

as = AdminConfig.getid('/Cell:YOUR_CELL_NAME/Node:YOUR_NODE_NAME/Server:YOUR_SERVER_NAME/')
jvm = AdminConfig.list('JavaVirtualMachine', as)
AdminConfig.modify(jvm, [['initialHeapSize', '512'], ['maximumHeapSize', "768"]])
# set the newly saved config to variables to place entries in logging
i = AdminConfig.showAttribute(jvm, "initialHeapSize")
m = AdminConfig.showAttribute(jvm, "maximumHeapSize")
print "The initial heap size is now" + i
print "The max heap size is now" + m

Of course, you can change the heap to whatever size you would like.