如何配置一个完美的JVM日志打印信息
先点赞,在收藏,养成良好一键三连白嫖习惯hhhh
- 本文记录下在学习和生产中如何打印和测试GC问题,那么一定会配置打印GC日志参数,因此配置一个全面且通用的GC日志打印就尤为重要了。
打印内容
为了保留足够多的“现场证据”,最好是 GC 相关的信息打印完整。而且你的程序真的不差你GC时打印日志I/O消耗的那点性能。
打印基本的GC信息
打印GC日志第一步,就是开启打印GC参数,也就是最基本的参数
-XX:+PrintGCDetails -XX:+PrintGCDateStamps
打印对象分布情况
为了分析GC时晋升情况和晋升导致的高暂停,不看对象年龄分布日志怎么可以呢?
-XX:PrintTenuringDistrution
输出内容实例
Desired survivor size 59244544 bytes, new threshold 15 (max 15)
- age 1: 963176 bytes, 963176 total
- age 2: 791264 bytes, 1754440 total
- age 3: 210960 bytes, 1965400 total
- age 4: 167672 bytes, 2133072 total
- age 5: 172496 bytes, 2305568 total
- age 6: 107960 bytes, 2413528 total
- age 7: 205440 bytes, 2618968 total
- age 8: 185144 bytes, 2804112 total
- age 9: 195240 bytes, 2999352 total
- age 10: 169080 bytes, 3168432 total
- age 11: 114664 bytes, 3283096 total
- age 12: 168880 bytes, 3451976 total
- age 13: 167272 bytes, 3619248 total
- age 14: