| name | java |
| description | Monitor Java Virtual Machines running on IBM i including heap memory usage, garbage collection activity, thread counts, and JVM configuration. Use when user asks about: (1) active JVMs on the system, (2) JVM heap or memory consumption, (3) garbage collection performance, (4) Java thread counts, (5) JVM home directories or properties, (6) identifying JVMs at risk of OutOfMemoryError, or (7) replacing WRKJVMJOB command output. |
IBM i Java & JVM Monitoring
Monitor Java Virtual Machines running on IBM i including heap memory, garbage collection, thread counts, and configuration using QSYS2.JVM_INFO.
Available Tools
The ibmi CLI is the primary tool for executing JVM queries. Set SKILL_DIR to this skill's installed location (the directory containing this SKILL.md file):
ibmi tools --tools "$SKILL_DIR/tools/" --toolset java_default
ibmi tool list_jvms --tools "$SKILL_DIR/tools/"
ibmi sql "SELECT JOB_NAME, CURRENT_HEAP_SIZE, IN_USE_HEAP_SIZE FROM QSYS2.JVM_INFO"
Service Selection Guide
JVM Monitoring
- QSYS2.JVM_INFO (VIEW) -- Quick overview of all active JVMs
- QSYS2.JVM_INFO (TABLE FUNCTION) -- Detailed JVM data with wait time parameter for memory breakdown (malloc, internal, JIT, shared class)
Key Capabilities
Memory Analysis
- Heap Usage -- Current, in-use, and maximum heap sizes per JVM
- Memory Breakdown -- Malloc, internal, JIT, and shared class memory (via table function)
- Threshold Alerts -- Find JVMs exceeding heap usage percentages
Performance Monitoring
- Garbage Collection -- Total GC time and cycle counts
- Thread Counts -- Java thread count per JVM
- Uptime -- JVM start times for stability tracking
Configuration
- Java Home -- Which Java version each JVM uses
- User Directory -- Working directory for each JVM
- Properties -- Number of configured properties per JVM
- Bit Mode -- 32-bit vs 64-bit JVM identification
Common Use Cases
- Find memory-hungry JVMs -- Sort by heap usage to identify top consumers
- Detect GC pressure -- High GC time or cycle count indicates memory issues
- Capacity planning -- Track heap growth trends across JVMs
- Java version audit -- Identify which Java homes are in use
- Troubleshoot OutOfMemoryError -- Find JVMs near max heap
Quick Examples
List all active JVMs
ibmi tool list_jvms --tools "$SKILL_DIR/tools/"
Find JVMs using more than 80% heap
ibmi tool list_jvms_by_heap_usage --tools "$SKILL_DIR/tools/" --min-heap-pct 80
Get detailed memory breakdown
ibmi tool get_jvm_detail --tools "$SKILL_DIR/tools/" --wait-time 10
Find JVMs with high GC activity
ibmi tool list_jvms_by_gc_activity --tools "$SKILL_DIR/tools/" --min-gc-cycles 100
Pre-built Tools
The tools/java.yaml file provides 5 ready-to-use tools:
| Tool | Description |
|---|
list_jvms | List all active JVMs with memory and GC stats |
get_jvm_detail | Detailed JVM info including memory breakdown |
list_jvms_by_heap_usage | Find JVMs by heap consumption percentage |
list_jvms_by_gc_activity | Find JVMs with highest GC activity |
get_jvm_properties | JVM configuration and property counts |
ibmi tool <tool_name> --tools "$SKILL_DIR/tools/"
ibmi tool <tool_name> --tools "$SKILL_DIR/tools/" --dry-run
ibmi tools show <tool_name> --tools "$SKILL_DIR/tools/"
Reference Documentation