Memory Management: What You Need to Know When Moving to Java 8
The document provides a detailed overview of memory management considerations when migrating to Java 8, focusing on memory types such as stack, heap, and metaspace, as well as garbage collection methods. It highlights the differences in memory behavior and errors between Java 6, 7, and 8, particularly with the transition from permgen to metaspace. Additionally, the document emphasizes the need for monitoring metaspace and selecting appropriate garbage collection strategies to optimize performance.
An introduction to memory management concepts in the context of Java 8, set by Todd Rader of AppDynamics.
AppDynamics showcases strong market growth with 175% bookings growth in 2013 and over 1000 customers; highlights low ownership costs and enterprise adoption.
Outline of topics including memory basics, garbage collectors, a bake-off comparison, summary, and Q&A session.
Description of stack memory in Java, including call stack per thread, stack size adjustments, and observed call depth before StackOverflowError.
Insights into stack size adjustments and their impact on performance, with specific examples showing potential memory savings.
Overview of heap memory structure, including Eden, Survivor, and Old/Tenured generations.
Analysis of object survival demographics in heap memory and tools to monitor and adjust heap settings.
Visual representation of memory management in Java 6 HotSpot.
Explanation of PermGen and Metaspace across Java versions, illustrating changes in memory management.
Illustration of various OutOfMemoryError scenarios encountered in Java 6, 7, and 8 related to memory allocation.
Details on how metadata handling was transitioned from PermGen to Metaspace in Java 7 and 8.
Replacement of PermGen with Metaspace in Java 8 and related startup flags and memory management considerations.
Introduction of new memory pool objects in Java 8, making old PermGen flags obsolete.
Consequences of Metaspace errors and need for monitoring to prevent memory leaks affecting the entire system.
Available tools and support for monitoring Metaspace in Java 8, including JMX and JVisualVM.
Brief mention of direct memory usage in Java via sun.misc.Unsafe, indicating its exclusion from in-depth discussion.
Overview of garbage collection strategies, highlighting default settings for Java 7 and 8, including Parallel GC.
Description of a GC performance testing program that compares different GC strategies on Java's performance.
Performance results from Java 7's Parallel GC in terms of heap usage and garbage collection times.
Examination of Concurrent Mark-Sweep GC performance in Java 7, highlighting memory usage and garbage collection metrics.
Review of G1GC performance in Java 7 and comparison against other GC strategies.
Conclusion on G1GC as the best GC strategy in Java 7, based on performance in extensive testing.
Introduction to earlier findings with Java 8’s Parallel GC performance metrics.
Analysis of Java 8's Parallel GC performance, including heap usage and garbage collection times.
Discussion on the performance of ConcMarkSweep GC in Java 8 revealing significant issues.
Performance highlights of G1GC in Java 8 compared to Java 7.
Final analysis declaring G1GC as the overall best GC strategy in both Java 7 and Java 8.
Brief insights into the complexity and number of GC tuning parameters available in Java.
Key points summarizing best practices for monitoring, managing memory, and understanding garbage collectors.
Information on how to access a free trial of AppDynamics services.
Conclusion and expression of gratitude to attendees of the presentation.
#3 SLIDE3: Why AppDynamics? establish credibility through 3rd party validation Commitment to customer success Business and customer growth Describe our GTM model – ease of deployment, Enterprise grade, proven in the most demanding environments and high impact, fast .
#5 Quiz: what is the default Java stack size? Point of slide: If you’ve ever had to manage stack size, don’t expect Java 8 behavior to be the same as Java 7 Note that you can’t directly get the stack trace depth, only the size.
#7 Question: how many modern apps have this object death rate? Question: what common technique completely changes this picture?
#8 Question: how many modern apps have this object death rate?
#9 Blast from the past – Java 6 HotSpot Summary: heap is basically the same in Java 6/7/8, but GC options change Any questions about heap?
#11 Ask if anybody is surprised by this, can explain this
#12 Mention performance impact if interned strings were a big source of PermGen use in Java 6 Ask about the logo
#13 Push on the “no max size” theme. What would happen if a program that leaked class metadata permgen in Java 6 were put onto Java 8? Can get old behavior with MaxMetaSpaceSize
#15 Story about how PermGen can affect monitoring tools Retransform -> app holds onto class/meta references (reflection object caching)
#16 A PermGen problem will be less frequent but more severe if it moves to being a metaspace problem
#17 Ask for any questions on memory before we switch to garbage collection
#19 Why 15-minute periods? – practical: time needed to tune program for proper rate of allocation plus doing all the runs for comparison.