JVM GC Performance Tuning

本文介绍了 Java 垃圾回收 (GC) 的基础知识,包括堆空间的组成:年轻代、老年代和永久代。文章详细解释了不同类型的垃圾回收过程,如 Mini GC 和 Full GC,并提供了调优建议,例如通过设置 -XX:NewRatio 参数来调整年轻代与老年代的比例,以及如何使用 GC Viewer 工具来分析 GC 日志。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Here is something about the java gc tuning tips;

1. The heap size consists of three parts: young generation area, old generation area, perm area. In Java, long lived objects such as classes or methods are living in the perm are. There is no way to gc area. So we need to mark the young area clean enough and the perm area big enough. Young generation is separated into three parts: when a new object is “dead”, it will copy from the “from survivor” spaces to the “to survivor” spaces. And the “Eden” area is a place for java to get the objects. So if the “Eden” area is full when a “mini collection” is called, we also name that as “GC”. And when an old generation area is full, we get a “Full collection”. Well, the “Full GC” will consume much time then the “GC” which may make the app a relatively long pause. If “Full GC” is too frequently, the app will pause too long.
2. In java options “-XX: new radio” is set for the radio between for the “young generation” and “old young generation”. E.g. if set to “2”, that may the “young area” will cost one third of the heap space.
3. Another reference index is called “throughput”, which means the time jvm consume for not on the “GC”. So the larger it shows, the better performance will get.
4. “GCViewer” is a open source tool for check the gc log.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值