JCMD的代码/内部部分包含哪些内容? [英] What is contained in code/internal sections of JCMD?
问题描述
为基于JVM的服务标注docker容器的方法很棘手(众所周知)。我很确定我们对容器的尺寸略微不足,并希望澄清一些与我们在监控时看到的特定jcmd(本机内存跟踪器)输出相关的问题。
Dimensioning a docker container for a JVM based service is tricky (as we all know). I'm pretty sure we have slightly under-dimensioned a container and want to clear up a few questions I have relating to specific jcmd (Native Memory Tracker) outputs that we see when monitoring.
问题:
- jcmd报告的内部包含直接字节缓冲区吗?
- 除了jcmd报告的代码中的代码缓存还有什么?
- 是否有一种很好的方法来限制jcmd报告的代码部分。我阅读了 https://docs.oracle.com/ javase / 8 / embedded / develop-apps-platforms / codecache.htm 但这仅涵盖代码缓存限制,建议保持JVM默认为。
- Are Direct Byte Buffers included in "Internal" as reported by jcmd?
- What else apart from code cache is in "Code" as reported by jcmd?
- Is there a good way to limit the "Code" section as reported by jcmd. I read https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm but this only covers the code cache limits and it is suggested to leave the JVM default as is.
JCMD输出在这里。
直接字节缓冲区 JMX属性在这里。
Direct Byte Buffers JMX properties are here.
一些背景细节:
设置:
- 基于Spring启动的应用程序
-
JVM选项:
- Spring boot based application
JVM Options:
- server -Xms1792m -Xmx1792m -XX:MetaspaceSize = 128M -
XX:MaxMetaspaceSize = 192M -XX:+ UseG1GC -XX:+ UseStringDeduplication -
XX:MaxDirectMemorySize = 256m -XX:NativeMemoryTracking = detail
-server -Xms1792m -Xmx1792m -XX:MetaspaceSize=128M - XX:MaxMetaspaceSize=192M -XX:+UseG1GC -XX:+UseStringDeduplication - XX:MaxDirectMemorySize=256m -XX:NativeMemoryTracking=detail
推荐答案
直接字节缓冲区是否包含在内部报告中jcmd?
Are Direct Byte Buffers included in "Internal" as reported by jcmd?
(已更新)
ByteBuffer.allocateDirect
内部调用 Unsafe.allocateMemory
哪个 计算 (用 mtInternal
常数)。
(updated)
ByteBuffer.allocateDirect
internally calls Unsafe.allocateMemory
which is counted by NMT in the Internal section (denoted by mtInternal
constant).
相反,MappedByteBuffers(由 FileChannel.map $ c $获得c>)没有反映在NMT报告中,尽管从操作系统的角度来看它们肯定会影响进程使用的内存量。
On the contrary, MappedByteBuffers (obtained by FileChannel.map
) are not reflected in NMT report, though they definitely may affect the amount of memory used by the process from OS perspective.
除了代码缓存之外,我也是n由jcmd报告的代码?
What else apart from code cache is in "Code" as reported by jcmd?
用于维护编译代码和生成的运行时存根的辅助VM结构:哈希表,代码字符串,适配器与CodeCache本身相比,它们都相当小。这些结构构成报告中的'malloc'部分,而CodeCache进入'mmap'部分。
Auxiliary VM structures for maintaining compiled code and generated runtime stubs: hashtables, code strings, adapter fingerprints etc. They all are rather small comparing to the CodeCache itself. These structures make up 'malloc' part in the report while the CodeCache goes into 'mmap' part.
是否有一种好方法可以限制jcmd报告的代码部分。
Is there a good way to limit the "Code" section as reported by jcmd.
关闭分层编译( -XX:-TieredCompilation
)
可能会减少代码使用的内存量,因为生成的代码会少得多。但请确保您了解分层编译是什么以及它可能产生的性能影响。
Turning off tiered compilation (-XX:-TieredCompilation
)
is likely to reduce the amount of memory used by "Code", just because there will be a lot less generated code. But make sure you understand what tiered compilation is and what performance impact it may have.
这篇关于JCMD的代码/内部部分包含哪些内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!