Wednesday, August 3, 2011

Execute Queue and Thread Dumps

Once a customer asked me if there is a way to monitor his server execute queue to understand which threads and applications might be causing the contention in the server's requests execution.

I have written a quick and dirty WLST script that monitors remotely this specific server execute queue, and in case it get any higher than a desired value, it takes a thread dump, and saves it to a file on my local machine.




The Server's execute queue may indicate that there are more requests getting to the server than it is capable of serving them, causing incoming request to clog up in the WLS execute queue, waiting for available threads to process its request.

A thread dump is a great way to quickly look at what the server threads are doing at a moment in time, and can give valuable information to help diagnose the bottleneck in your application.

Those kind of situations might be intermittent and may occur in a time spam of a few seconds, making it difficult to take a thread dump, in the right moment it is happening.

Using the script below, one can monitor the execute queue and take thread dumps at exactly the same time the issue is happening.

Download the example here: Monitor Server Execute Queue

You can modify the script to monitor other MBeans Attributes as well, like hogging threads and such.

To use it, just open terminal and run setDomainEnv.sh(cmd) and then "java weblogic.WLST monitorWLSQueue.py".

It will use the variables defined in the .py file to connect to the specified server/port/user/pwd, so it is important to edit the file before running it.

Cheers!

0 comments:

Post a Comment