Memory Issue Management
Detecting memory issues at runtime
The Admin4J memory issue monitor will notify administators of memory issues. A 'memory issue' is an observation that memory usage in the JVM is larger than a given threshold.
Memory issues lead to OutOfMemory errors and spuratic application outages for users.
The memory issue monitor operates on a work/sleep cycle. The length of the 'sleep' cycle and the memory usage threshold.
Installing Memory Usage Monitoring
Add the following servlet to your applications web.xml:
<servlet> <servlet-name>Memory Monitor Startup Servlet </servlet-name> <servlet-class>net.admin4j.ui.servlets.MemoryMonitorStartupServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
Note that there is no servlet mapping as there is nothing to display. The monitor is started with the initialization of the startup servlet.
The following configuration parameters are supported for the thread contention monitor. You specify these parameters as init parametes on the startup servlet:
|sleep.interval.millis||N||Default 30000 (30 sec)||Amount of time in millis monitor will sleep between checks.|
|memory.threshold.pct||N||90||The percentage of memory that must be allocated before low memory warnings are issued.|
|memory.nbr.low.watermark.intervals||N||48||Number of low watermark observations reported with a low memory notice.|
|memory.low.watermark.monitor.interval.millis||N||1800000||Number of Millis between low watermark observations.|
|nbr.intervals.between.warnings||N||30||Number of intervals low memory must be experienced before repeat warnings are issued.|
|notifier||Y||Defaults to default.notifier.class value in the Admin4J configuration.||Handles admin notification. See documentation for the Notifier you're using for any additional configuration requirements. See Admin4J Notifiers section for more detail.|
Monitoring memory usage in containers servicing multiple applications.
You only need one memory usage monitor per JVM. If the container you which to monitor services multiple applications, it's on necessary to install the memory monitor startup servlet in one of those applications.