Statement cache monitoring
By shalini_m on Feb 28, 2011
My earlier blog on Statement Caching described how PreparedStatement, CallableStatement, Statement objects are cached to provide performance improvement.
GlassFish maintains a statement cache to cache the statements that are repeatedly executed by applications. It is considered a cache hit when one of the statement objects from the cache is returned and a cache miss when the statement object is newly created as it was missing in the cache.
Now, the number of statement cache hits and misses can be monitored using the monitoring infrastructure of GlassFish. When statement-cache-size is set to a positive non zero number and monitoring is set to HIGH, the statement cache hit/miss statistics can be got using the command line interface.
A sample of the output is shown below.
server.resources.testPool.numstatementcachehit-count = 3
server.resources.testPool.numstatementcachemiss-count = 1
To get the monitoring statistics using AMX programmatically, use the following objectName