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 January 2017
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 194 contents
https://dzone.com/articles/java-gc-causes-distilled
Java GC Causes Distilled (Page last updated January 2017, Added 2017-01-30, Author Artem Dmitriev, Publisher DZone). Tips:
- GC events and causes are shown in the GC Logs files, which can be enabled with the -Xloggc:/path/to/file JVM flag.
- You can start JVM with the -XX:+DisableExplicitGC flag to disable GCs getting triggered from application calls to System.gc().
- Adaptive Size Ergonomics in most cases improves overall GC performance, but at the cost of more variability in GCs. Enabled by default, it can be turned off with -XX:-UseAdaptiveSizePolicy
- The allocation profiler is enabled with -Xaprof.
http://www.developer.com/java/data/solving-java-issues-cpu-maxes-out-and-utilization-never-goes-down.html
Solving Java Issues: CPU Maxes Out and Utilization Never Goes Down (Page last updated October 2016, Added 2017-01-30, Author Ram Lakshmanan, Publisher Developer.com). Tips:
- Repeated full GCs (typically because all the heap is used, often because of a memory leak but sometimes because it's just sized too small) normally maxes CPU while the JVM does very little actual application work. You can diagnose this by seeing consecutive full GCs in any tool that monitors GC. Best handled by taking a heap dump (or at least a class histogram if time and space is limited) and identifying what is taking so much space.
- If you have threads looping, you should take a couple of thread dumps with some interval between, and look for threads in the runnable state that are executing but not progressing.
- A common concurrency error is multi-threaded use of Hashmap. You can hit the consequent consurrency bug which consists of a put() call looping forever - to diagnose it you will have a thread using a full core all the time and then use the technique of taking multiple thread dumps and seeing the thread not progressing beyod this method.
https://www.infoq.com/presentations/microservices-monolith
Low Latency Microservices in Java (Page last updated September 2016, Added 2017-01-30, Author Peter Lawrey, Publisher QCon). Tips:
- 40ms is roughly people limit of perception - people can't notice changes faster than that.
- If you are considering timescales of 10 microseconds and lower, you need to architect for cores to run independently - so you need to understand the data in the shared CPU cache, and use thread affinity to keep specific operations on specific cores.
- UDP is the best option for a high fan out of data.
- Ensuring data locality is difficult - keep the dataset as small as possible and minimize your allocation rate.
- You can bypass the operating system for optimal performance including the scheduling, network IO and disk IO.
https://www.infoq.com/presentations/patterns-distributed-systems
Distributed Systems in Practice, in Theory (Page last updated September 2016, Added 2017-01-30, Author Aysylu Greenberg, Publisher QCon). Tips:
- A Staged Event Driven Pipeline has a controller which can monitor the input and output of requests and then add workers or pushback as needed to prevent overload of the system.
- A persistent queue between stages of a pipeline allows you to smooth tasks processing rate so that each stage can be fully utilised while also robustly handling outages.
- Leases allow multiple readers to concurrently access a system while forcing writers to access exclusively, and works for distributed systems. The length of the Lease is a tradeoff: short leases lets the system react quickly to failure and reduces false sharing; long leases lets you minimize context changes and interrupts. Leases work well for liveness detection instead of heartbeats.
- A tried and tested way to get results faster is to drop accuracy where an approximate answer is good enough. This can also work for resilience, by allowing some level of partial failure to still provide an overall successful result.
Jack Shirazi
Back to newsletter 194 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/newtips194.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us