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 August 2024
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 285 contents
https://www.youtube.com/watch?v=Yc5wnnqjVcA
From Problem to Performance: A Case Study on Java Performance (Page last updated August 2024, Added 2024-08-26, Author Lennart ten Wolde, Publisher J-Spring). Tips:
- Your testing needs to use similar volumes and variety of data as your production will, or you will miss bottlenecks that will show in production.
- There are always more bottlenecks. You stop fixing when performance is adequate, but there will still be more bottlenecks.
- Batching is often a useful optimization.
- Monitor the connection pool especially to avoid overloading it - apply backpressure to prevent trying to take too many connections.
- Validate that your change is actually being applied, modern systems are complex and use many 3rd party frameworks which may not be changing the way you expect with a change.
- Collect metrics to help analysing the system, especially to help narrow down which subsystem has a problem.
https://www.youtube.com/watch?v=Jgycs5ZVUXo
Mastering Java Performance: From Monitoring to Profiling (Page last updated August 2024, Added 2024-08-26, Author Lennart ten Wolde, Publisher J-Spring). Tips:
- Typically most of the time the CPU is waiting for data. If the data is in CPU cache it waits far less than if the data is further away (RAM, disk, network).
- Ensure you are obtaining metrics, and do load tests.
- Common bottlenecks are from inefficient database calls, too many database calls, too many or too long http calls, overloaded connection pools and thread pools.
- Compare performance tests over time to see if there are performance regressions.
- Types of performance tests: Average load - the expected representative load; stress - test at expected peak loads; breakpoint - find where the application fails and why; soak - moderate to high load for an extended period.
- Common database interaction bottlenecks: database indexes not efficient for the queries used including case sensitivity; too many indexes slowing down writes; too many individual queries instead of using batch queries for groups of data; individual inserts instead of bulk insertion; inefficient queries especially with joins; too much use of wildcards.
- Common concurrency bottlenecks: mismatch between connection pool size and thread/worker pool size; transaction scope too wide and including slow code; lazily fetching synchronously from a database instead of eagerly fetching asynchronously then using the data; web service thread/worker pool not large enough to handle the request load, or too large for the available CPU cores.
- Java value objects can improve memory access by keeping object data close together in the cache rather than in the heap and needing a RAM access.
https://www.youtube.com/watch?v=bHZ008Ul8kA
Effective Performance Engineering at Twitter-Scale (Page last updated June 2024, Added 2024-08-26, Author Yao Yue, Publisher InfoQ). Tips:
- Modern systems are very complex and getting more complex. To manage that complexity, performance engineering starts at a high level - knowing the limitations imposed by the hardware tells you the fastest a system can process, so your actual performance can be compared to that and this tells you by how much you can increase performance.
- To start with, focus on the things that cannot be changed easily, because if you need to change any of those, any other optimizations might get thrown away.
- What you care about ultimately is how the resources are used. Obtain metrics on how resources are being used, across the various layers of the system.
- For analysing distributed systems, you need traces of the request flow through the system so that you can identify where resource usage is suboptimal. Trace data allows you to build a model of your system and see system dependencies, how many hops requests make, which hardware they depend on, and allows what-if questions such as moving or decomposing services.
Jack Shirazi
Back to newsletter 285 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/newtips285.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us