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 2023
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 272 contents
https://www.youtube.com/watch?v=lVmIEhYNAfg
Java Profiling and Performance (Page last updated May 2023, Added 2023-07-30, Author Frank Delporte, Publisher Foojay Podcast). Tips:
- JFR includes sampling CPU profiling; allocation profiling; safepoint profiling; and execution tracing.
- Profiling can also be used for diagnostics as well as performance engineering - finding unexpected issues rather than looking specifically for where to improve performance.
- For profiling, it's best to decide what you are looking for, what you are optimizing before you profile, so that you use the correct type of profiling.
- If you are tuning, you need to compare specific measures before and after, otherwise it's very misleading.
- The JVM contains ergonomics which tries to adapt and optimize the performance for the specific application being run.
- Distributed tracing is now massively important as it gives you the context of where and why a particular trace has issues.
- Performance tuning can be a cost optimization as well as a throughput or latency improvement.
- 83% of JVM apps don't even try to size the heap. Actually having no flag is better than the wrong setting of a flag.
- Algorithms and data structures still matter now, but most other inefficiencies are compensated for by the JVM.
https://medium.com/expedia-group-tech/essential-application-monitoring-metrics-a08519ecab9d
Understanding Real-Time Application Monitoring (Page last updated June 2023, Added 2023-07-30, Author Ritesh Kapoor, Publisher Expedia). Tips:
- Monitoring performance in real-time is critical for ensuring positive experiences for customers.
- Capturing the right metrics gives powerful insights into your application. Top performance indicators for requests are: TP99/TP95/TP90 percentiles, where TPx latency is the maximum time under which x% of requests have been served; average time taken; Maximum / Minimum time taken; Overall transactions processed per second.
- SLI/SLO/SLA should be defined and monitored for all applications. SLI=Service Level Indicator, a metric used for the SLO; SLO=Service Level Objective, target value or range of acceptable values for SLIs; SLA=Service Level Agreement, a (explicit or implicit) contract with your users that includes consequences of meeting or missing SLOs.
- Useful JVM metrics: Heap Memory Utilisation for different heap areas like Young, Eden space, etc; Major/Minor GC frequency; Major/Minor GC pause time; Total thread count.
- Useful application metrics: Response times, request count, request success rate, error status codes count, SLA breach count.
- Useful application datastore response metrics: response time per type of data request; timeout/connection reset count, queries per second, CPU and memory utilization of the datastore, page faults.
- Useful queue metrics to monitor: consumer consumption rate, producer production rate, average message size, producer-consumer lag.
- Useful cluster metrics: request count, response time, healthy host count, instances stopped per unit time.
https://www.youtube.com/watch?v=wApqCjHWF8Q
Secrets of Performance Tuning Java on Kubernetes (Page last updated October 2022, Added 2023-07-30, Author Bruno Borges, Publisher Devoxx). Tips:
- The most common fix for a performance issue is to increase the heap size or the number of replicas.
- The default choice of garbage collector algorithm (ie if the algorithm is not explicitly set on the command line) is the serial collector if there is 1 CPU available (including for containers that have less than 1000 millicores) is the serial collector; it is also the serial collector if less than 1.792GB is available; otherwise it is G1 after for Java 11+, or parallel for Java 8.
- JVM default heap size allocation is 50% of available RAM up to 256MB, then 120MB heap size until 512MB, after which it is 25%.
- Poorly tuned GCs can lead to high pause times, thread starvation and OOMEs.
- Selecting the appropriate garbage collector (GC) depends on the CPUs available - and similarly to attain specific GC targets you may need to provide more CPUs and a different GC.
- If running on bare metal, set the heap to whatever size the application needs, but less than available RAM; for a container set to less than 75% of container memory. Set using -Xmx or -XX:MaxRAMPercentage=75 - but note applications and 3rd party products using off-heap memory may need this lower.
- Recommended GC choices: serial for 1 CPU, parallel up to 2 CPUs and 4GB, G1 up to 4 CPUs, then Z or Shenandoah.
Jack Shirazi
Back to newsletter 272 contents
Last Updated: 2025-01-27
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/newtips272.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us