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 December 2025
|
JProfiler
|
|
Get rid of your performance problems and memory leaks!
|
|
JProfiler
|
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 301 contents
https://www.youtube.com/watch?v=rWC8h9AFR0I
Off-CPU Profiling & Latency Diagnostics in Java (Page last updated November 2025, Added 2025-12-26, Author Yude Lin, Publisher JVMLS). Tips:
- The more recent the JDK, the better the performance especially for GCs.
- Since the significance of GC pauses in overall latency is decreasing, you need to focus optimization efforts away from GC and look elsewhere for pause causes.
- Major contributors to latency are often off-CPU (scheduling, I/O waits, or networking), especially for latency-sensitive services. These are becoming more important with pauseless GCs.
- For IO-bound workloads, allow the application to be aware of the current I/O time and shrink its heap usage to leave space for the OS cache (where you are using a GC that returns memory to the OS). This optimization can significantly reduce I/O wait time and improve overall execution time.
- Re-evaluate approaches to latency issues as Java becomes more pauseless, which exposes off-CPU factors more significantly.
- Profiling needs to include OS scheduling pausing for accurate analysis.
- Leverage Virtual Threads which can improve P50 latency and drastically reduce the scheduling time involved in transactions.
https://www.youtube.com/watch?v=mKQ_0ayVo-I
Java immutability, Record, Thread Safety, Caching, Performance Predictability (Page last updated October 2025, Added 2025-12-26, Author Ajay Nirankari, Publisher KnowledgeSharingG). Tips:
- Immutable objects (state cannot be changed after creation) are widely used for multi-threading because they are thread safe. They improve predictability, thread-safety, and application performance.
- Prefer immutable objects where possible; mutable objects only when necessary. Mutability within local variables or method scope is ok; changes should not be visible outside that scope.
- Creating immutable classes (Pre-Java 14): Declare the class as `final`, fields as `private final`; initialize fields via constructor only; make defensive copies of mutable fields when returning them; use copies of mutable collections to prevent external modification.
- Immutable objects are suitable for caching, sharing objects across threads and safe for API design.
- Immutable Java classes include: String, wrapper classes (`Integer`, `Double`, `Float`), LocalDate, LocalTime, parts of the Stream API, some Java collections eg `List.of()`, `Set.of(...)`, `Map.of(...)`, `Collections.unmodifiableList()`, `Collections.unmodifiableSet()`, `Collections.unmodifiableMap()`.
- Creating immutable classes (Java 14+): Java Records (final by default, provide getter methods, equals, hashCode, and toString, cannot be extended but can implement interfaces).
https://www.youtube.com/watch?v=KSVK9l786rY
AI in Performance Testing (Page last updated November 2025, Added 2025-12-26, Author Raisa Lipatova, Publisher @perfology). Tips:
- Ensure monitoring and logging systems are implemented in the performance testing environment to check and verify results.
- Mock all systems that are not connected to the test system, to obtain more accurate results. Monitor the mock service and load generators to ensure they are working correctly, adhering to the profile, and that their hardware/software is performing well.
- Metrics analysis is the most critical and time-consuming task, especially where one API request may internally call multiple others, potentially summing or compounding degradation.
- Use a testing approach that compares the performance of a new release against a baseline derived from the previous release.
- Leverage AI tools for analysis, as performance testing data is generally structured enough for AI to handle it effectively, often without special preparation.
- Teach or educate a custom AI model using old reports, historical results, and specific rules.
- Implement tools that perform anomaly detection to catch issues earlier, which could prevent huge outages or production issues.
- Use anomaly detection to stop tests early if configuration or environment problems are detected.
- Test performance under high availability scenarios.
- For simple tests or performance testing of a single component, the entire testing process can potentially be handed over to AI, which can create the profile, test scenario, and run the test.
- Automate any routine work that are involved in issue investigations.
Jack Shirazi
Back to newsletter 301 contents
Last Updated: 2025-12-25
Copyright © 2000-2025 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/newtips301.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us