可视化GC日志分析工具

2019/06/23 JVM

许多人的努力,只是为了欺骗自己和做给别人看的而已。他们都只是看起来很努力而已。

https://raw.githubusercontent.com/longfeizheng/longfeizheng.github.io/master/images/jvm/jvm01.jpeg

概述

本章給大家推荐一款web可视化分析GC日志工具

准备测试代码


public class TestGC {

    // 实现:不断的产生新的数据(对象),随机的废弃对象(垃圾)
    public static void main(String[] args) throws Exception {
        List<Object> list = new ArrayList<Object>();
        while (true){
            int sleep = new Random().nextInt(100);

            if(System.currentTimeMillis() % 2 == 0){
                // 当前的时间戳,是偶数
                list.clear();
            }else{
                // 向list中添加10000个对象
                for (int i = 0; i < 10000; i++) {
                    Properties properties = new Properties();

                    properties.put("key_" + i, "value_"+System.currentTimeMillis() + i);

                    list.add(properties);
                }
            }

            Thread.sleep(sleep);

        }

    }

}

GC参数配置

-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -Xmx256m -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -Xloggc:./gc.log

GC Easy 可视化工具

GC Easy是一款在线的可视化工具,易用、功能强大,网站:http://gceasy.io/

https://raw.githubusercontent.com/longfeizheng/longfeizheng.github.io/master/images/jvm/jvm02.png

堆信息

https://raw.githubusercontent.com/longfeizheng/longfeizheng.github.io/master/images/jvm/jvm03.png

关键的绩效指标

https://raw.githubusercontent.com/longfeizheng/longfeizheng.github.io/master/images/jvm/jvm04.png

图表展示

https://raw.githubusercontent.com/longfeizheng/longfeizheng.github.io/master/images/jvm/jvm05.png

GC统计

https://raw.githubusercontent.com/longfeizheng/longfeizheng.github.io/master/images/jvm/jvm06.png

https://raw.githubusercontent.com/longfeizheng/longfeizheng.github.io/master/images/jvm/jvm07.png

对象统计

https://raw.githubusercontent.com/longfeizheng/longfeizheng.github.io/master/images/jvm/jvm08.png

Show Disqus Comments

Search

    Post Directory