java - Java JVM 元空间分配很多但使用很少
解决方案
The size of metaspace is controlled by the JVM according to metaspace usage, and within the constraints of certain tuning parameters that are set via command line options ... or defaults.
The
-XX:MetaspaceSize
option gives the initial size of metaspace. The default is platform specific.The
-XX:MaxMetaspaceSize
option gives an upper limit for the size. The JVM won't go beyond that limit. The default for this is "unlimited".The
-XX:MaxMetaspaceFreeRatio
and-XX:MinMetaspaceFreeRatio
control the JVM's resizing of metaspace following a GC run. Basically, the JVM tries to keep the free space to used space ratio within the specified range ... by increasing or decreasing the size.
So to answer your question:
Java JVM meta space allocated a lot but used less.
It will be a reflection of either how big the metaspace was to start with (determined by -XX:MetaspaceSize
or its default value) and what the actual peak and recent metaspace usage patterns have been.
I haven't seen anything explicit about this, but metaspace resizing probably behaves like normal Java heap resizing. The JVM only reduces the size of the metaspace only after a major garbage collection and does it "cautiously". (If metaspace is reduced too much or too soon, that is liable to trigger a major garbage collection.)
However, there is no need to worry about this. If the metaspace is underused, the unused portions should not (in the long term) tie down physical RAM pages. The OS's virtual memory system should write out the page content to disk (if the pages are dirty) and then reallocate the RAM pages to something else. Normal virtual memory stuff.
推荐阅读
- jpa - 使用 EmbeddedID 创建新的 JPA 实体
- javascript - 应用 JS 功能后“按钮”缩小
- javascript - 无法创建 Vue 应用程序 http-server - 错误:css 和 js 文件 404 未找到
- javascript - 为什么当我滚动到顶部然后在我的 API 应用程序上返回但在网页上正常运行时,我的页面顶部按钮口吃/滞后/粘住?
- html - 制作多个时HTML超链接不起作用
- r - 根据条件仅将 R 中的某些行转换为绝对值
- android - 如何将笔画添加到材质按钮的底部?
- javascript - Javascript在页面加载时更新标签的href
- typescript - 类型'文章| null' 不可分配给类型 'void'
- python - 我如何使不和谐的机器人不区分大小写?不和谐.py