可视化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://i-blog.csdnimg.cn/blog_migrate/3a22199f69261c98dccd0b74589b464b.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值