'How to lookup heap usage for Websphere

I don't know much about WebSphere, but I need to know the configured heap size for WebSphere.

I checked out with ps -ef and grep it by WebSphere hoping for Xms, Xmx to show up but could not see those arguments in the process result. (MaxPermSize was listed, though)

How can I check the xms, xmx, and optionaly the current usage? I way not using GUI is prefered, but if no easy way, then GUI is ok.



Solution 1:[1]

You can obtain this information with the wsadmin scripting tool. Specifically, the following Jython commands (or download this file) will do the trick:

    server = AdminConfig.getid('/Server:yourServerName/')
    jvm = AdminConfig.list('JavaVirtualMachine', server)
    
    print 'initialHeapSize: ' + AdminConfig.showAttribute(jvm, 'initialHeapSize')
    print 'maximumHeapSize: ' + AdminConfig.showAttribute(jvm, 'maximumHeapSize')

Edit: the above only shows you values you've explicitly configured. Here are alternate commands which will also show the value even if it's the JVM default:

    jvmName = AdminControl.completeObjectName('WebSphere:type=JVM,process=yourServerName,*')
    AdminControl.getAttribute(jvmName,'maxMemory')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1