Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Java Memory Structure

Understanding how memory is structured on the JVM ( Hotspot/OpenJDK) becomes important when you really want to troubleshoot your production environment. In this short talk I will delve into the basics of the topic and demystify some of the misconceptions.
Talk given at Java.IL user group

Libros relacionados

Gratis con una prueba de 30 días de Scribd

Ver todo

Audiolibros relacionados

Gratis con una prueba de 30 días de Scribd

Ver todo
  • Sé el primero en comentar

Java Memory Structure

  1. 1. Haim Yadid JVM Memory Structure
  2. 2. About Me • Developing software since 1984 • Basic -> Pascal -> C -> C++ -> Java -> Kotlin • Developer , architect, group manager • Independent performance expert for 8 years • Group manager in • Java.IL
  3. 3. • Founded in the Beginning of 2016 • Disrupt the small businesses insurance field • Providing online experience which is simple, fast and transparent • HQ@Palo Alto / RnD@Kfar Saba (Israel) / Austin-TX • We started to write real code on May 2016
  4. 4. Heap • -Xms • -Xmx Xms Xmx Max Init
  5. 5. Physical vs Process Memory 0 2^32/2^48Process Address Space Physical memory0 Page Swap Page Page Page Reserved/Virtual Page Page Page Page Committed - activeCommitted - inactive
  6. 6. Heap structure • JMX: java.lang.Memory::HeapMemoryUsage • Continuous address space Used VirtualCommited Max Init
  7. 7. JVisualVM Heap
  8. 8. Not Only Heap • Heap • Code cache • Meta spaces (Native) • Native memory Heap Code Cache 0 2^32/2^48 Native Native Native Meta Meta
  9. 9. Meta Space • Classes byte code • Part of native memory. • Need not be continuous in memory or pre reserved. • Limit by -XX:MaxMetaspaceSize=
  10. 10. JVisualVM JMX : java.lang.MemoryPool.Metaspace::usage
  11. 11. Code cache • JIT’ed hotspot methods (machine code) • -XX:InitialCodeCacheSize=2555904 (2.5MB) • -XX:ReservedCodeCacheSize=251658240 (240MB) • codecache flushing -XX:+UseCodeCacheFlushing
  12. 12. JVisualVM JMX : java.lang.MemoryPool.Code Cache::usage
  13. 13. Native Memory • Thread stacks (1MB for 64 bit OS) • Native allocations • Direct byte buffer java.nio.DirectByteBuffer • Limit by : -XX:MaxDirectMemorySize= • unsafe.allocateMemory • JNI malloc()
  14. 14. Calculating it All • Heap Max = 1 GB • 100 threads = 100 MB • Code cache 256 MB • Meta space 100 MB
  15. 15. Native Memory Tracking java -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+PrintNMTStatistics
  16. 16. jcmd <pid> VM.native_memory summary Native Memory Tracking: Total: reserved=5808103KB, committed=1987515KB - Java Heap (reserved=4194304KB, committed=1647104KB) (mmap: reserved=4194304KB, committed=1647104KB) - Class (reserved=1118666KB, committed=77258KB) (classes #12468) (malloc=10698KB #17369) (mmap: reserved=1107968KB, committed=66560KB) - Thread (reserved=44541KB, committed=44541KB) (thread #45) (stack: reserved=44192KB, committed=44192KB) (malloc=137KB #230) (arena=212KB #89) ….. -
  17. 17. Docker -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=
  18. 18. Lorem Ipsum Dolor Questions?

    Sé el primero en comentar

    Inicia sesión para ver los comentarios

  • naveenkapoor7127

    Feb. 27, 2019

Understanding how memory is structured on the JVM ( Hotspot/OpenJDK) becomes important when you really want to troubleshoot your production environment. In this short talk I will delve into the basics of the topic and demystify some of the misconceptions. Talk given at Java.IL user group

Vistas

Total de vistas

658

En Slideshare

0

De embebidos

0

Número de embebidos

8

Acciones

Descargas

10

Compartidos

0

Comentarios

0

Me gusta

1

×