SlideShare a Scribd company logo
1 of 60
Download to read offline
Choosing Right Garbage Collector
for Efficient Java Memory Usage
Ruslan Synytsky
Agenda
● Java Memory Usage Problems
● JDK Improvements for Elastic Java Memory Scaling
● Garbage Collection Testing Results
Heap Vertical Scaling
Unreleased Heap Memory
OOM Error and OOM Killer
● OutOfMemoryError exception is usually thrown when there is insufficient
space to allocate an object in the Java heap or insufficient native memory to
support the loading of a Java class
● oom_kill is a job that helps to sacrifice one or more processes in order to
free up memory for the system
Over-Allocation and Underutilization
Java Memory Consumption Problems
The most widely acknowledged issue with Java EE is large memory requirements (40%), then
slow startup times (40%), followed by missing technologies and specifications (20%)
Jakarta EE Developer Survey 2018
Pay-Per-Use Billing Model
Using automatic vertical scaling, cloud providers can offer economically
advantageous pricing based on the real resource consumption
Forbes - Deceptive Cloud Efficiency: Do You Really Pay As You Use?
Too Many Points to Consider
Understanding of the OutOfMemoryError Exception
● java.lang.OutOfMemoryError: Java heap space
● java.lang.OutOfMemoryError: GC Overhead limit exceeded
● java.lang.OutOfMemoryError: Requested array size exceeds VM limit
● java.lang.OutOfMemoryError: Metaspace
● java.lang.OutOfMemoryError: request size bytes for reason. Out of swap
space?
● java.lang.OutOfMemoryError: Compressed class space
● java.lang.OutOfMemoryError: reason stack_trace_with_native_method
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks002.html
Understanding of the OutOfMemoryError Exception
OutOfMemoryError Exception
OOM Killer
OOM Killer
Runtime Environments
● Application Containers
● System Containers
● Virtual Machines
Heap Vertical Scaling
Unreleased Heap Memory
Calling Full GC Periodically (Before OpenJDK12)
https://github.com/jelastic-jps/java-memory-agent
Compacting GC cycles are not triggered automatically and must be
executed explicitly
Workaround:
inject an agent which monitors the memory usage and calls System.gc()
periodically:
-javaagent:jelastic-gc-agent.jar=period=300,debug=true
G1 and Full GC
java -XX:+UseG1GC -Xmx2g -Xms32m -jar app.jar 0
Memory grew from 32 MB to 1 GB in 25 seconds
https://github.com/jelastic/java-vertical-scaling-test
Timely Reduce Unused Committed Memory (JEP 346)
Make the G1 garbage collector automatically give back Java heap memory to
the operating system when idle
● G1PeriodicGCInterval
● G1PeriodicGCSystemLoadThreshold
● G1PeriodicGCInvokesConcurrent
JEP 346: Promptly Return Unused Committed Memory from G1
java -Xms32M -Xmx2g -XX:+UseG1GC -XX:G1PeriodicGCSystemLoadThreshold=0.6
-XX:G1PeriodicGCInterval=900k -jar app.jar
Improved Elasticity
Automatically Released Heap
Community Recognition
Special Appreciation
to Rodrigo Bruno
Senior/Postdoc Researcher at the Systems
Group in ETH Zurich.
PhD in Técnico (University of Lisbon)
Running GC
Tests in Jelastic
Load Testing Logic
https://github.com/jelastic/java-vertical-scaling-test/blob/ma
ster/src/com/jelastic/verticalscaling/Load.java#L50
java [OPTIONS] -jar app.jar <sleep> <mode>
where
sleep - 10
mode - 1
Auto Testing Package
https://github.com/jelastic/java-vertical-scaling-test/blob/master/manifest.yml
G1 Collector (-XX:+UseG1GC)
The Garbage-First (G1) is a server-style Garbage Collector for multiprocessor
machines with a large amount of memory. The heap is partitioned into
fixed-sized regions and G1 tracks the live data in those regions. When Garbage
Collection is required, it collects from the regions with less live data first.
● 2004, Sun Microsystems
JEP 346: Promptly Return Unused Committed Memory from G1
G1
-Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UseG1GC -XX:G1PeriodicGCInterval=1k
G1 and G1PeriodicGCSystemLoadThreshold
https://github.com/lxc/lxcfs/
Using LXCFS to Improve Container Resource Visibility
Threshold for the current system load as returned by the hosts getloadavg() call to determine whether a
periodic garbage collection should be triggered:
● a current system load higher than the tigger value prevents periodic garbage collections
● zero value indicates that this threshold check is disabled
If running in Docker container then use
Shenandoah GC (-XX:+UseShenandoahGC)
Shenandoah GC is a concurrent garbage collector for the JVM. GC tries to
perform most of the activities in parallel without interrupting application
performance. Such parallelism makes “stop-the-world” (STW) pauses extremely
short. Another inherent advantage is an efficient work with small and large heaps
with no impact on STW pauses’ length.
● 2014, Christine H. Flood, Red Hat
https://wiki.openjdk.java.net/display/shenandoah/Main#Main-Heuristics
-Xmx3g -Xms32m -XX:+UseCompressedOops 
-XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
Shenandoah
G1 vs Shenandoah - CPU Usage
G1
Shenandoah
ZGC (-XX:+UseZGC)
ZGC is low latency scalable garbage collector. Designed for use with
applications that require a large heap and low latency. It uses a bunch of one
generation and performs most (but not all) garbage collection in parallel with
uninterrupted application work. This greatly limits the impact of garbage
collection on your application response time.
● 2018, Per Liden, Oracle
JEP 351: ZGC: Uncommit Unused Memory - available from JDK 13 Release
-Xmx3g -Xms32m -XX:+UnlockExperimentalVMOptions 
-XX:+UseZGC -XX:ZUncommitDelay=1 -XX:ZCollectionInterval=30
ZGC @ Oracle OpenJDK
OpenJ9
OpenJ9 uses the Generational Concurrent (-Xgcpolicy:gencon) policy by
default, which is best suited to transactional applications that have many short
lived objects. Alternative policies are available, including those that cater for
applications with large Java heaps (-Xgcpolicy:balanced), applications that are
sensitive to response-time (-Xgcpolicy:metronome), or applications that require
high application throughput (-Xgcpolicy:optthruput).
● 2017, Eclipse Foundation
-Xmx3g -Xms32m -XX:+UseCompressedOops 
-XX:+IdleTuningCompactOnIdle -XX:+IdleTuningGcOnIdle -XX:IdleTuningMinIdleWaitTime=1 
-Xjit:waitTimeToEnterDeepIdleMode=1000
Bash command to check the real usage
while true
do
pid=$(pgrep -f java | tail -n1)
used=$(ps -orss --no-headers --pid $pid)
echo "scale=2 ; $used / 1024/1024" | bc
sleep 1
done
Inconsistent behaviour with -XX:+IdleTuningGcOnIdle, mem not released back to OS on Idle
OpenJ9
C4 GC
● 2010, Gil Tene, Azul Systems
The C4 (Continuously Concurrent Compacting Collector) is an updated
generational form of the Azul Pauseless GC Algorithm and is the default
collector of Zing®. C4 differentiates itself from other generational garbage
collectors by supporting simultaneous – generational concurrency: the
different generations are collected using concurrent (non-stop-the-world)
mechanisms that can be simultaneously and independently active. Unlike
other algorithms, it is not ‘mostly’ concurrent, but fully concurrent, so it
never falls back to a stop-the-world compaction.
-Xmx500m -Xms32m -XX:+UseZST
C4 @ Zing
-Xmx500m -Xms32m -XX:+UseZST
C4 @ Zing
ConcMarkSweep GC (-XX:+UseConcMarkSweepGC)
ConcMarkSweep GC collector is designed for applications that prefer shorter
garbage collection pauses and which can afford to share processor resources
with the garbage collector while the application is running. It makes sense to use
such a collector when applications requirements for time garbage collection
pauses are low.
● 2004, Sun Microsystems
-Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC
+ periodical jcmd <pid> GC.run
ConcMarkSweep
Serial GC (-XX:+UseSerialGC)
Serial GC performs garbage collection in a single thread and has the lowest
consumption of memory among all GC types but, at the same time, it makes
long pauses that can lead to application performance degradation.
● 2004, Sun Microsystems
-Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UseSerialGC
+ periodical jcmd <pid> GC.run
Serial
Epsilon GC (-XX:+UseEpsilonGC)
Epsilon GC is a passive GC that handles memory allocation and doesn’t clear it
when objects are no longer used. When your application exhausts the Java
heap, the JVM goes down. So, EpsilonGC prolongs an application life until the
memory will run out and dumps the memory, that can be useful for application
memory usage debugging, as well as measuring and managing application
performance.
● 2014, Aleksey Shipilev, Red Hat
-Xmx3g -Xms32m -XX:+UseCompressedOops 
-XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC
Epsilon
Parallel GC (-XX:+UseParallelGC)
Parallel GC is a “stop-the-world” multithreaded Garbage Collector similar to the
serial collector. The primary difference is that multiple threads are used to speed
up garbage collection. By default, both minor and major collections are
executed in parallel to further reduce garbage collection costs.
● 2000, Sun Microsystems
-Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UseParallelGC
+ periodical jcmd <pid> GC.run
Parallel
Running GC
Tests in Kubernetes
Auto Testing Package for Kubernetes
https://github.com/jelastic/java-vertical-scaling-test/blob/master/manifest-k8s.yaml
Load Testing Logic
java [OPTIONS] -jar app.jar <sleep> <mode>
where
sleep - 100
mode - 2
https://github.com/jelastic/java-vertical-scaling-test/blob/master/
src/com/jelastic/verticalscaling/Load.java#L64
G1 in Kubernetes
Shenandoah in Kubernetes
ZGC @ Oracle OpenJDK in Kubernetes
OpenJ9 in Kubernetes
C4 @ Zing in Kubernetes
Joint Comparison - Several Load Cycles
RAM CPU
Resizing Xmx
On the Fly
Heap Resizing
Restart for Xmx Resize
-XX:SoftMaxHeapSize @ ZGC
SoftMaxHeapSize is set for the GC to
strive not to grow heap size beyond the
specified size unless it is highly needed:
● to keep the heap footprint down, while
maintaining the capability to deal with
a temporary increase in heap space
requirement
● with lots of margin, to increase
confidence that you will not run into
an allocation stall because of an
unforeseen increase in allocation rate
JEP draft: Dynamic Max Memory Limit
Xmx can be set higher than the container max memory limit
(Cmx). And both Smx and Cmx can be adjusted on the fly
without the need to restart JVM or container.
At the moment the heap size can go beyond
SoftMaxHeapSize (Smx) and there is no guarantee on how
much the heap will grow other than up to Xmx.
The problem arises when Smx < Cmx < Used Heap < Xmx:
the JVM will be killed by the OS OOM Killer as it exceeds
the amount of memory given to the container.
We suggest to provide an option for making
SoftMaxHeapSize as the hard limit, so when overshoot
happens JVM will throw OOM Error which is not as bad
OOM Kill.
Dynamic Max Memory Limit @ G1
-Xsoftmx @ OpenJ9
https://www.ibm.com/support/knowledgecenter/en/SSYKE2_8.0.0/openj9/xsoftmx/index.html
Runtime adjustable heap size (-Xsoftmx) allows to adjust heap size dynamically
and take advantage of hot-add of memory.
You can set this option on the command line, then modify it at run time by using
the com.ibm.lang.management.MemoryMXBean.setMaxHeapSize().
This option can be useful in virtualized or cloud environments, for example,
where the available memory might change dynamically to meet business needs.
By default, -Xsoftmx is set to the same value as -Xmx.
C4 is fully elastic and can return all empty pages to the OS after each GC cycle.
However, C4 sticks to the Xmx it was given, and avoid doing heavy elastic memory dance,
since relinquishing memory mappings and reestablishing them on Linux kernels is
bandwidth-limited in practice by the rate of page mapping invalidation the kernel can handle.
C4 goes above Xmx rather than go between Xms and Xmx. JavaMemMax option controls
the true maximum. In the future it will allow both scenarios where above-Xmx is allowed and
where above-Xmx is prohibited.
Two modes:
● Contingency (default mode) - goes above Xmx if it absolutely has to and will work hard
to collect and stay below Xmx.
● Insurance (best effort elasticity) - borrows available memory and goes above Xmx in
order to delay GC whenever possible.
JavaMemMax @ С4 + ZST (Zing System Tools)
Keep Only Best Java Memories
Learn More
Get In Touch
@siruslan
rs@jelastic.com

More Related Content

What's hot

Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internalsKostas Tzoumas
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesBruno Borges
 
The Current State of Table API in 2022
The Current State of Table API in 2022The Current State of Table API in 2022
The Current State of Table API in 2022Flink Forward
 
OSNoise Tracer: Who Is Stealing My CPU Time?
OSNoise Tracer: Who Is Stealing My CPU Time?OSNoise Tracer: Who Is Stealing My CPU Time?
OSNoise Tracer: Who Is Stealing My CPU Time?ScyllaDB
 
Using Queryable State for Fun and Profit
Using Queryable State for Fun and ProfitUsing Queryable State for Fun and Profit
Using Queryable State for Fun and ProfitFlink Forward
 
Low level java programming
Low level java programmingLow level java programming
Low level java programmingPeter Lawrey
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at NetflixBrendan Gregg
 
Apache Spark At Scale in the Cloud
Apache Spark At Scale in the CloudApache Spark At Scale in the Cloud
Apache Spark At Scale in the CloudDatabricks
 
Introducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorIntroducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorFlink Forward
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeperSaurav Haloi
 
Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsSpark Summit
 
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact versionscalaconfjp
 
The Missing Manual for Leveled Compaction Strategy (Wei Deng & Ryan Svihla, D...
The Missing Manual for Leveled Compaction Strategy (Wei Deng & Ryan Svihla, D...The Missing Manual for Leveled Compaction Strategy (Wei Deng & Ryan Svihla, D...
The Missing Manual for Leveled Compaction Strategy (Wei Deng & Ryan Svihla, D...DataStax
 
Data Source API in Spark
Data Source API in SparkData Source API in Spark
Data Source API in SparkDatabricks
 
Managing (Schema) Migrations in Cassandra
Managing (Schema) Migrations in CassandraManaging (Schema) Migrations in Cassandra
Managing (Schema) Migrations in CassandraDataStax Academy
 
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
Demystifying flink memory allocation and tuning - Roshan Naik, UberDemystifying flink memory allocation and tuning - Roshan Naik, Uber
Demystifying flink memory allocation and tuning - Roshan Naik, UberFlink Forward
 
Performance Tuning - Memory leaks, Thread deadlocks, JDK tools
Performance Tuning -  Memory leaks, Thread deadlocks, JDK toolsPerformance Tuning -  Memory leaks, Thread deadlocks, JDK tools
Performance Tuning - Memory leaks, Thread deadlocks, JDK toolsHaribabu Nandyal Padmanaban
 
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...HostedbyConfluent
 
Approximate Queries and Graph Streams on Apache Flink - Theodore Vasiloudis -...
Approximate Queries and Graph Streams on Apache Flink - Theodore Vasiloudis -...Approximate Queries and Graph Streams on Apache Flink - Theodore Vasiloudis -...
Approximate Queries and Graph Streams on Apache Flink - Theodore Vasiloudis -...Seattle Apache Flink Meetup
 

What's hot (20)

Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internals
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
 
The Current State of Table API in 2022
The Current State of Table API in 2022The Current State of Table API in 2022
The Current State of Table API in 2022
 
OSNoise Tracer: Who Is Stealing My CPU Time?
OSNoise Tracer: Who Is Stealing My CPU Time?OSNoise Tracer: Who Is Stealing My CPU Time?
OSNoise Tracer: Who Is Stealing My CPU Time?
 
Using Queryable State for Fun and Profit
Using Queryable State for Fun and ProfitUsing Queryable State for Fun and Profit
Using Queryable State for Fun and Profit
 
Low level java programming
Low level java programmingLow level java programming
Low level java programming
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at Netflix
 
Apache Spark At Scale in the Cloud
Apache Spark At Scale in the CloudApache Spark At Scale in the Cloud
Apache Spark At Scale in the Cloud
 
Introducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorIntroducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes Operator
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark Applications
 
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact version
 
The Missing Manual for Leveled Compaction Strategy (Wei Deng & Ryan Svihla, D...
The Missing Manual for Leveled Compaction Strategy (Wei Deng & Ryan Svihla, D...The Missing Manual for Leveled Compaction Strategy (Wei Deng & Ryan Svihla, D...
The Missing Manual for Leveled Compaction Strategy (Wei Deng & Ryan Svihla, D...
 
Data Source API in Spark
Data Source API in SparkData Source API in Spark
Data Source API in Spark
 
Managing (Schema) Migrations in Cassandra
Managing (Schema) Migrations in CassandraManaging (Schema) Migrations in Cassandra
Managing (Schema) Migrations in Cassandra
 
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
Demystifying flink memory allocation and tuning - Roshan Naik, UberDemystifying flink memory allocation and tuning - Roshan Naik, Uber
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
 
Performance Tuning - Memory leaks, Thread deadlocks, JDK tools
Performance Tuning -  Memory leaks, Thread deadlocks, JDK toolsPerformance Tuning -  Memory leaks, Thread deadlocks, JDK tools
Performance Tuning - Memory leaks, Thread deadlocks, JDK tools
 
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
 
Approximate Queries and Graph Streams on Apache Flink - Theodore Vasiloudis -...
Approximate Queries and Graph Streams on Apache Flink - Theodore Vasiloudis -...Approximate Queries and Graph Streams on Apache Flink - Theodore Vasiloudis -...
Approximate Queries and Graph Streams on Apache Flink - Theodore Vasiloudis -...
 
GraalVM
GraalVMGraalVM
GraalVM
 

Similar to Efficient Java Memory Guide Choosing Right Garbage Collector

State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020Jelastic Multi-Cloud PaaS
 
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Anna Shymchenko
 
JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance TuningJeremy Leisy
 
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java VersionsTWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java VersionsJoseph Kuo
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvmPrem Kuppumani
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsIsuru Perera
 
Mastering java in containers - MadridJUG
Mastering java in containers - MadridJUGMastering java in containers - MadridJUG
Mastering java in containers - MadridJUGJorge Morales
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaIsuru Perera
 
this-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxTier1 app
 
GC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance EngineerGC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance EngineerMonica Beckwith
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnosticsDanijel Mitar
 
Java Performance and Using Java Flight Recorder
Java Performance and Using Java Flight RecorderJava Performance and Using Java Flight Recorder
Java Performance and Using Java Flight RecorderIsuru Perera
 
Effective memory management
Effective memory managementEffective memory management
Effective memory managementYurii Kotov
 
Effective memory management
Effective memory managementEffective memory management
Effective memory managementDenis Zhuchinski
 
(JVM) Garbage Collection - Brown Bag Session
(JVM) Garbage Collection - Brown Bag Session(JVM) Garbage Collection - Brown Bag Session
(JVM) Garbage Collection - Brown Bag SessionJens Hadlich
 
Taming Java Garbage Collector
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage CollectorDaya Atapattu
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and youKai Koenig
 
Garbage First and You!
Garbage First and You!Garbage First and You!
Garbage First and You!devObjective
 

Similar to Efficient Java Memory Guide Choosing Right Garbage Collector (20)

State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
 
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
 
JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance Tuning
 
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java VersionsTWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
Jvm Architecture
Jvm ArchitectureJvm Architecture
Jvm Architecture
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and Flamegraphs
 
Mastering java in containers - MadridJUG
Mastering java in containers - MadridJUGMastering java in containers - MadridJUG
Mastering java in containers - MadridJUG
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in Java
 
this-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptx
 
GC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance EngineerGC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance Engineer
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnostics
 
Java Performance and Using Java Flight Recorder
Java Performance and Using Java Flight RecorderJava Performance and Using Java Flight Recorder
Java Performance and Using Java Flight Recorder
 
Effective memory management
Effective memory managementEffective memory management
Effective memory management
 
Effective memory management
Effective memory managementEffective memory management
Effective memory management
 
(JVM) Garbage Collection - Brown Bag Session
(JVM) Garbage Collection - Brown Bag Session(JVM) Garbage Collection - Brown Bag Session
(JVM) Garbage Collection - Brown Bag Session
 
Taming Java Garbage Collector
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage Collector
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and you
 
Garbage First and You!
Garbage First and You!Garbage First and You!
Garbage First and You!
 
Garbage First & You
Garbage First & YouGarbage First & You
Garbage First & You
 

More from Jelastic Multi-Cloud PaaS

Running Projects in Application Containers, System Containers & VMs - Jelasti...
Running Projects in Application Containers, System Containers & VMs - Jelasti...Running Projects in Application Containers, System Containers & VMs - Jelasti...
Running Projects in Application Containers, System Containers & VMs - Jelasti...Jelastic Multi-Cloud PaaS
 
Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Jelastic Multi-Cloud PaaS
 
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSMariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSJelastic Multi-Cloud PaaS
 
Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS
Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaSScaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS
Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaSJelastic Multi-Cloud PaaS
 
Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...
Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...
Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...Jelastic Multi-Cloud PaaS
 
WordPress Cluster for Enterprise High-Availability and On-Demand Scaling
WordPress Cluster for Enterprise High-Availability and On-Demand ScalingWordPress Cluster for Enterprise High-Availability and On-Demand Scaling
WordPress Cluster for Enterprise High-Availability and On-Demand ScalingJelastic Multi-Cloud PaaS
 
SaaSification in Action. Attracting Software Vendors with Easy Transformation
SaaSification in Action. Attracting Software Vendors with Easy TransformationSaaSification in Action. Attracting Software Vendors with Easy Transformation
SaaSification in Action. Attracting Software Vendors with Easy TransformationJelastic Multi-Cloud PaaS
 
State of the Art UI - Overview of Jelastic PaaS Functionality
State of the Art UI - Overview of Jelastic PaaS FunctionalityState of the Art UI - Overview of Jelastic PaaS Functionality
State of the Art UI - Overview of Jelastic PaaS FunctionalityJelastic Multi-Cloud PaaS
 
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersHow to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersJelastic Multi-Cloud PaaS
 
Multi-Cloud Lightweight Platform as a Service
Multi-Cloud Lightweight Platform as a ServiceMulti-Cloud Lightweight Platform as a Service
Multi-Cloud Lightweight Platform as a ServiceJelastic Multi-Cloud PaaS
 
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE ApplicationFrom VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE ApplicationJelastic Multi-Cloud PaaS
 
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsAutomating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsJelastic Multi-Cloud PaaS
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsJelastic Multi-Cloud PaaS
 
Cloud Hosting Business in Africa: Market Specifics and Ways to Grow
Cloud Hosting Business in Africa: Market Specifics and Ways to GrowCloud Hosting Business in Africa: Market Specifics and Ways to Grow
Cloud Hosting Business in Africa: Market Specifics and Ways to GrowJelastic Multi-Cloud PaaS
 
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Jelastic Multi-Cloud PaaS
 
Jelastic DevOps Platform Product Overview for Service Providers
Jelastic DevOps Platform Product Overview for Service ProvidersJelastic DevOps Platform Product Overview for Service Providers
Jelastic DevOps Platform Product Overview for Service ProvidersJelastic Multi-Cloud PaaS
 
Auto Scaling for Multi-Tier Containers Topology
Auto Scaling for Multi-Tier Containers TopologyAuto Scaling for Multi-Tier Containers Topology
Auto Scaling for Multi-Tier Containers TopologyJelastic Multi-Cloud PaaS
 
Jelastic DevOps Platform Product Overview for ISVs
Jelastic DevOps Platform Product Overview for ISVsJelastic DevOps Platform Product Overview for ISVs
Jelastic DevOps Platform Product Overview for ISVsJelastic Multi-Cloud PaaS
 
Онлайн миграция контейнеров. Взгляд изнутри
Онлайн миграция контейнеров. Взгляд изнутриОнлайн миграция контейнеров. Взгляд изнутри
Онлайн миграция контейнеров. Взгляд изнутриJelastic Multi-Cloud PaaS
 

More from Jelastic Multi-Cloud PaaS (20)

Running Projects in Application Containers, System Containers & VMs - Jelasti...
Running Projects in Application Containers, System Containers & VMs - Jelasti...Running Projects in Application Containers, System Containers & VMs - Jelasti...
Running Projects in Application Containers, System Containers & VMs - Jelasti...
 
Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...
 
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSMariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
 
Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS
Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaSScaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS
Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS
 
Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...
Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...
Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...
 
WordPress Cluster for Enterprise High-Availability and On-Demand Scaling
WordPress Cluster for Enterprise High-Availability and On-Demand ScalingWordPress Cluster for Enterprise High-Availability and On-Demand Scaling
WordPress Cluster for Enterprise High-Availability and On-Demand Scaling
 
SaaSification in Action. Attracting Software Vendors with Easy Transformation
SaaSification in Action. Attracting Software Vendors with Easy TransformationSaaSification in Action. Attracting Software Vendors with Easy Transformation
SaaSification in Action. Attracting Software Vendors with Easy Transformation
 
State of the Art UI - Overview of Jelastic PaaS Functionality
State of the Art UI - Overview of Jelastic PaaS FunctionalityState of the Art UI - Overview of Jelastic PaaS Functionality
State of the Art UI - Overview of Jelastic PaaS Functionality
 
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersHow to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
 
Multi-Cloud Lightweight Platform as a Service
Multi-Cloud Lightweight Platform as a ServiceMulti-Cloud Lightweight Platform as a Service
Multi-Cloud Lightweight Platform as a Service
 
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE ApplicationFrom VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
 
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsAutomating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE Applications
 
Cloud Hosting Business in Africa: Market Specifics and Ways to Grow
Cloud Hosting Business in Africa: Market Specifics and Ways to GrowCloud Hosting Business in Africa: Market Specifics and Ways to Grow
Cloud Hosting Business in Africa: Market Specifics and Ways to Grow
 
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
 
Jelastic DevOps Platform Product Overview for Service Providers
Jelastic DevOps Platform Product Overview for Service ProvidersJelastic DevOps Platform Product Overview for Service Providers
Jelastic DevOps Platform Product Overview for Service Providers
 
Auto Scaling for Multi-Tier Containers Topology
Auto Scaling for Multi-Tier Containers TopologyAuto Scaling for Multi-Tier Containers Topology
Auto Scaling for Multi-Tier Containers Topology
 
Jelastic DevOps Platform Product Overview for ISVs
Jelastic DevOps Platform Product Overview for ISVsJelastic DevOps Platform Product Overview for ISVs
Jelastic DevOps Platform Product Overview for ISVs
 
DevOps Epoch 2016
DevOps Epoch 2016DevOps Epoch 2016
DevOps Epoch 2016
 
Онлайн миграция контейнеров. Взгляд изнутри
Онлайн миграция контейнеров. Взгляд изнутриОнлайн миграция контейнеров. Взгляд изнутри
Онлайн миграция контейнеров. Взгляд изнутри
 

Recently uploaded

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Efficient Java Memory Guide Choosing Right Garbage Collector

  • 1. Choosing Right Garbage Collector for Efficient Java Memory Usage Ruslan Synytsky
  • 2. Agenda ● Java Memory Usage Problems ● JDK Improvements for Elastic Java Memory Scaling ● Garbage Collection Testing Results
  • 4. OOM Error and OOM Killer ● OutOfMemoryError exception is usually thrown when there is insufficient space to allocate an object in the Java heap or insufficient native memory to support the loading of a Java class ● oom_kill is a job that helps to sacrifice one or more processes in order to free up memory for the system
  • 6. Java Memory Consumption Problems The most widely acknowledged issue with Java EE is large memory requirements (40%), then slow startup times (40%), followed by missing technologies and specifications (20%) Jakarta EE Developer Survey 2018
  • 7. Pay-Per-Use Billing Model Using automatic vertical scaling, cloud providers can offer economically advantageous pricing based on the real resource consumption Forbes - Deceptive Cloud Efficiency: Do You Really Pay As You Use?
  • 8. Too Many Points to Consider
  • 9. Understanding of the OutOfMemoryError Exception ● java.lang.OutOfMemoryError: Java heap space ● java.lang.OutOfMemoryError: GC Overhead limit exceeded ● java.lang.OutOfMemoryError: Requested array size exceeds VM limit ● java.lang.OutOfMemoryError: Metaspace ● java.lang.OutOfMemoryError: request size bytes for reason. Out of swap space? ● java.lang.OutOfMemoryError: Compressed class space ● java.lang.OutOfMemoryError: reason stack_trace_with_native_method https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks002.html
  • 10. Understanding of the OutOfMemoryError Exception
  • 14. Runtime Environments ● Application Containers ● System Containers ● Virtual Machines
  • 16. Calling Full GC Periodically (Before OpenJDK12) https://github.com/jelastic-jps/java-memory-agent Compacting GC cycles are not triggered automatically and must be executed explicitly Workaround: inject an agent which monitors the memory usage and calls System.gc() periodically: -javaagent:jelastic-gc-agent.jar=period=300,debug=true
  • 17. G1 and Full GC java -XX:+UseG1GC -Xmx2g -Xms32m -jar app.jar 0 Memory grew from 32 MB to 1 GB in 25 seconds https://github.com/jelastic/java-vertical-scaling-test
  • 18. Timely Reduce Unused Committed Memory (JEP 346) Make the G1 garbage collector automatically give back Java heap memory to the operating system when idle ● G1PeriodicGCInterval ● G1PeriodicGCSystemLoadThreshold ● G1PeriodicGCInvokesConcurrent JEP 346: Promptly Return Unused Committed Memory from G1 java -Xms32M -Xmx2g -XX:+UseG1GC -XX:G1PeriodicGCSystemLoadThreshold=0.6 -XX:G1PeriodicGCInterval=900k -jar app.jar
  • 20. Community Recognition Special Appreciation to Rodrigo Bruno Senior/Postdoc Researcher at the Systems Group in ETH Zurich. PhD in Técnico (University of Lisbon)
  • 24. G1 Collector (-XX:+UseG1GC) The Garbage-First (G1) is a server-style Garbage Collector for multiprocessor machines with a large amount of memory. The heap is partitioned into fixed-sized regions and G1 tracks the live data in those regions. When Garbage Collection is required, it collects from the regions with less live data first. ● 2004, Sun Microsystems JEP 346: Promptly Return Unused Committed Memory from G1
  • 25. G1 -Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UseG1GC -XX:G1PeriodicGCInterval=1k
  • 26. G1 and G1PeriodicGCSystemLoadThreshold https://github.com/lxc/lxcfs/ Using LXCFS to Improve Container Resource Visibility Threshold for the current system load as returned by the hosts getloadavg() call to determine whether a periodic garbage collection should be triggered: ● a current system load higher than the tigger value prevents periodic garbage collections ● zero value indicates that this threshold check is disabled If running in Docker container then use
  • 27. Shenandoah GC (-XX:+UseShenandoahGC) Shenandoah GC is a concurrent garbage collector for the JVM. GC tries to perform most of the activities in parallel without interrupting application performance. Such parallelism makes “stop-the-world” (STW) pauses extremely short. Another inherent advantage is an efficient work with small and large heaps with no impact on STW pauses’ length. ● 2014, Christine H. Flood, Red Hat https://wiki.openjdk.java.net/display/shenandoah/Main#Main-Heuristics
  • 28. -Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact Shenandoah
  • 29. G1 vs Shenandoah - CPU Usage G1 Shenandoah
  • 30. ZGC (-XX:+UseZGC) ZGC is low latency scalable garbage collector. Designed for use with applications that require a large heap and low latency. It uses a bunch of one generation and performs most (but not all) garbage collection in parallel with uninterrupted application work. This greatly limits the impact of garbage collection on your application response time. ● 2018, Per Liden, Oracle JEP 351: ZGC: Uncommit Unused Memory - available from JDK 13 Release
  • 31. -Xmx3g -Xms32m -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:ZUncommitDelay=1 -XX:ZCollectionInterval=30 ZGC @ Oracle OpenJDK
  • 32. OpenJ9 OpenJ9 uses the Generational Concurrent (-Xgcpolicy:gencon) policy by default, which is best suited to transactional applications that have many short lived objects. Alternative policies are available, including those that cater for applications with large Java heaps (-Xgcpolicy:balanced), applications that are sensitive to response-time (-Xgcpolicy:metronome), or applications that require high application throughput (-Xgcpolicy:optthruput). ● 2017, Eclipse Foundation
  • 33. -Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+IdleTuningCompactOnIdle -XX:+IdleTuningGcOnIdle -XX:IdleTuningMinIdleWaitTime=1 -Xjit:waitTimeToEnterDeepIdleMode=1000 Bash command to check the real usage while true do pid=$(pgrep -f java | tail -n1) used=$(ps -orss --no-headers --pid $pid) echo "scale=2 ; $used / 1024/1024" | bc sleep 1 done Inconsistent behaviour with -XX:+IdleTuningGcOnIdle, mem not released back to OS on Idle OpenJ9
  • 34. C4 GC ● 2010, Gil Tene, Azul Systems The C4 (Continuously Concurrent Compacting Collector) is an updated generational form of the Azul Pauseless GC Algorithm and is the default collector of Zing®. C4 differentiates itself from other generational garbage collectors by supporting simultaneous – generational concurrency: the different generations are collected using concurrent (non-stop-the-world) mechanisms that can be simultaneously and independently active. Unlike other algorithms, it is not ‘mostly’ concurrent, but fully concurrent, so it never falls back to a stop-the-world compaction.
  • 37. ConcMarkSweep GC (-XX:+UseConcMarkSweepGC) ConcMarkSweep GC collector is designed for applications that prefer shorter garbage collection pauses and which can afford to share processor resources with the garbage collector while the application is running. It makes sense to use such a collector when applications requirements for time garbage collection pauses are low. ● 2004, Sun Microsystems
  • 38. -Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC + periodical jcmd <pid> GC.run ConcMarkSweep
  • 39. Serial GC (-XX:+UseSerialGC) Serial GC performs garbage collection in a single thread and has the lowest consumption of memory among all GC types but, at the same time, it makes long pauses that can lead to application performance degradation. ● 2004, Sun Microsystems
  • 40. -Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UseSerialGC + periodical jcmd <pid> GC.run Serial
  • 41. Epsilon GC (-XX:+UseEpsilonGC) Epsilon GC is a passive GC that handles memory allocation and doesn’t clear it when objects are no longer used. When your application exhausts the Java heap, the JVM goes down. So, EpsilonGC prolongs an application life until the memory will run out and dumps the memory, that can be useful for application memory usage debugging, as well as measuring and managing application performance. ● 2014, Aleksey Shipilev, Red Hat
  • 42. -Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC Epsilon
  • 43. Parallel GC (-XX:+UseParallelGC) Parallel GC is a “stop-the-world” multithreaded Garbage Collector similar to the serial collector. The primary difference is that multiple threads are used to speed up garbage collection. By default, both minor and major collections are executed in parallel to further reduce garbage collection costs. ● 2000, Sun Microsystems
  • 44. -Xmx3g -Xms32m -XX:+UseCompressedOops -XX:+UseParallelGC + periodical jcmd <pid> GC.run Parallel
  • 45. Running GC Tests in Kubernetes
  • 46. Auto Testing Package for Kubernetes https://github.com/jelastic/java-vertical-scaling-test/blob/master/manifest-k8s.yaml
  • 47. Load Testing Logic java [OPTIONS] -jar app.jar <sleep> <mode> where sleep - 100 mode - 2 https://github.com/jelastic/java-vertical-scaling-test/blob/master/ src/com/jelastic/verticalscaling/Load.java#L64
  • 50. ZGC @ Oracle OpenJDK in Kubernetes
  • 52. C4 @ Zing in Kubernetes
  • 53. Joint Comparison - Several Load Cycles RAM CPU
  • 56. -XX:SoftMaxHeapSize @ ZGC SoftMaxHeapSize is set for the GC to strive not to grow heap size beyond the specified size unless it is highly needed: ● to keep the heap footprint down, while maintaining the capability to deal with a temporary increase in heap space requirement ● with lots of margin, to increase confidence that you will not run into an allocation stall because of an unforeseen increase in allocation rate
  • 57. JEP draft: Dynamic Max Memory Limit Xmx can be set higher than the container max memory limit (Cmx). And both Smx and Cmx can be adjusted on the fly without the need to restart JVM or container. At the moment the heap size can go beyond SoftMaxHeapSize (Smx) and there is no guarantee on how much the heap will grow other than up to Xmx. The problem arises when Smx < Cmx < Used Heap < Xmx: the JVM will be killed by the OS OOM Killer as it exceeds the amount of memory given to the container. We suggest to provide an option for making SoftMaxHeapSize as the hard limit, so when overshoot happens JVM will throw OOM Error which is not as bad OOM Kill. Dynamic Max Memory Limit @ G1
  • 58. -Xsoftmx @ OpenJ9 https://www.ibm.com/support/knowledgecenter/en/SSYKE2_8.0.0/openj9/xsoftmx/index.html Runtime adjustable heap size (-Xsoftmx) allows to adjust heap size dynamically and take advantage of hot-add of memory. You can set this option on the command line, then modify it at run time by using the com.ibm.lang.management.MemoryMXBean.setMaxHeapSize(). This option can be useful in virtualized or cloud environments, for example, where the available memory might change dynamically to meet business needs. By default, -Xsoftmx is set to the same value as -Xmx.
  • 59. C4 is fully elastic and can return all empty pages to the OS after each GC cycle. However, C4 sticks to the Xmx it was given, and avoid doing heavy elastic memory dance, since relinquishing memory mappings and reestablishing them on Linux kernels is bandwidth-limited in practice by the rate of page mapping invalidation the kernel can handle. C4 goes above Xmx rather than go between Xms and Xmx. JavaMemMax option controls the true maximum. In the future it will allow both scenarios where above-Xmx is allowed and where above-Xmx is prohibited. Two modes: ● Contingency (default mode) - goes above Xmx if it absolutely has to and will work hard to collect and stay below Xmx. ● Insurance (best effort elasticity) - borrows available memory and goes above Xmx in order to delay GC whenever possible. JavaMemMax @ С4 + ZST (Zing System Tools)
  • 60. Keep Only Best Java Memories Learn More Get In Touch @siruslan rs@jelastic.com