Is Your Memory Correctly
Sized?
I am doubtful
Ram Lakshmanan
Architect GCeasy, FastThread, HeapHero
2
What is the Impact of Wrong Memory Size?
When Memory is Under Allocated
You are going to disappoint Customers with poor response time
When Memory is Over Allocated
You are going to make already rich Cloud Providers AWS, Azure, GCP… richer 
3
Do Garbage Collection Study
How to know whether memory is correctly sized?
4
How to do Garbage Collection Study?
5
Step 1: Enable GC Logging
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<file-path>
Till Java 8
-Xlog:gc*:file=<file-path>
From Java 9
Enable GC logs (always)
Almost zero overhead.
https://blog.gceasy.io/overhead-added-by-garbage-collection-logging/
6
Step 2: Analyze using GC Log Analysis Tools
https://developer.ibm.com/ja
vasdk/tools/
IBM GC & Memory visualizer
GC Viewer
https://github.com/chewiebu
g/GCViewer
GCeasy
https://gceasy.io/
Google Garbage cat (cms)
https://code.google.com/arch
ive/a/eclipselabs.org/p/garba
gecat
HP Jmeter
https://h20392.www2.hpe.co
m/portal/swdepot/displayPro
ductInfo.do?productNumber
=HPJMETER
03
02
01
05
04
7
When Memory is Under Allocated
8
Memory Under Allocation GC Behavior-1
- Full Garbage Collection Event
Real World GC Report: https://tinyurl.com/5ezmmjyb
9
Memory Under Allocation GC Behavior-2
- Full Garbage Collection Event
Real World GC Report: https://tinyurl.com/2an5j4fp
10
GCeasy will generate following warnings
Insurance Provider Application Improves Throughput by 25%
GC Behavior due to Memory under Allocation: https://tinyurl.com/2wfj3p7v
GC Behavior upon increasing Memory Allocation: https://tinyurl.com/42fbp8sm
GC Throughput
96% GC Throughput means
Application is spending 96% of it’s time in processing customer transactions.
Remaining 4% of time in processing GC activities.
What is 96% GC Throughput?
1 day has 1440 minutes (i.e. 24 hours x 60 minutes)
4% = 57.6 minutes/day/JVM is stopping
Large Automobile Manufacturer reduces response time by 50%
https://blog.gceasy.io/automobile-company-optimizes-performance-using-gceasy
GC Behavior due to MetaSpace Under Allocation: https://tinyurl.com/2p2mmse9
JVM Memory Regions
14
–XX:MaxMetaspaceSize
-Xmx
Young Old
Metaspac
e
Threads JNI misc
GC
Direc
t
Buff
Code
Cach
e
Heap Memory Native Memory
Java Process Memory
-XX:MaxDirectMemorySize
15
Memory Under Allocation Recap
Impact
1. Response Time Degrades,
leading to unpleasant
customer experience
Symptoms
1. Application will become
unresponsive
2. CPU consumption will spike up
Solutions
1. Increase Heap Size
2. Increase Region Size
3. Add More JVM Instances
4. Quarantine Unusual
Traffic (if possible)
16
When Memory is Over Allocated
17
GC Behavior when there is Memory Over Allocation
Can you Guess?
It will look Normal. A True Silent Killer!
18
GCeasy Mathematical Models Will Generate Following Warning
Security Service Provider Reduces Memory by 75%
GC Behavior due to Memory under Allocation: https://tinyurl.com/r7nveb7z
GC Behavior upon increasing Memory Allocation: https://tinyurl.com/tvvvx8bx
20
Sometimes Mathematical Models Will Not Detect, Due to
02
01 Interim Traffic Spike. Examples:
a. Batch Jobs Running
b. Special Transactions (like Report Generation, Girls Scout
Account…)
Model needs at least 24 hours of GC log data to diagnose
properly
03 Sometimes it can do premature detection. What if you upload a weekend
traffic data
21
GC Log Analysis Best Practices
02
01 Use GC Log from Production JVM
Take at least 24 hours of data
More Best Practices: https://blog.gceasy.io/java-garbage-collection-best-practices
03 Take GC Log during a weekday
22
How much memory can I Reduce?
02
01 You can reduce as long as your GC KPIs don’t degrade i.e.
a. GC Throughput %
b. GC Pause Time
More Importantly your Response Time shouldn’t degrade
23
Memory Over Allocation Recap
Impact
1. You are going to end up
paying more to cloud
providers. Heavy cash drain
Symptoms
1. None
Solutions
1. Reduce Heap Size
2. Reduce JVM Instances
3. Plan diligently for
occasional spikes
Ram Lakshmanan ram@tier1app.com
@tier1app https://www.linkedin.com/company/ycrash
This deck will be published in:
https://blog.heaphero.io
If you want to learn more …
24
THANK YOU
FRIENDS

More Related Content

PPTX
millions-gc-jax-2022.pptx
PPTX
Spotting Trouble Early: What Java GC Patterns Can Tell You
PPTX
GC Tuning: A Masterpiece in Performance Engineering
PPTX
this-is-garbage-talk-2022.pptx
PDF
Garbage Collector Tuning
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PPTX
Common Memory Leaks in Java and How to Fix Them
PPTX
Top-5-java-perf-problems-jax_mainz_2024.pptx
millions-gc-jax-2022.pptx
Spotting Trouble Early: What Java GC Patterns Can Tell You
GC Tuning: A Masterpiece in Performance Engineering
this-is-garbage-talk-2022.pptx
Garbage Collector Tuning
Matchmaking for JVMs: How to Pick the Perfect GC Partner
Common Memory Leaks in Java and How to Fix Them
Top-5-java-perf-problems-jax_mainz_2024.pptx

Similar to How to Check and Optimize Memory Size for Better Application Performance (20)

PPT
Gc Atomic
PPTX
Intro to Garbage Collection
PDF
DC JUG: Understanding Java Garbage Collection
PDF
Hotspot Garbage Collection - Tuning Guide
PPTX
GC Tuning: Fortune 500 Case Studies on Cutting Costs and Boosting Performance
PPTX
Top 5 Java Performance Problems Presentation!
PDF
Troubleshooting Memory Problems in Java Applications
PPTX
predicting-m3-devopsconMunich-2023-v2.pptx
PDF
Tools and Tips to Diagnose Performance Issues
PPTX
JVM memory management & Diagnostics
PPTX
Chronicles Of Garbage Collection (GC)
PDF
Censum - Garbage Collection Log Analyser
PPT
CRAMM: Virtual Memory Support for Garbage-Collected Applications
PPTX
memory-patterns-confoo-2023.pptx
PDF
Tuning IBMs Generational GC
PPTX
Gc crash course (1)
PPTX
GC Tuning: Fortune 500 Case Studies on Cutting Costs and Boosting Performance
PDF
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
PDF
Enterprise Search Summit - Speeding Up Search
PPTX
Coding Best Practices For Memory Management
Gc Atomic
Intro to Garbage Collection
DC JUG: Understanding Java Garbage Collection
Hotspot Garbage Collection - Tuning Guide
GC Tuning: Fortune 500 Case Studies on Cutting Costs and Boosting Performance
Top 5 Java Performance Problems Presentation!
Troubleshooting Memory Problems in Java Applications
predicting-m3-devopsconMunich-2023-v2.pptx
Tools and Tips to Diagnose Performance Issues
JVM memory management & Diagnostics
Chronicles Of Garbage Collection (GC)
Censum - Garbage Collection Log Analyser
CRAMM: Virtual Memory Support for Garbage-Collected Applications
memory-patterns-confoo-2023.pptx
Tuning IBMs Generational GC
Gc crash course (1)
GC Tuning: Fortune 500 Case Studies on Cutting Costs and Boosting Performance
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
Enterprise Search Summit - Speeding Up Search
Coding Best Practices For Memory Management
Ad

More from Tier1 app (20)

PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
PDF
Virtual Threads in Java: A New Dimension of Scalability and Performance
PDF
Troubleshooting Virtual Threads in Java!
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
PPTX
Key Challenges in Troubleshooting Customer On-Premise Applications
PPTX
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
PPTX
Troubleshooting JVM Outages – 3 Fortune 500 Case Studies
PPTX
Troubleshooting JVM Outages – 3 Fortune 500 case studies
PPTX
How to Troubleshoot 9 Types of OutOfMemoryError
PPTX
Not So Common Memory Leaks in Java Webinar
PPTX
7 Micro-Metrics That Predict Production Outages in Performance Labs Webinar
PPTX
Mastering Thread Dump Analysis: 9 Tips & Tricks
PPTX
TroubleshootingJVMOutages-3CaseStudies (1).pptx
PPTX
TroubleshootingJVMOutages-3CaseStudies.pptx
PPTX
Major Outages in Major Enterprises Payara Conference
PPTX
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
PPTX
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
PPTX
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
PPTX
Effectively Troubleshoot 9 Types of OutOfMemoryError
PPTX
Top-5-production-devconMunich-2023-v2.pptx
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
Virtual Threads in Java: A New Dimension of Scalability and Performance
Troubleshooting Virtual Threads in Java!
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Key Challenges in Troubleshooting Customer On-Premise Applications
Micro-Metrics Every Performance Engineer Should Validate Before Sign-Off
Troubleshooting JVM Outages – 3 Fortune 500 Case Studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
How to Troubleshoot 9 Types of OutOfMemoryError
Not So Common Memory Leaks in Java Webinar
7 Micro-Metrics That Predict Production Outages in Performance Labs Webinar
Mastering Thread Dump Analysis: 9 Tips & Tricks
TroubleshootingJVMOutages-3CaseStudies (1).pptx
TroubleshootingJVMOutages-3CaseStudies.pptx
Major Outages in Major Enterprises Payara Conference
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
Effectively Troubleshoot 9 Types of OutOfMemoryError
Top-5-production-devconMunich-2023-v2.pptx
Ad

Recently uploaded (20)

PDF
Present and Future of Systems Engineering: Air Combat Systems
PDF
Design of Material Handling Equipment Lecture Note
PDF
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
PDF
First part_B-Image Processing - 1 of 2).pdf
PPTX
Unit_1_introduction to surveying for diploma.pptx
PDF
VSL-Strand-Post-tensioning-Systems-Technical-Catalogue_2019-01.pdf
PDF
Unit1 - AIML Chapter 1 concept and ethics
PPTX
Amdahl’s law is explained in the above power point presentations
PPTX
Software Engineering and software moduleing
PDF
Unit I -OPERATING SYSTEMS_SRM_KATTANKULATHUR.pptx.pdf
PDF
Project_Mgmt_Institute_-Marc Marc Marc .pdf
PPTX
Agentic Artificial Intelligence (Agentic AI).pptx
PDF
Computer organization and architecuture Digital Notes....pdf
PDF
Cryptography and Network Security-Module-I.pdf
PPTX
Environmental studies, Moudle 3-Environmental Pollution.pptx
PDF
electrical machines course file-anna university
PPTX
mechattonicsand iotwith sensor and actuator
PPTX
Chapter 2 -Technology and Enginerring Materials + Composites.pptx
PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
PPT
Chapter 1 - Introduction to Manufacturing Technology_2.ppt
Present and Future of Systems Engineering: Air Combat Systems
Design of Material Handling Equipment Lecture Note
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
First part_B-Image Processing - 1 of 2).pdf
Unit_1_introduction to surveying for diploma.pptx
VSL-Strand-Post-tensioning-Systems-Technical-Catalogue_2019-01.pdf
Unit1 - AIML Chapter 1 concept and ethics
Amdahl’s law is explained in the above power point presentations
Software Engineering and software moduleing
Unit I -OPERATING SYSTEMS_SRM_KATTANKULATHUR.pptx.pdf
Project_Mgmt_Institute_-Marc Marc Marc .pdf
Agentic Artificial Intelligence (Agentic AI).pptx
Computer organization and architecuture Digital Notes....pdf
Cryptography and Network Security-Module-I.pdf
Environmental studies, Moudle 3-Environmental Pollution.pptx
electrical machines course file-anna university
mechattonicsand iotwith sensor and actuator
Chapter 2 -Technology and Enginerring Materials + Composites.pptx
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
Chapter 1 - Introduction to Manufacturing Technology_2.ppt

How to Check and Optimize Memory Size for Better Application Performance

  • 1. Is Your Memory Correctly Sized? I am doubtful Ram Lakshmanan Architect GCeasy, FastThread, HeapHero
  • 2. 2 What is the Impact of Wrong Memory Size? When Memory is Under Allocated You are going to disappoint Customers with poor response time When Memory is Over Allocated You are going to make already rich Cloud Providers AWS, Azure, GCP… richer 
  • 3. 3 Do Garbage Collection Study How to know whether memory is correctly sized?
  • 4. 4 How to do Garbage Collection Study?
  • 5. 5 Step 1: Enable GC Logging -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<file-path> Till Java 8 -Xlog:gc*:file=<file-path> From Java 9 Enable GC logs (always) Almost zero overhead. https://blog.gceasy.io/overhead-added-by-garbage-collection-logging/
  • 6. 6 Step 2: Analyze using GC Log Analysis Tools https://developer.ibm.com/ja vasdk/tools/ IBM GC & Memory visualizer GC Viewer https://github.com/chewiebu g/GCViewer GCeasy https://gceasy.io/ Google Garbage cat (cms) https://code.google.com/arch ive/a/eclipselabs.org/p/garba gecat HP Jmeter https://h20392.www2.hpe.co m/portal/swdepot/displayPro ductInfo.do?productNumber =HPJMETER 03 02 01 05 04
  • 7. 7 When Memory is Under Allocated
  • 8. 8 Memory Under Allocation GC Behavior-1 - Full Garbage Collection Event Real World GC Report: https://tinyurl.com/5ezmmjyb
  • 9. 9 Memory Under Allocation GC Behavior-2 - Full Garbage Collection Event Real World GC Report: https://tinyurl.com/2an5j4fp
  • 10. 10 GCeasy will generate following warnings
  • 11. Insurance Provider Application Improves Throughput by 25% GC Behavior due to Memory under Allocation: https://tinyurl.com/2wfj3p7v GC Behavior upon increasing Memory Allocation: https://tinyurl.com/42fbp8sm
  • 12. GC Throughput 96% GC Throughput means Application is spending 96% of it’s time in processing customer transactions. Remaining 4% of time in processing GC activities. What is 96% GC Throughput? 1 day has 1440 minutes (i.e. 24 hours x 60 minutes) 4% = 57.6 minutes/day/JVM is stopping
  • 13. Large Automobile Manufacturer reduces response time by 50% https://blog.gceasy.io/automobile-company-optimizes-performance-using-gceasy GC Behavior due to MetaSpace Under Allocation: https://tinyurl.com/2p2mmse9
  • 14. JVM Memory Regions 14 –XX:MaxMetaspaceSize -Xmx Young Old Metaspac e Threads JNI misc GC Direc t Buff Code Cach e Heap Memory Native Memory Java Process Memory -XX:MaxDirectMemorySize
  • 15. 15 Memory Under Allocation Recap Impact 1. Response Time Degrades, leading to unpleasant customer experience Symptoms 1. Application will become unresponsive 2. CPU consumption will spike up Solutions 1. Increase Heap Size 2. Increase Region Size 3. Add More JVM Instances 4. Quarantine Unusual Traffic (if possible)
  • 16. 16 When Memory is Over Allocated
  • 17. 17 GC Behavior when there is Memory Over Allocation Can you Guess? It will look Normal. A True Silent Killer!
  • 18. 18 GCeasy Mathematical Models Will Generate Following Warning
  • 19. Security Service Provider Reduces Memory by 75% GC Behavior due to Memory under Allocation: https://tinyurl.com/r7nveb7z GC Behavior upon increasing Memory Allocation: https://tinyurl.com/tvvvx8bx
  • 20. 20 Sometimes Mathematical Models Will Not Detect, Due to 02 01 Interim Traffic Spike. Examples: a. Batch Jobs Running b. Special Transactions (like Report Generation, Girls Scout Account…) Model needs at least 24 hours of GC log data to diagnose properly 03 Sometimes it can do premature detection. What if you upload a weekend traffic data
  • 21. 21 GC Log Analysis Best Practices 02 01 Use GC Log from Production JVM Take at least 24 hours of data More Best Practices: https://blog.gceasy.io/java-garbage-collection-best-practices 03 Take GC Log during a weekday
  • 22. 22 How much memory can I Reduce? 02 01 You can reduce as long as your GC KPIs don’t degrade i.e. a. GC Throughput % b. GC Pause Time More Importantly your Response Time shouldn’t degrade
  • 23. 23 Memory Over Allocation Recap Impact 1. You are going to end up paying more to cloud providers. Heavy cash drain Symptoms 1. None Solutions 1. Reduce Heap Size 2. Reduce JVM Instances 3. Plan diligently for occasional spikes
  • 24. Ram Lakshmanan [email protected] @tier1app https://www.linkedin.com/company/ycrash This deck will be published in: https://blog.heaphero.io If you want to learn more … 24 THANK YOU FRIENDS

Editor's Notes

  • #6: Demo: GCeasy - C:\workspace\ycrash\speeches\9-types-oom\gc-memory-leak.zip