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 February 2019
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 219 contents
https://www.youtube.com/watch?v=LxtBl9x5ho4
The Missing Benchmark Metric: Memory Consumption (Page last updated February 2019, Added 2019-02-25, Author Jens Wilke, Publisher FOSDEM). Tips:
- To microbenchmark taking into account the GCs, use -gc true with JMH, or try Zero GC, use -prof gc to check on the GCs, monitor GC log stats, and increase warmup and iterations to ensure you get steady state behaviour.
- For memory analysis, use /proc/self/status to look at the VMRSS (resident set size, memory used in memory) and the VMHWM (high water mark for RSS); and also the heap stats as given by GC logs or GarbageCollectionNotificationInfo
- Different collectors will give different results for microbenchmarks if GC plays a part at all. So repeat measurements using the different collectors
https://www.youtube.com/watch?v=9Cnm2lFBe0I
Exploring Java Heap Dumps (Page last updated November 2018, Added 2019-02-25, Author Ryan Cuprak, Publisher Devoxx). Tips:
- Memory leaks have many reasons, some less common are: faulty clone methods; duplicate singletons; cache logic bugs.
- NetBeans (open source) profiler has a profiler API which can be used standalone - https://github.com/apache/incubator-netbeans/tree/master/profiler/lib.profiler/src/org/netbeans/lib/profiler/heap using HeapFactor.createHeap(). Note some profiler calls are slow - prefer Javadoc "Speed: normal" calls. Note the API itself doesn't cache the heap dump into memory, but you could inadvertently do that so be careful.
- Heap dumps can be generated with -XX:+HeapDumpOnOutOfMemoryError, jmap, jshdb, jcmd, cntrl-break, and from the HotspotDiagnostic platform mbean both programmatically or via any JMX client.
- Analyse heaps from gcroots, threads, or class types. Roots are: classes (loaded by classloader), thread, stack local, monitor, JNI reference, something held by the JVM. Generally it's best to filter out internal JVM classes since these won't be causing the leak.
- When processing large heaps, you might need to cache intermediate analyses on disk - and make sure you note which objects have been processed to avoid looping in the same set of objects.
- Heap processing is IO bound
https://www.youtube.com/watch?v=sUV-be-tKhA
It Scales Until It Doesn't (Page last updated December 2018, Added 2019-02-25, Author Yaroslav Yermilov, Dmitry Tiagulskyi, Publisher Devoxx). Tips:
- Encoding large datasets which has repeated subsets by mapping the subsets into encoded values lets you reduce the size of the dataset being stored for processing
- Perfect hashing can be obtained by hashing the full set of elements with a seed, and then redoing with a new seed if there are any collisions - and repeating until there are no more collisions.
- With perfect hashing, you don't need to store keys, you can store a checksum of the key.
- Off-heap memory mapped files let you efficiently store more than can be stored in memory.
- Look for the resources that are saturated under load to find the bottleneck in the system.
- Different hardware is more optimal for different types of processing.
- Your JVM process with heap should fit unto one NUMA node is at all possible.
- Check the baseline of using null operations to determine how fast the the processing could be theoretically if you could optimize the processing optimally.
- Measure variability and try to explain it
https://www.youtube.com/watch?v=jyjtcw8Y6Nc
Java Performance Testing for Everyone (Page last updated November 2018, Added 2019-02-25, Author Shelley Lambert, Publisher EclipseCon). Tips:
- Measurements: throughput - number of transactions; latency - time for single transactions; capacity - number of simultaneous transactions; utilization - resource consumption; efficiency - throughput/utilization; scalability - throughput or capacity as resources and requests increase; degradation - latency or throughput as requests increase.
Jack Shirazi
Back to newsletter 219 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/newtips219.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us