性能问答>jvm堆外内存分析>
12回复
5月前

jvm堆外内存分析



问题描述:
某一个系统生产环境java进程占用2.5GB内存,但是堆的最大内存1.5GB,导致容器会重启,启动参数为:-Xms1536M -Xmx1536M -XX:NativeMemoryTracking=detail -Xss512k -XX:MaxDirectMemorySize=128m -XX:MetaspaceSize=384m -XX:MaxMetaspaceSize=512m -XX:MaxRAM=3G -XX:MaxRAMPercentage=85 -XX:HeapDumpPath=$$HEAP_DUMP_PATH

以下是刚开始执行的jcmd <pid> VM.native_memory summary命令:
Native Memory Tracking:

(Omitting categories weighting less than 1KB)

Total: reserved=2794695KB, committed=2189275KB

  •             Java Heap (reserved=1572864KB, committed=1572864KB)
                          (mmap: reserved=1572864KB, committed=1572864KB) 
    
  •                 Class (reserved=428242KB, committed=35282KB)
                          (classes #43084)
                          (  instance classes #40821, array classes #2263)
                          (malloc=6354KB #127216) 
                          (mmap: reserved=421888KB, committed=28928KB) 
                          (  Metadata:   )
                          (    reserved=212992KB, committed=205440KB)
                          (    used=203944KB)
                          (    waste=1496KB =0.73%)
                          (  Class space:)
                          (    reserved=421888KB, committed=28928KB)
                          (    used=26995KB)
                          (    waste=1933KB =6.68%)
    
  •                Thread (reserved=99519KB, committed=19791KB)
                          (thread #182)
                          (stack: reserved=98992KB, committed=19264KB)
                          (malloc=316KB #1092) 
                          (arena=211KB #361)
    
  •                  Code (reserved=257640KB, committed=132576KB)
                          (malloc=9952KB #39826) 
                          (mmap: reserved=247688KB, committed=122624KB) 
    
  •                    GC (reserved=102252KB, committed=102252KB)
                          (malloc=10908KB #65717) 
                          (mmap: reserved=91344KB, committed=91344KB) 
    
  •              Compiler (reserved=1618KB, committed=1618KB)
                          (malloc=1453KB #3302) 
                          (arena=165KB #5)
    
  •              Internal (reserved=8142KB, committed=8142KB)
                          (malloc=8106KB #65996) 
                          (mmap: reserved=36KB, committed=36KB) 
    
  •                 Other (reserved=28023KB, committed=28023KB)
                          (malloc=28023KB #225) 
    
  •                Symbol (reserved=43385KB, committed=43385KB)
                          (malloc=41299KB #1019999) 
                          (arena=2086KB #1)
    
  • Native Memory Tracking (reserved=21761KB, committed=21761KB)
    (malloc=635KB #9047)
    (tracking overhead=21126KB)

  •    Shared class space (reserved=12288KB, committed=12172KB)
                          (mmap: reserved=12288KB, committed=12172KB) 
    
  •           Arena Chunk (reserved=181KB, committed=181KB)
                          (malloc=181KB) 
    
  •               Tracing (reserved=32KB, committed=32KB)
                          (arena=32KB #1)
    
  •               Logging (reserved=5KB, committed=5KB)
                          (malloc=5KB #220) 
    
  •             Arguments (reserved=3KB, committed=3KB)
                          (malloc=3KB #99) 
    
  •                Module (reserved=3009KB, committed=3009KB)
                          (malloc=3009KB #11506) 
    
  •             Safepoint (reserved=8KB, committed=8KB)
                          (mmap: reserved=8KB, committed=8KB) 
    
  •       Synchronization (reserved=554KB, committed=554KB)
                          (malloc=554KB #4655) 
    
  •        Serviceability (reserved=4KB, committed=4KB)
                          (malloc=4KB #23) 
    
  •             Metaspace (reserved=215164KB, committed=207612KB)
                          (malloc=2172KB #2650) 
                          (mmap: reserved=212992KB, committed=205440KB) 
    
  •  String Deduplication (reserved=1KB, committed=1KB)
                          (malloc=1KB #8)
    

目前容器4天左右重启一次

649 阅读
请先登录,查看12条精彩评论吧
快去登录吧,你将获得
  • 浏览更多精彩评论
  • 和开发者讨论交流,共同进步