SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
Copyright 2018 Kirk Pepperdine
MEMORY
THE TROUBLE WITH
Copyright 2018 Kirk Pepperdine
jClarity
▸ Kirk Pepperdine
▸ Author of jPDM, a performance diagnostic model
▸ Author of the original Java Performance Tuning workshop
▸ Co-founded jClarity
▸ Building the smart generation of performance diagnostic tooling
▸ Bring predictability into the diagnostic process
▸ Co-founded JCrete
▸ The hottest unconference on the planet
▸ Java Champion(s)
OUR MARKETING SLIDE
Copyright 2018 Kirk Pepperdine
jClarity
What is your performance trouble spot
Copyright 2018 Kirk Pepperdine
jClarity
> 70% of all applications are bottlenecked
on memory
Copyright 2018 Kirk Pepperdine
jClarity
and no,

Garbage Collection

is not a fault!!!!
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
Spring Boot
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
Cassandra
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
Cassandra
or any big nosql solution
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
Apache Spark
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
Apache Spark
or any big data framework
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
Log4J
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
Log4J
or any Java logging framework
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
JSON
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
JSON
With almost any Marshalling protocol
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
ECom caching products
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
ECom caching products
Hibernate
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
ECom caching products
Hibernate
and so on
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
ECom caching products
Hibernate
and so on
and so on
Copyright 2018 Kirk Pepperdine
DO YOU USE
jClarity
ECom caching products
Hibernate
and so on
and so on
and so on
Copyright 2018 Kirk Pepperdine
jClarity
then you are very likely in this 70%
Copyright 2018 Kirk Pepperdine
Copyright 2018 Kirk Pepperdine
PROBLEMS
▸ High memory churn rates
▸many temporary objects
▸ Large live data set size
▸inflated live data set size
▸ loitering
▸ Unstable live data set size
▸memory leak
jClarity
Copyright 2018 Kirk Pepperdine
WAR STORIES
▸ Reduced allocation rates from 1.8gb/sec to 0
▸tps jumped from 400,000 to 25,000,000!!!
▸ Stripped all logging our of a transactional engine
▸Throughput jumped by a factor of 4x
▸ Wrapped 2 logging statements in a web socket framework
▸Memory churn reduced by a factor of 2
jClarity
Copyright 2018 Kirk Pepperdine
ALLOCATION SITE
jClarity
Foo foo = new Foo();
forms an allocation site
0: new #2 // class java/lang/Object
2: dup
4: invokespecial #1 // Method java/lang/Object."<init>":()V
▸Allocation will (mostly) occur in Java heap
▸ fast path
▸ slow path
▸ small objects maybe optimized to an on-stack allocation
Copyright 2018 Kirk Pepperdine
JAVA HEAP
jClarity
Eden Survivor (to) Tenured
Java Heap
▸ Java Heap is made of;
▸ Eden - nursery
▸ Survivor - intermediate pool designed to delay promotion
▸ Tenured - to hold long lived data
▸ Each space contributes to a different set of problems
▸ All affect GC overhead
Copyright 2018 Kirk Pepperdine
EDEN ALLOCATIONS
jClarity
top of heap pointer
Copyright 2018 Kirk Pepperdine
OBJECT ALLOCATION
jClarity
top of heap pointer
Foo foo = new Foo();

Bar bar = new Bar();

byte[] array = new byte[N];
Copyright 2018 Kirk Pepperdine
OBJECT ALLOCATION
jClarity
top of heap pointer
Foo foo = new Foo();

Bar bar = new Bar();

byte[] array = new byte[N];

Foo
Copyright 2018 Kirk Pepperdine
OBJECT ALLOCATION
jClarity
top of heap pointer
Foo foo = new Foo();

Bar bar = new Bar();

byte[] array = new byte[N];

Foo Bar
Copyright 2018 Kirk Pepperdine
OBJECT ALLOCATION
jClarity
top of heap pointer
Foo foo = new Foo();

Bar bar = new Bar();

byte[] array = new byte[N];

Foo Bar byte[]
Copyright 2018 Kirk Pepperdine
OBJECT ALLOCATION
jClarity
top of heap pointer
Foo Bar byte[]
▸ In multi-threaded apps, top of heap pointer must be surrounded by barriers
▸single threads allocation
▸hot memory address
▸ solved by stripping (Thread local allocation blocks)
Copyright 2018 Kirk Pepperdine
TLAB ALLOCATION
jClarity
top of heap pointer
▸ Assume 2 threads
▸each thread will have it’s own (set of) TLAB(s)
TLAB TLAB
TLAB pointerTLAB pointer
Copyright 2018 Kirk Pepperdine
TLAB ALLOCATIONS
jClarity
▸ Thread 1 -> Foo foo = new Foo(); byte[] array = new byte[N];
▸byte[] doesn’t fit in a TLAB
▸ Thread 2 -> Bar bar = new Bar();
byte[]TLAB TLAB
Foo Bar
TLAB pointerTLAB pointer
top of heap pointer
Copyright 2018 Kirk Pepperdine
TLAB WASTE %
jClarity
▸ Allocation failure to prevent buffer overflow
▸ waste up to 1% of a TLAB
FooFoo Foo Foo Foo Foo Foo Foo
Copyright 2018 Kirk Pepperdine
TLAB WASTE %
jClarity
▸ Allocation failure to prevent buffer overflow
▸ waste up to 1% of a TLAB
Foo Foo Foo Foo Foo Foo Foo Foo
Foo
Copyright 2018 Kirk Pepperdine
TENURED SPACE
jClarity
▸ Allocations in tenured make use of a free list
▸free list allocation is ~10x the cost of bump and run
▸ Data in tenured tends to be long lived
▸amount of data in tenured do affect GC pause times
Bar Bar Foo Foo
Free List
Copyright 2018 Kirk Pepperdine
PROBLEMS
▸ High memory churn rates
▸many temporary objects
jClarity
Copyright 2018 Kirk Pepperdine
PROBLEMS
▸ High memory churn rates
▸many temporary objects
jClarity
▸Quickly fill Eden
▸ frequent young gc cycles
▸ speeds up aging
▸ premature promotion
▸more frequent tenured cycles
▸increased copy costs
▸increased heap fragmentation
▸Allocation is quick
▸ quick * large number = slow
Copyright 2018 Kirk Pepperdine
REDUCING ALLOCATIONS
jClarity
> 1gb/sec
< 300mb/sec
sizeofgain
Copyright 2018 Kirk Pepperdine
PROBLEMS
▸ High memory churn rates
▸many temporary objects
▸Large live data set size
▸ inflated live data set size
▸loitering
jClarity
Copyright 2018 Kirk Pepperdine
PROBLEMS
▸ High memory churn rates
▸many temporary objects
▸Large live data set size
▸ inflated live data set size
▸loitering
jClarity
▸inflated scan for root times
▸reduced page locality
▸Inflated compaction times
▸ increase copy costs
▸ likely less space to copy too
Copyright 2018 Kirk Pepperdine
PAUSE VS OCCUPANCY
jClarity
Copyright 2018 Kirk Pepperdine
PROBLEMS
▸ High memory churn rates
▸many temporary objects
▸Large live data set size
▸ inflated live data set size
▸loitering
▸Unstable live data set size
▸ memory leak
jClarity
Copyright 2018 Kirk Pepperdine
PROBLEMS
▸ High memory churn rates
▸many temporary objects
▸Large live data set size
▸ inflated live data set size
▸loitering
▸Unstable live data set size
▸ memory leak
jClarity
▸Eventually you run out of heap
space
▸ each app thread throws an
OutOfMemoryError and
terminates
▸JVM will shutdown with all non-
daemon threads terminate
Copyright 2018 Kirk Pepperdine
jClarity
Escape Analysis
Copyright 2018 Kirk Pepperdine
Demo time
jClarity
Copyright 2018 Kirk Pepperdine
TEXT
TITLE TEXT
▸ Body Level One
▸ Body Level Two
▸ Body Level Three
▸ Body Level Four
▸ Body Level Five
Ask out my Java Performance Tuning Workshop
Send us a Java 11 GC log or
tweet about @jclarity
and #censum
and
receive a free Censum License

Weitere ähnliche Inhalte

Was ist angesagt?

OPTIMIZING THE TICK STACK
OPTIMIZING THE TICK STACKOPTIMIZING THE TICK STACK
OPTIMIZING THE TICK STACKInfluxData
 
"Enabling Googley microservices with gRPC" at JEEConf 2017
"Enabling Googley microservices with gRPC" at JEEConf 2017"Enabling Googley microservices with gRPC" at JEEConf 2017
"Enabling Googley microservices with gRPC" at JEEConf 2017Alex Borysov
 
Java Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
Java Garbage Collectors – Moving to Java7 Garbage First (G1) CollectorJava Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
Java Garbage Collectors – Moving to Java7 Garbage First (G1) CollectorGurpreet Sachdeva
 
Shooting the Rapids: Getting the Best from Java 8 Streams
Shooting the Rapids: Getting the Best from Java 8 StreamsShooting the Rapids: Getting the Best from Java 8 Streams
Shooting the Rapids: Getting the Best from Java 8 StreamsMaurice Naftalin
 
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...Maurice Naftalin
 
Hadoop world g1_gc_forh_base_v4
Hadoop world g1_gc_forh_base_v4Hadoop world g1_gc_forh_base_v4
Hadoop world g1_gc_forh_base_v4YanpingWang
 
Diefficiency Metrics: Measuring the Continuous Efficiency of Query Processing...
Diefficiency Metrics: Measuring the Continuous Efficiency of Query Processing...Diefficiency Metrics: Measuring the Continuous Efficiency of Query Processing...
Diefficiency Metrics: Measuring the Continuous Efficiency of Query Processing...Maribel Acosta Deibe
 
"Enabling Googley microservices with gRPC." at Devoxx France 2017
"Enabling Googley microservices with gRPC." at Devoxx France 2017"Enabling Googley microservices with gRPC." at Devoxx France 2017
"Enabling Googley microservices with gRPC." at Devoxx France 2017Alex Borysov
 
An Efficient Biological Sequence Compression Technique Using LUT and Repeat ...
An Efficient Biological Sequence Compression Technique Using  LUT and Repeat ...An Efficient Biological Sequence Compression Technique Using  LUT and Repeat ...
An Efficient Biological Sequence Compression Technique Using LUT and Repeat ...IOSR Journals
 
"Enabling Googley microservices with gRPC" at JDK.IO 2017
"Enabling Googley microservices with gRPC" at JDK.IO 2017"Enabling Googley microservices with gRPC" at JDK.IO 2017
"Enabling Googley microservices with gRPC" at JDK.IO 2017Alex Borysov
 
Parallel-Ready Java Code: Managing Mutation in an Imperative Language
Parallel-Ready Java Code: Managing Mutation in an Imperative LanguageParallel-Ready Java Code: Managing Mutation in an Imperative Language
Parallel-Ready Java Code: Managing Mutation in an Imperative LanguageMaurice Naftalin
 
Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021
Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021
Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021InfluxData
 
Hawq meets Hive - DataWorks San Jose 2017
Hawq meets Hive - DataWorks San Jose 2017Hawq meets Hive - DataWorks San Jose 2017
Hawq meets Hive - DataWorks San Jose 2017Alex Diachenko
 
Ireland OUG Meetup May 2017
Ireland OUG Meetup May 2017Ireland OUG Meetup May 2017
Ireland OUG Meetup May 2017Brendan Tierney
 
Spark + AI Summit recap jul16 2020
Spark + AI Summit recap jul16 2020Spark + AI Summit recap jul16 2020
Spark + AI Summit recap jul16 2020Guido Oswald
 
Yarn by default (Spark on YARN)
Yarn by default (Spark on YARN)Yarn by default (Spark on YARN)
Yarn by default (Spark on YARN)Ferran Galí Reniu
 
Low pause GC in HotSpot
Low pause GC in HotSpotLow pause GC in HotSpot
Low pause GC in HotSpotjClarity
 

Was ist angesagt? (20)

OPTIMIZING THE TICK STACK
OPTIMIZING THE TICK STACKOPTIMIZING THE TICK STACK
OPTIMIZING THE TICK STACK
 
"Enabling Googley microservices with gRPC" at JEEConf 2017
"Enabling Googley microservices with gRPC" at JEEConf 2017"Enabling Googley microservices with gRPC" at JEEConf 2017
"Enabling Googley microservices with gRPC" at JEEConf 2017
 
Java Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
Java Garbage Collectors – Moving to Java7 Garbage First (G1) CollectorJava Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
Java Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
 
Shooting the Rapids: Getting the Best from Java 8 Streams
Shooting the Rapids: Getting the Best from Java 8 StreamsShooting the Rapids: Getting the Best from Java 8 Streams
Shooting the Rapids: Getting the Best from Java 8 Streams
 
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...
 
Let's Get to the Rapids
Let's Get to the RapidsLet's Get to the Rapids
Let's Get to the Rapids
 
Shooting the Rapids
Shooting the RapidsShooting the Rapids
Shooting the Rapids
 
Hadoop world g1_gc_forh_base_v4
Hadoop world g1_gc_forh_base_v4Hadoop world g1_gc_forh_base_v4
Hadoop world g1_gc_forh_base_v4
 
-XX:+UseG1GC
-XX:+UseG1GC-XX:+UseG1GC
-XX:+UseG1GC
 
Diefficiency Metrics: Measuring the Continuous Efficiency of Query Processing...
Diefficiency Metrics: Measuring the Continuous Efficiency of Query Processing...Diefficiency Metrics: Measuring the Continuous Efficiency of Query Processing...
Diefficiency Metrics: Measuring the Continuous Efficiency of Query Processing...
 
"Enabling Googley microservices with gRPC." at Devoxx France 2017
"Enabling Googley microservices with gRPC." at Devoxx France 2017"Enabling Googley microservices with gRPC." at Devoxx France 2017
"Enabling Googley microservices with gRPC." at Devoxx France 2017
 
An Efficient Biological Sequence Compression Technique Using LUT and Repeat ...
An Efficient Biological Sequence Compression Technique Using  LUT and Repeat ...An Efficient Biological Sequence Compression Technique Using  LUT and Repeat ...
An Efficient Biological Sequence Compression Technique Using LUT and Repeat ...
 
"Enabling Googley microservices with gRPC" at JDK.IO 2017
"Enabling Googley microservices with gRPC" at JDK.IO 2017"Enabling Googley microservices with gRPC" at JDK.IO 2017
"Enabling Googley microservices with gRPC" at JDK.IO 2017
 
Parallel-Ready Java Code: Managing Mutation in an Imperative Language
Parallel-Ready Java Code: Managing Mutation in an Imperative LanguageParallel-Ready Java Code: Managing Mutation in an Imperative Language
Parallel-Ready Java Code: Managing Mutation in an Imperative Language
 
Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021
Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021
Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021
 
Hawq meets Hive - DataWorks San Jose 2017
Hawq meets Hive - DataWorks San Jose 2017Hawq meets Hive - DataWorks San Jose 2017
Hawq meets Hive - DataWorks San Jose 2017
 
Ireland OUG Meetup May 2017
Ireland OUG Meetup May 2017Ireland OUG Meetup May 2017
Ireland OUG Meetup May 2017
 
Spark + AI Summit recap jul16 2020
Spark + AI Summit recap jul16 2020Spark + AI Summit recap jul16 2020
Spark + AI Summit recap jul16 2020
 
Yarn by default (Spark on YARN)
Yarn by default (Spark on YARN)Yarn by default (Spark on YARN)
Yarn by default (Spark on YARN)
 
Low pause GC in HotSpot
Low pause GC in HotSpotLow pause GC in HotSpot
Low pause GC in HotSpot
 

Ähnlich wie Trouble with memory

Operating and Supporting Delta Lake in Production
Operating and Supporting Delta Lake in ProductionOperating and Supporting Delta Lake in Production
Operating and Supporting Delta Lake in ProductionDatabricks
 
Flink Forward Berlin 2018: Stefan Richter - "Tuning Flink for Robustness and ...
Flink Forward Berlin 2018: Stefan Richter - "Tuning Flink for Robustness and ...Flink Forward Berlin 2018: Stefan Richter - "Tuning Flink for Robustness and ...
Flink Forward Berlin 2018: Stefan Richter - "Tuning Flink for Robustness and ...Flink Forward
 
Tuning Flink For Robustness And Performance
Tuning Flink For Robustness And PerformanceTuning Flink For Robustness And Performance
Tuning Flink For Robustness And PerformanceStefan Richter
 
Using Spark over Cassandra
Using Spark over CassandraUsing Spark over Cassandra
Using Spark over CassandraNoam Barkai
 
Data Streaming Ecosystem Management at Booking.com
Data Streaming Ecosystem Management at Booking.com Data Streaming Ecosystem Management at Booking.com
Data Streaming Ecosystem Management at Booking.com confluent
 
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...confluent
 
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernández
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernándezSpark Streaming Tips for Devs and Ops by Fran perez y federico fernández
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernándezJ On The Beach
 
stackconf 2020 | Speeding up Linux disk encryption by Ignat Korchagin
stackconf 2020 | Speeding up Linux disk encryption by Ignat Korchaginstackconf 2020 | Speeding up Linux disk encryption by Ignat Korchagin
stackconf 2020 | Speeding up Linux disk encryption by Ignat KorchaginNETWAYS
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)DataWorks Summit
 
Tarpm Clustering
Tarpm ClusteringTarpm Clustering
Tarpm Clusteringday
 
Advanced Apache Spark Meetup: How Spark Beat Hadoop @ 100 TB Daytona GraySor...
Advanced Apache Spark Meetup:  How Spark Beat Hadoop @ 100 TB Daytona GraySor...Advanced Apache Spark Meetup:  How Spark Beat Hadoop @ 100 TB Daytona GraySor...
Advanced Apache Spark Meetup: How Spark Beat Hadoop @ 100 TB Daytona GraySor...Chris Fregly
 
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...Alexey Kharlamov
 
London Spark Meetup Project Tungsten Oct 12 2015
London Spark Meetup Project Tungsten Oct 12 2015London Spark Meetup Project Tungsten Oct 12 2015
London Spark Meetup Project Tungsten Oct 12 2015Chris Fregly
 
Docker architecture rework case study
Docker  architecture rework case studyDocker  architecture rework case study
Docker architecture rework case studydchaffiol
 
Cacheconcurrencyconsistency cassandra svcc
Cacheconcurrencyconsistency cassandra svccCacheconcurrencyconsistency cassandra svcc
Cacheconcurrencyconsistency cassandra svccsrisatish ambati
 
Metrics-Driven Performance Tuning for AWS Glue ETL Jobs (ANT332) - AWS re:Inv...
Metrics-Driven Performance Tuning for AWS Glue ETL Jobs (ANT332) - AWS re:Inv...Metrics-Driven Performance Tuning for AWS Glue ETL Jobs (ANT332) - AWS re:Inv...
Metrics-Driven Performance Tuning for AWS Glue ETL Jobs (ANT332) - AWS re:Inv...Amazon Web Services
 
Z Garbage Collector
Z Garbage CollectorZ Garbage Collector
Z Garbage CollectorDavid Buck
 
BOS K8S Meetup - Finetuning LLama 2 Model on GKE.pdf
BOS K8S Meetup - Finetuning LLama 2 Model on GKE.pdfBOS K8S Meetup - Finetuning LLama 2 Model on GKE.pdf
BOS K8S Meetup - Finetuning LLama 2 Model on GKE.pdfMichaelOLeary82
 

Ähnlich wie Trouble with memory (20)

Introducing illuminate
Introducing illuminateIntroducing illuminate
Introducing illuminate
 
Operating and Supporting Delta Lake in Production
Operating and Supporting Delta Lake in ProductionOperating and Supporting Delta Lake in Production
Operating and Supporting Delta Lake in Production
 
Flink Forward Berlin 2018: Stefan Richter - "Tuning Flink for Robustness and ...
Flink Forward Berlin 2018: Stefan Richter - "Tuning Flink for Robustness and ...Flink Forward Berlin 2018: Stefan Richter - "Tuning Flink for Robustness and ...
Flink Forward Berlin 2018: Stefan Richter - "Tuning Flink for Robustness and ...
 
Tuning Flink For Robustness And Performance
Tuning Flink For Robustness And PerformanceTuning Flink For Robustness And Performance
Tuning Flink For Robustness And Performance
 
Using Spark over Cassandra
Using Spark over CassandraUsing Spark over Cassandra
Using Spark over Cassandra
 
Data Streaming Ecosystem Management at Booking.com
Data Streaming Ecosystem Management at Booking.com Data Streaming Ecosystem Management at Booking.com
Data Streaming Ecosystem Management at Booking.com
 
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...
 
Spark Streaming Tips for Devs and Ops
Spark Streaming Tips for Devs and OpsSpark Streaming Tips for Devs and Ops
Spark Streaming Tips for Devs and Ops
 
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernández
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernándezSpark Streaming Tips for Devs and Ops by Fran perez y federico fernández
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernández
 
stackconf 2020 | Speeding up Linux disk encryption by Ignat Korchagin
stackconf 2020 | Speeding up Linux disk encryption by Ignat Korchaginstackconf 2020 | Speeding up Linux disk encryption by Ignat Korchagin
stackconf 2020 | Speeding up Linux disk encryption by Ignat Korchagin
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)
 
Tarpm Clustering
Tarpm ClusteringTarpm Clustering
Tarpm Clustering
 
Advanced Apache Spark Meetup: How Spark Beat Hadoop @ 100 TB Daytona GraySor...
Advanced Apache Spark Meetup:  How Spark Beat Hadoop @ 100 TB Daytona GraySor...Advanced Apache Spark Meetup:  How Spark Beat Hadoop @ 100 TB Daytona GraySor...
Advanced Apache Spark Meetup: How Spark Beat Hadoop @ 100 TB Daytona GraySor...
 
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
 
London Spark Meetup Project Tungsten Oct 12 2015
London Spark Meetup Project Tungsten Oct 12 2015London Spark Meetup Project Tungsten Oct 12 2015
London Spark Meetup Project Tungsten Oct 12 2015
 
Docker architecture rework case study
Docker  architecture rework case studyDocker  architecture rework case study
Docker architecture rework case study
 
Cacheconcurrencyconsistency cassandra svcc
Cacheconcurrencyconsistency cassandra svccCacheconcurrencyconsistency cassandra svcc
Cacheconcurrencyconsistency cassandra svcc
 
Metrics-Driven Performance Tuning for AWS Glue ETL Jobs (ANT332) - AWS re:Inv...
Metrics-Driven Performance Tuning for AWS Glue ETL Jobs (ANT332) - AWS re:Inv...Metrics-Driven Performance Tuning for AWS Glue ETL Jobs (ANT332) - AWS re:Inv...
Metrics-Driven Performance Tuning for AWS Glue ETL Jobs (ANT332) - AWS re:Inv...
 
Z Garbage Collector
Z Garbage CollectorZ Garbage Collector
Z Garbage Collector
 
BOS K8S Meetup - Finetuning LLama 2 Model on GKE.pdf
BOS K8S Meetup - Finetuning LLama 2 Model on GKE.pdfBOS K8S Meetup - Finetuning LLama 2 Model on GKE.pdf
BOS K8S Meetup - Finetuning LLama 2 Model on GKE.pdf
 

Kürzlich hochgeladen

What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 

Kürzlich hochgeladen (20)

What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 

Trouble with memory

  • 1. Copyright 2018 Kirk Pepperdine MEMORY THE TROUBLE WITH
  • 2. Copyright 2018 Kirk Pepperdine jClarity ▸ Kirk Pepperdine ▸ Author of jPDM, a performance diagnostic model ▸ Author of the original Java Performance Tuning workshop ▸ Co-founded jClarity ▸ Building the smart generation of performance diagnostic tooling ▸ Bring predictability into the diagnostic process ▸ Co-founded JCrete ▸ The hottest unconference on the planet ▸ Java Champion(s) OUR MARKETING SLIDE
  • 3. Copyright 2018 Kirk Pepperdine jClarity What is your performance trouble spot
  • 4. Copyright 2018 Kirk Pepperdine jClarity > 70% of all applications are bottlenecked on memory
  • 5. Copyright 2018 Kirk Pepperdine jClarity and no, Garbage Collection is not a fault!!!!
  • 6. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity
  • 7. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity Spring Boot
  • 8. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity Cassandra
  • 9. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity Cassandra or any big nosql solution
  • 10. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity Apache Spark
  • 11. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity Apache Spark or any big data framework
  • 12. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity Log4J
  • 13. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity Log4J or any Java logging framework
  • 14. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity JSON
  • 15. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity JSON With almost any Marshalling protocol
  • 16. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity ECom caching products
  • 17. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity ECom caching products Hibernate
  • 18. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity ECom caching products Hibernate and so on
  • 19. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity ECom caching products Hibernate and so on and so on
  • 20. Copyright 2018 Kirk Pepperdine DO YOU USE jClarity ECom caching products Hibernate and so on and so on and so on
  • 21. Copyright 2018 Kirk Pepperdine jClarity then you are very likely in this 70%
  • 22. Copyright 2018 Kirk Pepperdine
  • 23. Copyright 2018 Kirk Pepperdine PROBLEMS ▸ High memory churn rates ▸many temporary objects ▸ Large live data set size ▸inflated live data set size ▸ loitering ▸ Unstable live data set size ▸memory leak jClarity
  • 24. Copyright 2018 Kirk Pepperdine WAR STORIES ▸ Reduced allocation rates from 1.8gb/sec to 0 ▸tps jumped from 400,000 to 25,000,000!!! ▸ Stripped all logging our of a transactional engine ▸Throughput jumped by a factor of 4x ▸ Wrapped 2 logging statements in a web socket framework ▸Memory churn reduced by a factor of 2 jClarity
  • 25. Copyright 2018 Kirk Pepperdine ALLOCATION SITE jClarity Foo foo = new Foo(); forms an allocation site 0: new #2 // class java/lang/Object 2: dup 4: invokespecial #1 // Method java/lang/Object."<init>":()V ▸Allocation will (mostly) occur in Java heap ▸ fast path ▸ slow path ▸ small objects maybe optimized to an on-stack allocation
  • 26. Copyright 2018 Kirk Pepperdine JAVA HEAP jClarity Eden Survivor (to) Tenured Java Heap ▸ Java Heap is made of; ▸ Eden - nursery ▸ Survivor - intermediate pool designed to delay promotion ▸ Tenured - to hold long lived data ▸ Each space contributes to a different set of problems ▸ All affect GC overhead
  • 27. Copyright 2018 Kirk Pepperdine EDEN ALLOCATIONS jClarity top of heap pointer
  • 28. Copyright 2018 Kirk Pepperdine OBJECT ALLOCATION jClarity top of heap pointer Foo foo = new Foo(); Bar bar = new Bar(); byte[] array = new byte[N];
  • 29. Copyright 2018 Kirk Pepperdine OBJECT ALLOCATION jClarity top of heap pointer Foo foo = new Foo(); Bar bar = new Bar(); byte[] array = new byte[N]; Foo
  • 30. Copyright 2018 Kirk Pepperdine OBJECT ALLOCATION jClarity top of heap pointer Foo foo = new Foo(); Bar bar = new Bar(); byte[] array = new byte[N]; Foo Bar
  • 31. Copyright 2018 Kirk Pepperdine OBJECT ALLOCATION jClarity top of heap pointer Foo foo = new Foo(); Bar bar = new Bar(); byte[] array = new byte[N]; Foo Bar byte[]
  • 32. Copyright 2018 Kirk Pepperdine OBJECT ALLOCATION jClarity top of heap pointer Foo Bar byte[] ▸ In multi-threaded apps, top of heap pointer must be surrounded by barriers ▸single threads allocation ▸hot memory address ▸ solved by stripping (Thread local allocation blocks)
  • 33. Copyright 2018 Kirk Pepperdine TLAB ALLOCATION jClarity top of heap pointer ▸ Assume 2 threads ▸each thread will have it’s own (set of) TLAB(s) TLAB TLAB TLAB pointerTLAB pointer
  • 34. Copyright 2018 Kirk Pepperdine TLAB ALLOCATIONS jClarity ▸ Thread 1 -> Foo foo = new Foo(); byte[] array = new byte[N]; ▸byte[] doesn’t fit in a TLAB ▸ Thread 2 -> Bar bar = new Bar(); byte[]TLAB TLAB Foo Bar TLAB pointerTLAB pointer top of heap pointer
  • 35. Copyright 2018 Kirk Pepperdine TLAB WASTE % jClarity ▸ Allocation failure to prevent buffer overflow ▸ waste up to 1% of a TLAB FooFoo Foo Foo Foo Foo Foo Foo
  • 36. Copyright 2018 Kirk Pepperdine TLAB WASTE % jClarity ▸ Allocation failure to prevent buffer overflow ▸ waste up to 1% of a TLAB Foo Foo Foo Foo Foo Foo Foo Foo Foo
  • 37. Copyright 2018 Kirk Pepperdine TENURED SPACE jClarity ▸ Allocations in tenured make use of a free list ▸free list allocation is ~10x the cost of bump and run ▸ Data in tenured tends to be long lived ▸amount of data in tenured do affect GC pause times Bar Bar Foo Foo Free List
  • 38. Copyright 2018 Kirk Pepperdine PROBLEMS ▸ High memory churn rates ▸many temporary objects jClarity
  • 39. Copyright 2018 Kirk Pepperdine PROBLEMS ▸ High memory churn rates ▸many temporary objects jClarity ▸Quickly fill Eden ▸ frequent young gc cycles ▸ speeds up aging ▸ premature promotion ▸more frequent tenured cycles ▸increased copy costs ▸increased heap fragmentation ▸Allocation is quick ▸ quick * large number = slow
  • 40. Copyright 2018 Kirk Pepperdine REDUCING ALLOCATIONS jClarity > 1gb/sec < 300mb/sec sizeofgain
  • 41. Copyright 2018 Kirk Pepperdine PROBLEMS ▸ High memory churn rates ▸many temporary objects ▸Large live data set size ▸ inflated live data set size ▸loitering jClarity
  • 42. Copyright 2018 Kirk Pepperdine PROBLEMS ▸ High memory churn rates ▸many temporary objects ▸Large live data set size ▸ inflated live data set size ▸loitering jClarity ▸inflated scan for root times ▸reduced page locality ▸Inflated compaction times ▸ increase copy costs ▸ likely less space to copy too
  • 43. Copyright 2018 Kirk Pepperdine PAUSE VS OCCUPANCY jClarity
  • 44. Copyright 2018 Kirk Pepperdine PROBLEMS ▸ High memory churn rates ▸many temporary objects ▸Large live data set size ▸ inflated live data set size ▸loitering ▸Unstable live data set size ▸ memory leak jClarity
  • 45. Copyright 2018 Kirk Pepperdine PROBLEMS ▸ High memory churn rates ▸many temporary objects ▸Large live data set size ▸ inflated live data set size ▸loitering ▸Unstable live data set size ▸ memory leak jClarity ▸Eventually you run out of heap space ▸ each app thread throws an OutOfMemoryError and terminates ▸JVM will shutdown with all non- daemon threads terminate
  • 46. Copyright 2018 Kirk Pepperdine jClarity Escape Analysis
  • 47. Copyright 2018 Kirk Pepperdine Demo time jClarity
  • 48. Copyright 2018 Kirk Pepperdine TEXT TITLE TEXT ▸ Body Level One ▸ Body Level Two ▸ Body Level Three ▸ Body Level Four ▸ Body Level Five Ask out my Java Performance Tuning Workshop Send us a Java 11 GC log or tweet about @jclarity and #censum and receive a free Censum License