Finding out WAS heap usage - Websphere

This is a discussion on Finding out WAS heap usage - Websphere ; Hello, Could someone please tell me if there is a way of writing a command or script that will give me the heap memory being used by a Websphere Application Server? I want to wrap the command in a shell ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Finding out WAS heap usage

  1. Finding out WAS heap usage

    Hello,

    Could someone please tell me if there is a way of writing a command or script that will give me the heap memory being used by a Websphere Application Server?

    I want to wrap the command in a shell script and run it external to the WAS JVM every 5 mins through cron. The idea is to obtain data on heap usage by WAS as part of a monitoring framework.

    Awaiting your response

    Dipak Jha

  2. Re: Finding out WAS heap usage

    On Aug 24, 12:39 pm, wrote:
    > Hello,
    >
    > Could someone please tell me if there is a way of writing a command or script that will give me the heap memory being used by a Websphere Application Server?
    >
    > I want to wrap the command in a shell script and run it external to the WAS JVM every 5 mins through cron. The idea is to obtain data on heap usage by WAS as part of a monitoring framework.
    >
    > Awaiting your response
    >
    > Dipak Jha



    See getJVMinfoNew_proc.tcl at http://www.websphereconsultant.com/W...doc/index.html.




  3. Re: Finding out WAS heap usage

    jhadipak@hotmail.com wrote:
    > Hello,
    >
    > Could someone please tell me if there is a way of writing a command or script that will give me the heap memory being used by a Websphere Application Server?
    >
    > I want to wrap the command in a shell script and run it external to the WAS JVM every 5 mins through cron. The idea is to obtain data on heap usage by WAS as part of a monitoring framework.
    >
    > Awaiting your response
    >
    > Dipak Jha


    I made the Jython code below a while ago in order to demonstrate the script-based administration of
    was6. The script prints JVM's free memory every 5 seconds 20 times.
    If you need to see the heap size, then you need to find the name of the correspondent counter and
    use it instead of 'FreeMemory' in the code - all counter names are certainly somewhere in the
    infocenter.

    #!/usr/bin/python

    lineSep=java.lang.System.getProperty('line.separat or')

    import time

    def startMonitoring(nodeName, serverName, level):
    """\nstartMonitoring(nodeName, serverName, level)
    Starts monitoring the specified server with predefined set of statistics.
    Level can be one of the following strings: 'none', 'basic', 'extended', 'all'.
    It is assumed that target server has PMI enabled.
    """

    # Get server's Perf MBean
    perfOn=AdminControl.queryNames('WebSphere:node=' \
    +nodeName+',type=Perf,process='+serverName+',*')
    perfOn=AdminControl.makeObjectName(perfOn)

    # Set statistics set
    AdminControl.invoke_jmx(perfOn,'setStatisticSet',[level],['java.lang.String'])

    return

    def stopMonitoring(nodeName, serverName):
    """\nstopMonitoring(nodeName, serverName)
    Stops monitoring the specified server. Is equivalent to
    startMonitoring(nodeName, serverName, 'none').
    """

    # Set statistics set to 'None' what is stop monitoring
    startMonitoring(nodeName,serverName,'none')

    return


    def demoPrintJvmFreeMemory(nodeName,serverName,numRead ings,timeIntervalInSecs):
    """\ndemoPrintJvmFreeMemory(nodeName,serverName,numRe adings,timeIntervalInSecs)
    Demo procedure that prints on console series of 'numReadings' target JVM free memory values
    with 'timeIntervalInSecs' interval.
    It is assumed that PMI is enabled on the specified server.
    """
    startMonitoring(nodeName,serverName,'all')
    if 0 < numReadings and numReadings <=100 \
    and 0 < timeIntervalInSecs \
    and timeIntervalInSecs < 5:
    jvmOn=AdminControl.queryNames('WebSphere:node='+no deName+',\
    type=JVM,process='+serverName+',*')
    jvmOn=AdminControl.makeObjectName(jvmOn)
    for i in range(numReadings):
    jvmStat=getOneObjStat(nodeName,serverName,jvmOn)
    print(repr(i)+': '+repr(jvmStat[1].getStatistic('FreeMemory').getCount()))
    time.sleep(timeIntervalInSecs)
    stopMonitoring(nodeName, serverName)
    return

    ### main routine

    demoPrintJvmFreeMemory('myWasNode','server1',20,5)

    #--- end of script ----

  4. Re: Finding out WAS heap usage

    Another option is for you to turn on verbose GC and see the output written the the log file.

  5. Re: Finding out WAS heap usage

    I second this, as verbosegc stats are lightweight, built-in and there is IBM
    tooling to review the output (GCCollector on alphaWorks).


  6. Re: Finding out WAS heap usage

    On Aug 25, 5:39 am, "Ben_" wrote:
    > I second this, as verbosegc stats are lightweight, built-in and there is IBM
    > tooling to review the output (GCCollector on alphaWorks).


    I think verbose GC is best option since it does have any performance
    problem. It is just a text file which will be outputed.

    Depending upon the java use relevant verbose GC command while starting
    the server.

    Thanks
    bshah


  7. Re: Finding out WAS heap usage

    Thanks everbody. I think turning verbose GC on is the best option I have.

    Any idea on how I can probe WAS externally for the current number of free threads?

  8. Re: Finding out WAS heap usage

    You can obtain these metrics from the PMI interfaces wither via jacl/jython scripts or from the TPV in the admin console.

    BTW, PMAT is a far better tool than GCAnalyzer IMHO..

    John Pape
    IBM WebSphere / WebSphere Portal Specialist

+ Reply to Thread