Hot Spot Utility
What is HotSpot?
HotSpot will examine thread dumps and collect data on all threads in a "Running" or "Blocked" state. HotSpot collects thread dumps to examine on a configured interval (default is 30 seconds). HotSpot will summarize the information it collects on demand via a servlet display.
Why would I use HotSpot instead of a profler? Good question. HotSpot operates the same way many profilers do, but with a much longer interval between observations. HotSpot will not replace your profiler. Profilers are great when you have already identified the process that requires tuning. HotSpot helps you identify that process.
Wouldn't running a profiler on a load test give me the same information? No. Load tests are scripted. That means that they are constructed to emulate specific user activities. Which user activities are scripted? Well, sometimes developers are working on specific information, but more often than not they are making assumptions about the most widely used features of their application. HotSpot allows you not to have to "guess" or "make assumptions" about which parts of applications are most frequently executed. HotSpot can tell you actually what is most frequently executed in a production environment.
Is HotSpot safe to use in a production environment? Yes. Hotspot can safely be used in production environments. Furthermore, you control how intrusive HotSpot is by manipulating the length of the work/sleep cycle it uses. The default of 30 seconds was determined by experimenting with different settings on a production application (it's what the writers of this utility most frequently use).
The HotSpot monitor operates on a work/sleep cycle. The length of the 'sleep' cycle is configurable.
Installing the Hot Spot Utility
Add the following servlet to your applications web.xml:
<servlet> <servlet-name>Hot Spot Display Servlet</servlet-name> <servlet-class>net.admin4j.ui.servlets.HotSpotDisplayServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Hot Spot Display Servlet</servlet-name> <url-pattern>/admin4j/hotSpot</url-pattern> </servlet-mapping>
The following configuration parameters are supported for HotSpot. You specify these parameters as init parameters on the display servlet:
|sleep.interval.millis||N||Default 30000 (30 sec)||Amount of time in millis monitor will sleep between checks.|
HotSpot Utility usage in containers servicing multiple applications.
You only need one Hotspot monitor per JVM. If the container you which to monitor services multiple applications, it's on necessary to install the HotSpot monitor startup servlet in one of those applications.