December 10, 2004
Tips for efficient frequent JMX calls to WebSphere.
Currently using JMX (through the wsadmin utility in WAS) to call JMX MBeans to query runtime state but it's too expensive to do frequently. Starting wsadmin takes too much CPU and it just takes too long to get the data.
My current workaround is to deploy a servlet to the server and the servlet does the JMX query or other commands against the MBean. The servlet parameters provide the necessary data for what I want to do.
I then use a perl script with the perl http client to invoke the servlet and get the answer. This is signficantly more efficient than using wsadmin for these scenarios. Typically takes well under a second to get the data versus 15-30 seconds using wsadmin, best case. I'll see if I can publish the code, it's pretty straightforward to write the servlet and the perl script is also simple.
Worth remembering if you need to do this sort of checking frequently, probably applies to everyones application server and not just WebSphere also. A perl script simply starts a hell of a lot faster than a JVM.
Another option is this nifty bit of work called NailGun: http://www.martiansoftware.com/nailgun/
It is intended as a solution to slow JVM startup so you can write quick command line utilities in Java, but it would work in this instance too.
Posted by: Nicholas | Jan 11, 2005 11:39:38 AM
Thanks for the great post. Can you post the servlet and perl script you used?
Thanks in advance!
Posted by: earl_the_perl | Feb 15, 2005 11:46:21 AM