August 28 2025, Newsletter no. 297 (this newsletter is available in html format at http://www.javaperformancetuning.com/news/news297.shtml )

As usual before a Java release, I'm listing all the new performance features in the upcoming release, this time for Java 25 (I have done this every 6 months, prior to each new release, you can track back to the previous February and August newsletters if you want to see what's new performance-wise in any particular release). In each of these pre-release newsletters, I give the new features, the performance benefits from each feature, and how to use the feature.

Java 25 is an LTS release, so will be supported for longer than the 6 month support life of non-LTS releases. That means many enterprises will plan to move to this release in the coming years, so all the features since 21 (the last LTS release) will become available to many more dev. If you want to see the full list of performance features for any version, they are conveniently listed together in my page ( https://htmlpreview.github.io/?https://github.com/jackshirazi/perf-... ) showing all the performance changes in each release of the JVM since Java/JDK/JVM 10.

On a different subject, I'll be giving an ( https://jaxlondon.com/devops-continuous-integration-delivery/opente... ) Extension Magic for the OpenTelemetry Java Agent at ( https://jaxlondon.com/ ) JAX London for anyone interested or already going.

Now on to the details of those Java 25 changes, including the options you have available to use them. And of course the tips from this month's articles, as ever are extracted into ( http://www.javaperformancetuning.com/news/newtips297.shtml ) this month's tips page.

A note from this newsletter's sponsor:
                    JProfiler
  Get rid of your performance problems and memory leaks!
http://www.JavaPerformanceTuning.com/cgi-bin/urlon.pl?target=42


__News__

Java performance tuning related news - Java 25 performance changes

- JEP-514  Ahead-of-Time command-line simplification. Now allow the two-step `-XX:AOTMode=record -XX:AOTConfiguration=app.aotconf ` then `-XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot` to be replaced with a one-step `-XX:AOTCacheOutput=app.aot` at
  https://openjdk.org/jeps/514
- JEP-515 Ahead-of-time method profiling - improves warmup time by making method-execution profiles from a previous run of an application instantly available. Uses the AOT cache mechanism, ie run the application, record its AOT configuration `java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconf ..., create the cache  `java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot ...` then run with the cache `java -XX:AOTCache=app.aot -cp app.jar ...` (also see above JEP 514 item which lets you use the one-step `-XX:AOTCacheOutput=app.aot` option, which equally applies to this feature) at
  https://openjdk.org/jeps/515
- JEP-518 Reduces safepoint bias in JFR sampling. Nothing to turn on here, it's applied automatically if you use JDK 25+ at
  https://openjdk.org/jeps/518
- JEP-519 Compact object headers are no longer experimental. Use with -XX:+UseCompactObjectHeaders. Should reduce memory and CPU a bit at
  https://openjdk.org/jeps/519
- JEP-520 Adding JFR method timing and tracing via bytecode instrumentation. Instrumenting small amounts of non-critical code is fine, but if you instrument heavily looped code or extensively through the app, the overheads are huge. Java agents that do code instrumentation are verry very careful to be selective about what they instrument, and so should you! The JEP gives some nice examples, for example tracing HashMap.resize() with `java -XX:StartFlightRecording:jdk.MethodTrace#filter=java.util.HashMap::resize,filename=...` and timing every static initializer `java '-XX:StartFlightRecording:method-timing=::<clinit>,filename=...` at
  https://openjdk.org/jeps/520
- JEP-521 Shenandoah generational mode is no longer experimental (but not yet default). Enable with -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational at
  https://openjdk.org/jeps/521
- JDK-8356698 jfr.Contextual, has been introduced to mark fields in custom JFR events that contain contextual information relevant to other events occurring in the same thread. Example in the articles section of this newsletter at
  https://bugs.openjdk.org/browse/JDK-8356698
- JDK-8343110 New getChars(int, int, char[], int) method in CharSequence and CharBuffer to bulk-read, likely to be more efficient than looping over characters one at a time at
  https://bugs.openjdk.org/browse/JDK-8343110
- JDK-8328919 New Methods on BodyHandlers and BodySubscribers to limit the response body bytes size accepted by an HttpClient. For example `HttpClient.newHttpClient().send(request, BodyHandlers.limiting(BodyHandlers.ofString(), 1024))` limits the response size to 1k at
  https://bugs.openjdk.org/browse/JDK-8328919
- JDK-8319447 Some updates to ForkJoinPool and CompletableFuture to make delayed, timeout and async tasks more efficient. Includes ScheduledExecutorService.submitWithTimeout, but mainly users of ForkJoinPools - including virtual thread scheduling - get more efficient operations for delayed actions, periodic actions, and cancellations at
  https://bugs.openjdk.org/browse/JDK-8319447
- JDK-8356870 Thread dumps generated by HotSpotDiagnosticMXBean.dumpThreads and jcmd Thread.dump_to_file now include lock information at
  https://bugs.openjdk.org/browse/JDK-8356870
- JDK-8241678 The periodic sampling functionality in PerfData has been removed, including the StatSampler and its controlling flag -XX:PerfDataSamplingInterval at
  https://bugs.openjdk.org/browse/JDK-8241678
- JDK-8138614 StringBuilder and StringBuffer can now return the same String instead of always having to return a new one (eg the same empty string instance) at
  https://bugs.openjdk.org/browse/JDK-8138614
- Metaspace is now printed separately from GC at
  https://bugs.openjdk.org/browse/JDK-8356938
- JEP-506 Scoped Values (Fourth Preview). More efficient than thread-local variables, especially with large numbers of virtual threads at
  https://openjdk.org/jeps/506
- JEP-502: Stable Values (Preview). An API for stable values, objects that hold immutable data. Treated as constants by the JVM, enabling the same performance optimizations that are available by declaring a field final at
  https://openjdk.org/jeps/502
- JEP-505 Structured Concurrency (Fifth Preview). Simplify concurrent programming by grouping related tasks running in different threads at
  https://openjdk.org/jeps/505
- JEP-507 Primitive types in patterns, instanceof, and switch (Third Preview). Unlikely to provide any significant performance improvement (fair enough as that's not the motivation) at
  https://openjdk.org/jeps/507
- JEP-508 Vector API (Tenth Incubator). Vector computations that reliably compile at runtime to optimal vector hardware instructions. Useful for ML, GenAI, image processing, scientific processing, massive financial calculations, etc at
  https://openjdk.org/jeps/508
- JEP-509 (Experimental), add CPU-time profiling to JFR on Linux systems only. New event `java -XX:StartFlightRecording=jdk.CPUTimeSample#enabled=true,filename=profile.jfr ...` or dynamically `jcmd PID JFR.start settings=/path/cpu_profile.jfc duration=4m` at
  https://openjdk.org/jeps/509


__Tools__

Java performance tuning related tools

- Separate Metaspace and GC Printing per JDK-8356938 at
  https://inside.java/2025/06/09/quality-heads-up/
- Understanding the safepoint bias avoidance of JEP 518 at
  https://mostlynerdless.de/blog/2025/05/20/taming-the-bias-unbiased-...
- Ahead-of-Time (AOT) compilation at
  https://javadevtech.com/2025/06/07/ahead-of-time-aot-cache-with-pro...
- Stable Values API JEP502 define immutable objects initialized at most once, offering the flexibility of lazy initialization with the performance benefits of final fields eg a singleton: `private static final StableValue<Thing>; INSTANCE = StableValue.create(Thing::new); public static Thing getInstance() {return INSTANCE.get();}` at
  https://inside.java/2025/06/10/podcast-037/


__Articles__

- Method Timing in Java 25 with JFR and OpenTelemetry (Niklas Keller/kelunik's blog) at
  https://blog.kelunik.com/2025/08/24/method-trace-java-25.html
- What's new for JFR in JDK 25 (Erik Gahlin/egahlin) at
  https://egahlin.github.io/2025/05/31/whats-new-in-jdk-25.html
- Java 25's new CPU-Time Profiler (Johannes Bechberger/mostlynerdless) at
  https://mostlynerdless.de/blog/2025/06/11/java-25s-new-cpu-time-pro...


__The latest performance tips__

All the performance tips extracted from the listed articles at
http://www.JavaPerformanceTuning.com/news/newtips297.shtml

This email has been sent to you because you have subscribed to the Java Performance Tuning newsletter. If you prefer not to receive any future newsletters, please use the URL
http://www.javaperformancetuning.com/cgi-bin/subscribe.pl?unsubscri...

Jack Shirazi
http://www.javaperformancetuning.com/contactUs.shtml
Java(TM) 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

Views: 5

Comment

You need to be a member of Codetown to add comments!

Join Codetown

Happy 10th year, JCertif!

Notes

Welcome to Codetown!

Codetown is a social network. It's got blogs, forums, groups, personal pages and more! You might think of Codetown as a funky camper van with lots of compartments for your stuff and a great multimedia system, too! Best of all, Codetown has room for all of your friends.

When you create a profile for yourself you get a personal page automatically. That's where you can be creative and do your own thing. People who want to get to know you will click on your name or picture and…
Continue

Created by Michael Levin Dec 18, 2008 at 6:56pm. Last updated by Michael Levin May 4, 2018.

Looking for Jobs or Staff?

Check out the Codetown Jobs group.

 

Enjoy the site? Support Codetown with your donation.



InfoQ Reading List

Presentation: Productivity Is Messing Around and Having Fun

Holly Cummins & Trisha Gee explain how to achieve the "Double Win" - boosting both developer joy and productivity. They expose the flaws of traditional metrics, identify sources of developer toil (slow builds, flaky tests), and share methods and techniques (like boredom and play) for engineering leaders and architects to unlock creativity and a 31% boost in positive-brain productivity.

By Holly Cummins, Trisha Gee

HashiCorp’s New Guide Offers Practical Advice on Writing and Rightsizing Terraform Modules

In a blog post titled "How to write and rightsize Terraform modules", HashiCorp shares a comprehensive framework for creating maintainable, scalable modules in the Terraform ecosystem. Author Mitch Pronschinske draws on insights from consultant Rene Schach's HashiDays 2025 session to focus on four key pillars: module scope, code strategy, security, and testing.

By Craig Risi

Microsoft Patches Critical ASP.NET Core Vulnerability with 9.9 Severity Score

Microsoft recently released a security advisory and patched a critical vulnerability in ASP.NET Core that allows an attacker to bypass a security feature over a network due to an inconsistent interpretation of HTTP requests. With a CVSS score of 9.9 out of 10, CVE-2025-55315 is the highest-rated Microsoft vulnerability.

By Renato Losio

Google Cloud Introduces Chaos Engineering Framework and Recipes for Distributed Systems

Google Cloud's Expert Services Team has released a detailed guide on chaos engineering for cloud-based distributed systems. It highlights that the intentional creation of failures is essential for developing resilient architectures. The initiative provides open-source recipes and helpful guidance for applying controlled disruption testing in Google Cloud environments.

By Claudio Masolo

Article: When Reverse Proxies Surprise You: Hard Lessons from Operating at Scale

Operating massive reverse proxy fleets reveals hard lessons: optimizations that work on smaller systems fail at scale; mundane oversights like missing commas cause major outages; and abstractions meant to simplify become hidden fragility points. Success requires profiling on target hardware, relentlessly monitoring boring details, keeping hot paths lean, and trusting instrumentation over theory.

By Mitendra Mahto

© 2025   Created by Michael Levin.   Powered by

Badges  |  Report an Issue  |  Terms of Service