您的位置:首页 > 运维架构

RocketMQ broker jvm 监控

2016-08-06 08:01 323 查看
1. jps 获取要监控broker jvm 的进程ID

jsp



2. nohup 输出监控日志

nohup jstat -gc -t [pid] [interval]



-t 会在每一条记录前加时间戳,执行命令间隔interval(毫秒)

3. 想要结束监控时Ctrl+C



4. 查看日志

cat nohup.out



5. 获取进程开始时间



6. 将时间转成timestamp 同日志中的时间相加转成当前时间(日志中单位s)

例如查看第三条记录执行时间

public static void main(String[] args) throws ParseException {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date date = df.parse("2015-06-23 10:22:27");
Calendar c = Calendar.getInstance();
c.setTimeInMillis(date.getTime() + 111919 * 1000);

System.out.println(c.getTime());
}


结果:

Wed Jun 24 17:27:46 CST 2015


7. 分析日志中内存使用及垃圾回收情况

TimestampS0CS1CS0US1UECEUOCOUPCPUYGCYGCTFGCFGCTGCT
111916.9209664.0209664.0160735.40.01677824.0100273.52097152.0898708.6131072.015537.96815.47700.00015.477
Garbage-collected heap statistics.

Timestamp: Timestamp (s).

S0C Current survivor space 0 capacity (KB).
S1C Current survivor space 1 capacity (KB).
S0U Survivor space 0 utilization (KB).
S1U Survivor space 1 utilization (KB).
EC Current eden space capacity (KB).
EU Eden space utilization (KB).
OC Current old space capacity (KB).
OU Old space utilization (KB).
PC Current permanent space capacity (KB).
PU Permanent space utilization (KB).
YGC Number of young generation GC Events.
YGCT Young generation garbage collection time.
FGC Number of full GC events.
FGCT Full garbage collection time.
GCT Total garbage collection time.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: