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 May 2021
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 246 contents
https://www.youtube.com/watch?v=ofl9SQPPof0
Demystifying Garbage Collection in Java(Page last updated April 2021, Added 2021-05-26, Author Igor Braga, Publisher CoffeeJUG). Tips:
- -Xgcpolicy:optthruput is a single generation parallel non-concurrent GC with optional compaction targeted at GC throughput; -Xgcpolicy:gencon is a parallel and concurrent 2-generation GC with concurrent collection in both generations; metronome is an incremental parallel GC with an upper bound on GC pause time; -Xgcpolicy:balanced is like optthruput but reduces the max pause time by doing smaller partial GCs where possible.
- GC algorithm choice is a choice between minimizing individual pause time and minimizing total pause time (optimizing throughput).
https://www.opsian.com/blog/profiling-and-time/
Profiling can be about time.. but which time?(Page last updated February 2021, Added 2021-05-26, Author Sadiq Jaffer, Richard Warburton, Publisher Opsian). Tips:
- There are two types of profiling timing: CPU time (the time that your code spends executing code on the CPU; and Wallclock time (the elapsed time between starting an operation and it completing).
- CPU Time in profiling is more useful for problems where there are few threads showing high CPU usage - other threads that are waiting around performing background work tend to not be limiting the throughput of your application. So CPU Time is better to profile on when you know you're bottlenecked on processing capacity.
- Wallclock Time in profiling is useful for problems where CPU utilisation seems low but application throughput or latency doesn't meet expectations - threads are probably blocked. For example: contending on a lock; waiting for downstream network IO; running with too many threads so some of them don't get scheduled. The trigger for looking at Wallclock time when profiling would be low CPU usage during your period of performance issues.
https://www.youtube.com/watch?v=Fmjc2ehNhF8
Object Recycling Techniques on GC and Application Performance(Page last updated June 2020, Added 2021-05-26, Author Rafal Foltynski, Publisher JVM Roundabout). Tips:
- To get zero allocation, you need to use object pooling.
- Pool objects when you have: long-lived expensive to create objects; or short-lived similar in size and nature.
- To reduce allocation, don't serialize to a string then write the string, write directly to a stream.
- Understand your threads, know what they do and their lifecycle and what they share with other threads. You can optimize if you know a thread is the only user of an object.
Jack Shirazi
Back to newsletter 246 contents
Last Updated: 2024-11-29
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/newtips246.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us