Java Performance Tuning
Java(TM) - see bottom of page
Our valued sponsors who help make this site possible
JProfiler: Get rid of your performance problems and memory leaks!
Training online: Concurrency, Threading, GC, Advanced Java and more ...
Tips July 2017
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 200 contents
https://www.youtube.com/watch?v=at1YA_u__g8
The Performance Engineer's Guide to HotSpot Virtual Machine's Execution Engine (Page last updated May 2017, Added 2017-07-31, Author Monica Beckwith, Publisher Riga Dev Days). Tips:
- Responsiveness, footprint, and throughput are the targets for improving performance.
- The JIT compiler compiles methods when the loop iteration or method execution count exceeds the compile threshold (this can be set differently to the defaults using command line parameters).
- Tiered compilation (enabled by default in JDK 8+) has multiple levels of compilation: Interpreted, C1 (client compiler) with counters triggering compilation, C1 with profiling triggering compilation, C2 (server compiler). Tiered compilation needs a larger code cache (5x bigger!). Use -XX:ReservedCodeCacheSize to change the value.
- Heaps can benefit from OOP compression, but there are successive heap size thresholds which make it less efficient: 4GB, 28GB, 32GB, 64GB. Each threshold makes the compression less effective, so try to stay below a threshold rather than just above.
https://dzone.com/articles/a-troublesome-legacy-memory-leaks-in-java
A Troublesome Legacy: Memory Leaks in Java (Page last updated July 2017, Added 2017-07-31, Author Enrique Lopez Manas, Publisher DZone). Tips:
- Memory leaks eat up available memory, but before running out of memory they cause increased garbage collection which is also bad.
- Ways to aoid memory leaks include: making sure you close streams (eg network connections) when you're finished using them; avoiding static fields; ensuring hashCode() and equals() are correctly implemented so that objects don't get lost in hashed data structures.
- Inner classes need to have access to their outer class - if the inner class instance continues to be live when the outer class instance is completed, the outer class instance will be kept alive leading to a possible memory leak. One possible solution is to hold the outer class reference in a weak reference.
- A hierarchy of reference types (SoftReference, WeakReference, PhantomReference) are available for eliminating memory leaks caused from holding strong references to objects that are no loger needed.
- Use static inner classes rather than non-static inner classes, and use a WeakReference to reference the outer class instance.
- Never keep long-term references to any kind of Context.
https://jaxenter.com/garbage-collection-logs-134707.html
Garbage Collection logs: Can we really use it like that? (Page last updated June 2017, Added 2017-07-31, Author Ram Lakshmanan, Publisher jaxenter). Tips:
- Use garbage collection logs to troubleshoot memory related problems and tune your GC settings.
- Use garbage collection logs to come up with optimal memory size settings so that you can minimize cloud hosting bills which for most applications has memory bound costs.
- Use garbage collection logs from testing to identify changes in performance - the logs hold all the information needed.
- You can use production garbage collection logs to alert on:
- Memory problems; consecutive Full GCs; GC KPIs on latency, throughput and footprint; Object creation rate; promotion rate; reclamation rate; etc.
- You can set thresholds for statistics like object creation rate, full GC count, GC interval time, etc using garbage collection logs in continuous integration pipelines to catch performance issues in development.
https://www.youtube.com/watch?v=0CLQb3hAa4g
How we scaled Redmart (Page last updated June 2017, Added 2017-07-31, Author Rajesh Lingappa, Publisher Devoxx). Tips:
- Build complex systems by evolving from simple systems, building something complex from the start won't work.
- To scale, start with the APIs.
Jack Shirazi
Back to newsletter 200 contents
Last Updated: 2024-12-27
Copyright © 2000-2024 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/news/newtips200.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us