java

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

IBM i Java & JVM Monitoring

IBM i Java 与 JVM 监控

Monitor Java Virtual Machines running on IBM i including heap memory, garbage collection, thread counts, and configuration using QSYS2.JVM_INFO.
使用 QSYS2.JVM_INFO 监控运行在 IBM i 上的 Java 虚拟机,包括堆内存、垃圾回收、线程数和配置。

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):
bash
undefined
ibmi
CLI 是执行 JVM 查询的主要工具。将
SKILL_DIR
设置为此 skill 的安装位置(即包含此 SKILL.md 文件的目录):
bash
undefined

SKILL_DIR = directory containing this SKILL.md

SKILL_DIR = directory containing this SKILL.md

Examples: ./skills/java, ~/.claude/skills/java

Examples: ./skills/java, ~/.claude/skills/java

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"
undefined
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"
undefined

Service Selection Guide

服务选择指南

JVM Monitoring

JVM 监控

  • 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)
  • QSYS2.JVM_INFO (VIEW) -- 快速概览所有活动的 JVM
  • QSYS2.JVM_INFO (TABLE FUNCTION) -- 提供详细的 JVM 数据,可通过 wait time 参数获取内存明细(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
  • 堆使用情况 -- 查看每个 JVM 的当前堆大小、使用中的堆大小和最大堆大小
  • 内存明细 -- 通过 table function 获取 malloc、internal、JIT 和 shared class 内存信息
  • 阈值警报 -- 查找堆使用百分比超过阈值的 JVM

Performance Monitoring

性能监控

  • Garbage Collection -- Total GC time and cycle counts
  • Thread Counts -- Java thread count per JVM
  • Uptime -- JVM start times for stability tracking
  • 垃圾回收 -- GC 总耗时和循环次数
  • 线程数 -- 每个 JVM 的 Java 线程数
  • 运行时间 -- JVM 启动时间,用于稳定性跟踪

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
  • Java Home -- 每个 JVM 使用的 Java 版本
  • 用户目录 -- 每个 JVM 的工作目录
  • 属性 -- 每个 JVM 已配置属性的数量
  • 位模式 -- 识别 32 位或 64 位 JVM

Common Use Cases

常见使用场景

  1. Find memory-hungry JVMs -- Sort by heap usage to identify top consumers
  2. Detect GC pressure -- High GC time or cycle count indicates memory issues
  3. Capacity planning -- Track heap growth trends across JVMs
  4. Java version audit -- Identify which Java homes are in use
  5. Troubleshoot OutOfMemoryError -- Find JVMs near max heap
  1. 查找内存消耗较大的 JVM -- 按堆使用量排序,识别资源消耗最高的 JVM
  2. 检测 GC 压力 -- GC 时间或循环次数过高通常表示存在内存问题
  3. 容量规划 -- 跟踪各 JVM 的堆增长趋势
  4. Java 版本审计 -- 识别正在使用的 Java Home
  5. 排查 OutOfMemoryError -- 查找接近最大堆限制的 JVM

Quick Examples

快速示例

List all active JVMs

列出所有活动的 JVM

bash
ibmi tool list_jvms --tools "$SKILL_DIR/tools/"
bash
ibmi tool list_jvms --tools "$SKILL_DIR/tools/"

Find JVMs using more than 80% heap

查找堆使用率超过 80% 的 JVM

bash
ibmi tool list_jvms_by_heap_usage --tools "$SKILL_DIR/tools/" --min-heap-pct 80
bash
ibmi tool list_jvms_by_heap_usage --tools "$SKILL_DIR/tools/" --min-heap-pct 80

Get detailed memory breakdown

获取详细的内存明细

bash
ibmi tool get_jvm_detail --tools "$SKILL_DIR/tools/" --wait-time 10
bash
ibmi tool get_jvm_detail --tools "$SKILL_DIR/tools/" --wait-time 10

Find JVMs with high GC activity

查找 GC 活动频繁的 JVM

bash
ibmi tool list_jvms_by_gc_activity --tools "$SKILL_DIR/tools/" --min-gc-cycles 100
bash
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:
ToolDescription
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
bash
ibmi tool <tool_name> --tools "$SKILL_DIR/tools/"          # Execute
ibmi tool <tool_name> --tools "$SKILL_DIR/tools/" --dry-run # Preview SQL
ibmi tools show <tool_name> --tools "$SKILL_DIR/tools/"     # View details
tools/java.yaml
文件提供了 5 个开箱即用的工具:
工具说明
list_jvms
列出所有活动的 JVM,并显示内存和 GC 统计信息
get_jvm_detail
获取包括内存明细在内的详细 JVM 信息
list_jvms_by_heap_usage
按堆消耗百分比查找 JVM
list_jvms_by_gc_activity
查找 GC 活动最频繁的 JVM
get_jvm_properties
获取 JVM 配置和属性数量
bash
ibmi tool <tool_name> --tools "$SKILL_DIR/tools/"          # Execute
ibmi tool <tool_name> --tools "$SKILL_DIR/tools/" --dry-run # Preview SQL
ibmi tools show <tool_name> --tools "$SKILL_DIR/tools/"     # View details

Reference Documentation

参考文档

  • Java Services Catalog -- Available SQL services
  • Example SQL Patterns -- Working query examples
  • IBM JVM_INFO -- View documentation
  • Java 服务目录 -- 可用的 SQL 服务
  • 示例 SQL 模式 -- 可直接使用的查询示例
  • IBM JVM_INFO -- View 文档