Pages

Tuesday, November 29, 2011

Hottest items in the WebSphere Application Server Dynacache Servlet cache



Provided is a DynaCache program that leverages PMI and JMX to output the top 100 templates in the servlet cache in terms of in-memory cache hits. 
You can use this client program to determine which items in the cache are the most popular.

When there are a lot of cache-entries  and consequently templates in the cachespec.xml this tool will give you a good idea of what is hot or not. The utility of this tool decreases when the cache-entry names are not granular. For instance some cachespec.xml's use the single front controller, with a lot of the cache-ids hanging off a usually a single cache-entry. For now the program/tool only looks at the in-memory cache hits and not disk hits. Java src is included in the jar if you want to modify it :-)

Attached jar contains the src and the class files:
http://dl.dropbox.com/u/12872475/Dynacache-WXS/dc-pmi.jar

This program requires the template servlet cache PMI group to be enabled.






























Usage:
C:\WebSphere7\AppServer\java\bin\java -Djava.ext.dirs=C:\WebSphere7\AppServer\runtimes;c:\WebSphere7\AppServer\lib;C:\WebSphere7\AppServer\java\jre\lib;C:\WebSphere7\AppServer\java\jre\lib\ext;C:\WebSphere7\AppServer\lib com.ibm.ws.sample.DynaCachePMIClient localhost 8881-standalone smitaNode01 server1 baseCache
  • Replace C:\WebSphere7\AppServer with your $WAS_HOME &rerun.
  • Program arguments are in orange. 
  • There is also a test.properties that can be modified inside the jar for more granular control, if you do not want to provide arguments.
Output:
host=localhost , port=8881 , connector=SOAP , distributed=false
main: create the adminclient
getAdminClient: hostStr=localhost , portStr=8881
getAdminClient: WasClientPath=C:/WebSphere7/AppServer/profiles/base
*****************************************
DynaCache Automated Tests
Host     : smita.raleigh.ibm.com
Port     : 9081
PMI Port : 8881 connector: SOAP
Cell     : smitaNode01Cell
Node     : smitaNode01
Server   : server1
BaseCacheSize: 2000
Offload to Disk: false
IhsEnabled: true
globalSecurityEnabled: false
IHS Host    : localhost
IHS Port    : 80
Distributed Caching: false
zOSMode: false
*****************************************
Usage: DynaCachePMIClient [ <-distributed|-standalone> ]
Arguments passed in to com.ibm.ws.sample.DynaCachePMIClient
args[0] localhost
args[1] 8881
args[2] -standalone
args[3] smitaNode01
args[4] server1
args[5] baseCache

Found 1
...node:smitaNode01 match: true
...process:server1 match: true
my perf MBean: WebSphere:name=PerfMBean,process=server1,platform=dynamicproxy,node=smitaNode01,version=7.0.0.19,type=Perf,mbeanIdentifier=PerfMBean,cell=smitaNode01Cell,spec=1.0

Get statistics from all cacheModules

stats name=cacheModule.template
    HitsInMemoryCount[21]=23
    HitsOnDiskCount[22]=0
    ExplicitInvalidationCount[23]=0
    LruInvalidationCount[24]=0
    TimeoutInvalidationCount[25]=0
    InMemoryAndDiskCacheEntryCount[26]=4
    RemoteHitCount[27]=0
    MissCount[28]=4
    ClientRequestCount[29]=27
    DistributedRequestCount[30]=0
    ExplicitMemoryInvalidationCount[31]=0
    ExplicitDiskInvalidationCount[32]=0
    LocalExplicitInvalidationCount[34]=0
    RemoteExplicitInvalidationCount[35]=0
    RemoteCreationCount[36]=0

    stats name=/dynacachetests/TimeStamp
        HitsInMemoryCount[21]=11
        HitsOnDiskCount[22]=0
        ExplicitInvalidationCount[23]=0
        LruInvalidationCount[24]=0
        TimeoutInvalidationCount[25]=0
        InMemoryAndDiskCacheEntryCount[26]=2
        RemoteHitCount[27]=0
        MissCount[28]=2
        ClientRequestCount[29]=13
        DistributedRequestCount[30]=0
        ExplicitMemoryInvalidationCount[31]=0
        ExplicitDiskInvalidationCount[32]=0
        LocalExplicitInvalidationCount[34]=0
        RemoteExplicitInvalidationCount[35]=0
        RemoteCreationCount[36]=0

    stats name=/dynacachetests/TimeStamp1
        HitsInMemoryCount[21]=12
        HitsOnDiskCount[22]=0
        ExplicitInvalidationCount[23]=0
        LruInvalidationCount[24]=0
        TimeoutInvalidationCount[25]=0
        InMemoryAndDiskCacheEntryCount[26]=2
        RemoteHitCount[27]=0
        MissCount[28]=2
        ClientRequestCount[29]=14
        DistributedRequestCount[30]=0
        ExplicitMemoryInvalidationCount[31]=0
        ExplicitDiskInvalidationCount[32]=0
        LocalExplicitInvalidationCount[34]=0
        RemoteExplicitInvalidationCount[35]=0
        RemoteCreationCount[36]=0

TOP 100 TEMPLATES IN THE CACHE baseCache
/dynacachetests/TimeStamp1=12
/dynacachetests/TimeStamp=11

Dynacache PMI structure:








No comments:

Post a Comment

Note: Only a member of this blog may post a comment.