The most useful memory snapshots are those for the moment when your app is experiencing memory problems. You can automate memory snapshots creation to capture those periods.
There are two ways for it:
- Java only Create a leak analysis snapshot when an application runs out of memory.
- Define incidents (for example, if memory usage exceeds 80%) and attach snapshot creation actions to these incidents.
You can also create periodic Memory snapshot tasks to create snapshots at certain periods of time. This is especially useful to gather memory trending information. See Memory snapshot tasks for more information.
Snapshot creation on out-of-memory
By default, AppMon automatically creates leak analysis snapshots if a Java 6 VM reports an out-of-memory error; in such a case, a built-in Application Process Out-of-memory incident is raised and a snapshot is triggered. Those snapshots are available in the Total Memory dashlet.
Creation of leak analysis snapshots stalls your JVM and suspends your application. To prevent it, you can disable automatic creation of memory snapshots for out-of-memory errors in the Advanced Settings of the Agent Group:
- Open the System Profile Preferences dialog box, and select Agent Mapping item of the required Agent Group.
- Click Advanced.
- Deselect the Create a Memory Snapshot upon Out-of-Memory notification checkbox.
Snapshot creation on incidents
You can create incidents for memory-related measures like Memory Utilization, and define actions that trigger memory snapshots. Here you can create all types of memory snapshots:
- Trending memory snapshots — available in the Total Memory dashlet.
- Selective memory snapshot — available in the Selective Memory dashlet.
- Leak analysis snapshots — available in the Total Memory dashlet.
To trigger a memory snapshot, add a corresponding action to the incident rule:
- Open the System Profile Preferences dialog box, and select the Incidents item.
- Create a new incident, or open an existing one for editing.
- When creating a new incident, configure a condition for it. See Create and Configure incident rules to learn how to create incident rules.
- Click the Actions tab. If needed, switch it to the Advanced Settings mode.
- Click Add. The Rule Action Editor dialog box appears.
- In the Rule Action pane, select Memory Dump Action Plugin.
- In the Properties pane, configure the snapshot creation parameters. See the description in the table below.
|dump type||The type of the snapshot created:
|dump count||How many snapshots should be created.|
|dump interval||Wait time between two snapshots.|
|lock session||Locks created snapshot to prevent its deletion by automatic cleanup tasks. You can still delete the snapshot manually.|
|Force Garbage Collection||Enables/disables trigger of GC before snapshot creation to reduce its size and get rid of unnecessary data.|
|Capture String Values||Enables/disables capture of string values. It is required for Duplicate String analysis, but the sanpshot takes more time to create and requires more disk space.|
|Capture Primitive Values||Enables/disables capture of primitive values. It provides more information, but the sanpshot takes more time to create and requires more disk space|
|Automatically Post-process||Enables/disables automatic post-processing of newly created trending or leak analysis snapshots. To keep the overhead low, you can disable it, and start prost-processing manually in the Total Memory dashlet.|