可视化GC日志分析工具

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

https://user-gold-cdn.xitu.io/2019/6/23/16b843976eaaaf79?w=2097&h=1500&f=jpeg&s=378756

概述

本章給大家推荐一款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://user-gold-cdn.xitu.io/2019/6/23/16b843976eb3e2f7?w=1556&h=580&f=png&s=395512

堆信息

https://user-gold-cdn.xitu.io/2019/6/23/16b843976e9824ca?w=1197&h=444&f=png&s=62737

关键的绩效指标

https://user-gold-cdn.xitu.io/2019/6/23/16b843976f22ac16?w=1254&h=591&f=png&s=84536

图表展示

https://user-gold-cdn.xitu.io/2019/6/23/16b84397cd44a219?w=1210&h=694&f=png&s=77240

GC统计

https://user-gold-cdn.xitu.io/2019/6/23/16b8439826f89792?w=1252&h=483&f=png&s=52743

https://user-gold-cdn.xitu.io/2019/6/23/16b84398a382841e?w=1176&h=654&f=png&s=101809

对象统计

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

猜你喜欢

转载自blog.csdn.net/dandandeshangni/article/details/93403413