Introduction to Application Performance Tuning
Sunny Chan
Agenda
Why should we measure application performance?
How do we measure?
Tools of the trade
Pitfalls
Demos
Why should We Measure?
Why should we measure
Throughput and Latency
Throughput is the amount of work (e.g. transactions, calculations, data transferred) your system can handle, in a period of time.
Latency is the time it takes for a system to receive the response for a request
High Throughput
DOES NOT necessarily means �Low Latency!
Other performance characteristics
Performance Engineering for the system should be an integral part of software development process at all stages.
Benchmarking
Benchmark is the standard or reference program against which allow the system performance is being evaluated and compared.
A good benchmark should:
Highly Recommended talks from Gil Tene, CTO of Azul - he has plenty of talks on this topic
Beware of Microbenchmarking
Beware of Microbenchmarking
public class Mutlplication {� public static void main(String args[]) {� Random rand = new Random();� int numberToMultiply = 1000;� final double x = rand.nextLong();� final double y = rand.nextLong();� long start = System.nanoTime();� for (int i=0; i<numberToMultiply; i++) {� double v = x * y;� }� long timeTaken = System.nanoTime() - start;� System.out.println( "Multiplying"+numberToMultiply+" integers took "+timeTaken+"nanos");� }�}
No of multiplication | Time Taken (nanos) |
1000 | 9147 |
10000 | 10393 |
100000 | 810765 |
1000000 | 1372031 |
10000000 | |
100000000 | |
1000000000 | |
Ways to make correct measurements
How to find performance issue in your application
Types of profiler
Sampling Profiler
Instrumentation Profiler
Heisenberg Uncertainty Principle
The uncertainty principle, also known as Heisenberg's indeterminacy principle, is a fundamental concept in quantum mechanics. It states that there is a limit to the precision with which certain pairs of physical properties, such as position and momentum, can be simultaneously known. In other words, the more accurately one property is measured, the less accurately the other property can be known.
Java Flight Recorder
Async Profiler
Logging, Metrics and Tracing
Tools that you should be aware of:
Prometheus, Elastic, OpenTelemetry, Micrometer metrics, Zipkins
Three Key Takeaways
Performance Measurement allows you to make sense of the throughput and latency of your application
“Fast” is a loaded word in performance world - be careful!
A good benchmark is an important tool to help you fix performance issue before production
Be aware of the pitfall!
We have many Performance measuring tool built into Java platform - use them wisely!
Beware of the overhead of collecting measurement
Thank you
Linked-in