什么是元数据GC阈值以及如何调整它? [英] What is the Metadata GC Threshold and how do I tune it?

查看:2075
本文介绍了什么是元数据GC阈值以及如何调整它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序中,我有以下 -verbose:gc

  2065630K(31574016K),0.3831399秒] 
[完全GC(元数据GC阈值)2065630K-> 2053217K(31574016K),3.5927870秒]
[GC (元数据GC阈值)8061486K-> 2076192K(31574016K),0.0096316秒]
[完全GC(元数据GC阈值)2076192K-> 2055722K(31574016K),0.9376524秒]
[GC (全部GC(元数据GC阈值)2100440K-> 2077052K(31574016K),4.1662779秒]
/ pre>

这是什么元数据GC阈值以及如何减少它。注意:虽然Full GC花了很长时间清理,但实际上它清理得很多,也就是说,如果不这样做,它会更好。

解决方案

日志消息告诉GC由Metaspace 分配失败引起。
Metaspaces 包含类元数据。他们在Java 8中 出现来替换 PermGen em>。



这里是 a>调整元空间的一些选项。

您可能需要设置以下一个或多个选项:

-XX:MetaspaceSize = 100M 设置分配的类元数据空间的大小,在首次超出时触发垃圾回收;

-XX:InitialBootClassLoaderMetaspaceSize = 32M 增加引导类加载器Metaspace;

-XX:MinMetaspaceFreeRatio = 50 使Metaspaces变得更加积极;

-XX:MaxMetaspaceFreeRatio = 80 以减少Metaspaces缩小的机会;

-XX:MinMetaspaceExpansion = 4M 最小的尺寸Metaspace扩展;

-XX:MaxMetaspaceExpansion = 16M 无Full GC时扩展Metaspace的最大大小。


In an application I have the following -verbose:gc

[GC (Metadata GC Threshold)  8530310K->2065630K(31574016K), 0.3831399 secs]
[Full GC (Metadata GC Threshold)  2065630K->2053217K(31574016K), 3.5927870 secs]
[GC (Metadata GC Threshold)  8061486K->2076192K(31574016K), 0.0096316 secs]
[Full GC (Metadata GC Threshold)  2076192K->2055722K(31574016K), 0.9376524 secs]
[GC (Metadata GC Threshold)  8765230K->2100440K(31574016K), 0.0150190 secs]
[Full GC (Metadata GC Threshold)  2100440K->2077052K(31574016K), 4.1662779 secs]

What is this "Metadata GC threshold" and how to I reduce it. Note: while the Full GC spends a long time cleaning up it does actually clean up much, i.e. it would be better if it didn't do this.

解决方案

The log message tells that GC was caused by Metaspace allocation failure. Metaspaces hold class metadata. They have appeared in Java 8 to replace PermGen.

Here are some options to tune Metaspaces.
You may want to set one or several of the following options:

-XX:MetaspaceSize=100M Sets the size of the allocated class metadata space that will trigger a garbage collection the first time it is exceeded;

-XX:InitialBootClassLoaderMetaspaceSize=32M to increase the boot class loader Metaspace;

-XX:MinMetaspaceFreeRatio=50 to make Metaspaces grow more agressively;

-XX:MaxMetaspaceFreeRatio=80 to reduce the chance of Metaspaces shrinking;

-XX:MinMetaspaceExpansion=4M the minumum size by which a Metaspace is exanded;

-XX:MaxMetaspaceExpansion=16M the maximum size to expand a Metaspace by without Full GC.

这篇关于什么是元数据GC阈值以及如何调整它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆