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 March 2022
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 256 contents
https://www.youtube.com/watch?v=iHOtYCcc0Lw
Continuous Performance Regression Testing with JfrUnit (Page last updated February 2022, Added 2022-03-29, Author Gunnar Morling, Publisher p99conf). Tips:
- You need a production-like environment to run performance tests. In the absence of that, JfrUnit asserts proxy metric values which can be used consistently across multiple environments. JfrUnit uses JFR events.
- JfrUnit records JFR recordings so you can investigate test failures including by using Java Mission Control (JMC) which is a full featured GUI tool that allows you to analyze JFR recordings.
- JFR custom events can be added to an application (manually through code, and also through configuration using JMC agent) and JfrUnit can use these events for tests and will include them in JFR recordings for subsequent analysis.
- JfrUnit cannot consistently identify concurrency issues that only show under load.
https://dzone.com/articles/java-how-object-reuse-can-reduce-latency-and-impro
How Object Reuse Can Reduce Latency and Improve Performance (Page last updated January 2022, Added 2022-03-29, Author Per-Ake Minborg, Publisher DZone). Tips:
- Carefully reusing objects provide a way to maintain low-latency performance while keeping object-oriented abstractions.
- Keeping a small working set of data improves latency by orders of magnitude as the data can fit in CPU caches.
- Each GC touches widespread memory locations and usually effectively invalidates CPU caches, causing non-deterministic application performance drops. This still applies to more recent GC algorithms.
- An object that is immutable can always be reused and handed between threads, so reusing these is simple and desirable.
- volatile fields can improve reuse, but can be difficult to get right and has a small performance overhead.
- ThreadLocals can help reuse objects but has overhead and is susceptible to memory leaking; additionally they don't scale to fibres.
https://iranna-patil.medium.com/investigating-java-heap-memory-and-native-memory-leaks-493b94a16b53
Investigating Java Heap memory and Native memory leaks (Page last updated February 2022, Added 2022-03-29, Author Iranna Patil, Publisher Medium). Tips:
- JVM hotspot memory spaces include: eden (new objects), survivor spaces (young objects); young gen (eden+survivor spaces); tenured/old gen (old objects); heap (young+old gens); metaspace (class definitions); code cache (JITed code); thread stacks; shared libs (DLLs and .SOs).
- A Java object leak should show as the amount of heap space gradually increasing - or more accurately the heap space used after full GCs gradually increasing; focusing on old gen is usually better since the leak will fill old gen.
- A native memory leak won't show on any of the tools that monitor Java heap spaces, but the overall process size will keep increasing. JEMALLOC is a useful library to look for native memory leaks.
- If you have a native object created using JNI, you need to explicitly free the object or the memory will leak.
Jack Shirazi
Back to newsletter 256 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/newtips256.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us