How to check jvm heap size in websphere

IBM WebSphere Application Server

 

To check heap size of any server in Websphere I use below script. It provides the heap size.

serverJVM=AdminControl.completeObjectName('type=JVM,process=' + sys.argv[0] + ',*')
serverJVMObj=AdminControl.makeObjectName(serverJVM)
perf=AdminControl.completeObjectName('type=Perf,process=' + sys.argv[0] + ',*')
perfObj=AdminControl.makeObjectName(perf)
jvmObj=AdminControl.invoke_jmx(perfObj,'getStatsObject',[serverJVMObj,java.lang.Boolean('false')],['javax.management.ObjectName','java.lang.Boolean'])

currentHeapsize=jvmObj.getStatistic(‘HeapSize’).getCurrent()
usedMemory=jvmObj.getStatistic(‘UsedMemory’).getCount()
usage=float(usedMemory)/float(currentHeapsize)*100

print sys.argv[0] + “.> “+str(currentHeapsize)+”K .> “+str(usedMemory)+”K .> “+”Usage:%.2f” % usage+”%”

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.