SlideShare une entreprise Scribd logo
1  sur  36
Performance Testing Java
      Applications


   Martin Thompson - @mjpt777
Watch the video with slide
                         synchronization on InfoQ.com!
                      http://www.infoq.com/presentations
                            /performance-testing-java

       InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
  Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Presented at QCon London
                       www.qconlondon.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
 - practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
What is Performance?
Throughput / Bandwidth
Latency / Response Time
Throughput vs. Latency

• How does an application cope
  under burst conditions?


• Are you able to measure
  queuing delay?




                                  Latency
• Back-off strategies and other
  effects
                                                   Typical
                                                   Possible

• Amortise the expensive
  operations – Smart Batching               Load
Performance Requirements
Performance Requirements

• What throughput and latency does your
  system require?
    Do you need to care?
    How will you be competitive?
    Does performance drive business?


• Investments start from a business plan
    Work with the business folk
    Set Transaction Budget limits


• As the business scales does the software
  scale in an economic fashion?
    Don’t limit design options
Decompose the Transaction Budget

• How much time is each layer in the
  architecture allowed?


• Do all technology choices pay their way?
    Think Aircraft or Spacecraft!


• Profile to ensure budget is enforced


• What happens when throughput
  increases?
                                             X µs Total with
    Queuing delay introduced?                Breakdown
    Scale out at constant latency?
How can we test
 Performance?
Types of Performance Testing

1. Throughput / Bandwidth Testing


2. Latency / Response Testing


3. Stress Testing


4. Concurrent / Contention Testing


5. Endurance / Soak Testing


6. Capacity Testing
Understand Algorithm Behaviour

• Need to model realistic scenarios
    Read to write ratios
    Distribution across data sets
    No single entity / item tests!


• Model based on production


• Are unbounded queries allowed?
   Deal in manageable chunks
The “Onion”

• Separation of Concerns is key
    Layer your architecture


• Test individual components


• Test assemblies of components with a
  focus on interactions
    Beware micro-benchmarking!


• Test core infrastructure
    Useful for catching upgrade issues


• Same patterns at different levels of scale
Know Your Platform/Infrastructure

• Stress test until breaking point
   Do things degrade gracefully?
   Do things crash?
   Order of the algorithms?



• What are the infrastructure capabilities?
   Profile to know relative costs of components
   Operations Per Second
   Bandwidth
   Latency
   Endurance



• What happens when redundant
  components take over?
When should we test
  Performance?
Performance Test & Profile

“Premature optimization is the root of all evil”
  – Donald Knuth / Tony Hoare


• What does “optimization” mean?
    Specialisation vs. Flexibility?
    Very different from knowing your
     system capabilities
    Test / profile early and often


• Integrate performance testing to CI
• Monitor production systems
• Change your development practices...
Development Practices

• Performance “Test First”


• Red, Green, Debug, Profile, Refactor...
    A deeper understanding makes you faster


• Use “like live” pairing stations


• Don’t add features you don’t need


• Poor performance should fail the build!
Performance Testing in Action
The Java Pitfalls

• Runtime Compiler
    JIT & On Stack Replacement (OSR)
    Polymorphism and In-lining
    Dead code elimination
    Race conditions in optimisation


• Garbage Collection
    Which collector - Dev vs. Production
    Skewed results from pauses
    Beware “Card Marking”


• Class Loading
Micro Benchmarking

• Framework should handle warm up


• Representative Data Sets
                                    public class MyBenchmark
    Vary set size                      extends Benchmark
                                    {
                                        public void timeMyOp(int reps)
                                        {
• Key Measures                              int i = reps + 1;
    Ops Per Second (per thread)            while (-–i != 0)
                                            {
    Allocation rates                           MyClass.myOperation();
                                            }
                                        }
                                    }
• Concurrent Testing
    Scaling effects with threads
    Queuing effects
Anatomy Of A Micro Benchmark

public class MapBenchmark
    extends Benchmark
{
    private int size;
    private Map<Long, String> map = new MySpecialMap<Long, String>();

    private long[] keys;
    private String[] values;

    // setup method to init keys and values

    public void timePutOperation(int reps)
    {
        for (int i = 0; i < reps; i++)
        {
            map.put(keys[i], values[i]);
        }
    }
}
Performance Testing Concurrent Components

• Straight Performance Tests
    Ramp number of threads for plotting scaling characteristics
    Measure Ops / Sec throughput – Averages vs. Intervals
    Measure latency for queuing effects


• Validating Performance Tests
    Check invariants and sequences
System Performance Tests
                                                  Observer

              Distributed Load
             Generation Agents




                         << XML / JSON /
                            Binary >>

 Vary numbers
and firepower!!!         Acceptance
                        Test Runners?
                                           System Under Test
System Performance Testing Analysis

• Build a latency histogram for given throughput
    Disruptor Histogram, HdrHistogram
    Investigate the outliers!


• Gather metrics from the system under test
    Design system to be instrumented
    Don’t forget the Operating System
    Plot metrics against latency and throughput
    Capacity planning from this is possible


• Generate micro-bursts
    They show up queuing effects at contention points
    Uncover throughput bottlenecks
Got a Performance Issue?
Performance Profiling

• Java Applications
    JVisualVM, YourKit, Solaris Studio, etc
    What is the GC doing?
    Learn bytecode profiling


• Operating System
    htop, iostat, vmstat, pidstat, netstat, etc.


• Hardware
    Perf Counters – perf, likwid, VTune


• Follow Theory of Constraints for what to tackle!
Performance Testing Lessons
Mechanical Sympathy

• Java Virtual Machines
    Garbage Collection
    Optimization
    Locks


• Operating Systems
    Schedulers
    Virtual Memory
    File Systems & IO


• Hardware
    Hardware capabilities and interactions
    Profile the counters for greater understanding
The Issues With “Time”

• NTP is prone to time correction
    Careful of System.currentTimeMillis()


• Monotonic time not synchronised across
  sockets
    System.nanoTime() is monotonic
    RDTSC is not an ordered instruction


• Not all servers and OSes are equal
    Pre Nehalem TSC was not invariant
    Older OSes and VT can be expensive
    Resolution is highly variable by OS/JVM
Beware Being Too Predictable

• CPU Branch Prediction
    Fake Orders
    Taking same path in code


• Cache hits
    Disk loaded into memory
    Memory loaded into CPU cache
    Application level caching
Beware YAGNI




               YAGNI
The “Performance Team” Anti-Pattern

• They struggle to keep up with rate of
  change


• Performance testing is everyone's
  responsibility


• Better to think of a “Performance Team”
  as a rotating R&D exercise


• Performance specialists should pair on
  key components and spread knowledge
Lame Excuses - “It’s only …”

• It is only start-up code...
     MTTF + MTTR


• It is only test code...
     Feedback cycles!


• It is only UI code...
     Read “High Performance Web Sites” by
      Steve Souders
Questions?

Blog: http://mechanical-sympathy.blogspot.com/
Twitter: @mjpt777
Links:
https://github.com/giltene/HdrHistogram
https://github.com/LMAX-
    Exchange/disruptor/blob/master/src/main/java/com/lmax/disruptor/collecti
    ons/Histogram.java
https://code.google.com/p/caliper/
http://grinder.sourceforge.net/
http://www.javaworld.com/javaworld/jw-08-2012/120821-jvm-performance-
    optimization-overview.html

Contenu connexe

Tendances

Shirly Ronen - rapid release flow and agile testing-as
Shirly Ronen - rapid release flow and agile testing-asShirly Ronen - rapid release flow and agile testing-as
Shirly Ronen - rapid release flow and agile testing-asAgileSparks
 
Adding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance TestAdding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance TestRodolfo Kohn
 
Context-Driven Performance Testing
Context-Driven Performance TestingContext-Driven Performance Testing
Context-Driven Performance TestingAlexander Podelko
 
Releasing fast code - The DevOps approach
Releasing fast code - The DevOps approachReleasing fast code - The DevOps approach
Releasing fast code - The DevOps approachMichael Kopp
 
Agile testing for agile sparks kanban clients
Agile testing for agile sparks kanban clientsAgile testing for agile sparks kanban clients
Agile testing for agile sparks kanban clientsYuval Yeret
 
Coverage Solutions on Emulators
Coverage Solutions on EmulatorsCoverage Solutions on Emulators
Coverage Solutions on EmulatorsDVClub
 

Tendances (17)

Shirly Ronen - rapid release flow and agile testing-as
Shirly Ronen - rapid release flow and agile testing-asShirly Ronen - rapid release flow and agile testing-as
Shirly Ronen - rapid release flow and agile testing-as
 
Adding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance TestAdding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance Test
 
Vaidyanathan Ramalingam Rca In Agile Conference Speech
Vaidyanathan Ramalingam Rca In Agile Conference SpeechVaidyanathan Ramalingam Rca In Agile Conference Speech
Vaidyanathan Ramalingam Rca In Agile Conference Speech
 
Vaidyanathan Ramalingam Trade Off Economics In Testing Conference Speech
Vaidyanathan Ramalingam Trade Off Economics In Testing Conference SpeechVaidyanathan Ramalingam Trade Off Economics In Testing Conference Speech
Vaidyanathan Ramalingam Trade Off Economics In Testing Conference Speech
 
Vaidyanathan Ramalingam Silicon India Testing Conference 2 July2011 Speech
Vaidyanathan Ramalingam Silicon India Testing Conference 2 July2011 SpeechVaidyanathan Ramalingam Silicon India Testing Conference 2 July2011 Speech
Vaidyanathan Ramalingam Silicon India Testing Conference 2 July2011 Speech
 
Vaidyanathan Ramalingam Software Testing Eco System Conference Speech
Vaidyanathan Ramalingam Software Testing Eco System Conference SpeechVaidyanathan Ramalingam Software Testing Eco System Conference Speech
Vaidyanathan Ramalingam Software Testing Eco System Conference Speech
 
Vaidyanathan Ramalingam Rca In Testing Conference Speech
Vaidyanathan Ramalingam Rca In Testing Conference SpeechVaidyanathan Ramalingam Rca In Testing Conference Speech
Vaidyanathan Ramalingam Rca In Testing Conference Speech
 
Vaidyanathan Ramalingam Agile Testing Conference Speech
Vaidyanathan Ramalingam Agile Testing Conference SpeechVaidyanathan Ramalingam Agile Testing Conference Speech
Vaidyanathan Ramalingam Agile Testing Conference Speech
 
Vaidyanathan Ramalingam Agile Conference Speech
Vaidyanathan Ramalingam Agile Conference SpeechVaidyanathan Ramalingam Agile Conference Speech
Vaidyanathan Ramalingam Agile Conference Speech
 
Vaidyanathan Ramalingam Waterfall Vs Agile Testing Conference Speech
Vaidyanathan Ramalingam Waterfall Vs Agile Testing Conference SpeechVaidyanathan Ramalingam Waterfall Vs Agile Testing Conference Speech
Vaidyanathan Ramalingam Waterfall Vs Agile Testing Conference Speech
 
Vaidyanathan Ramalingam Testing Checklist Conference Speech
Vaidyanathan Ramalingam Testing Checklist Conference SpeechVaidyanathan Ramalingam Testing Checklist Conference Speech
Vaidyanathan Ramalingam Testing Checklist Conference Speech
 
Vaidyanathan Ramalingam Agile Testing Leadership Lessons Softec 2 July2011
Vaidyanathan Ramalingam Agile Testing Leadership Lessons Softec 2 July2011Vaidyanathan Ramalingam Agile Testing Leadership Lessons Softec 2 July2011
Vaidyanathan Ramalingam Agile Testing Leadership Lessons Softec 2 July2011
 
Context-Driven Performance Testing
Context-Driven Performance TestingContext-Driven Performance Testing
Context-Driven Performance Testing
 
Chris brown ti
Chris brown tiChris brown ti
Chris brown ti
 
Releasing fast code - The DevOps approach
Releasing fast code - The DevOps approachReleasing fast code - The DevOps approach
Releasing fast code - The DevOps approach
 
Agile testing for agile sparks kanban clients
Agile testing for agile sparks kanban clientsAgile testing for agile sparks kanban clients
Agile testing for agile sparks kanban clients
 
Coverage Solutions on Emulators
Coverage Solutions on EmulatorsCoverage Solutions on Emulators
Coverage Solutions on Emulators
 

Similaire à Performance Testing Java Applications

Leveraging HP Performance Center
Leveraging HP Performance CenterLeveraging HP Performance Center
Leveraging HP Performance CenterMartin Spier
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance TestingC4Media
 
Know More About Rational Performance - Snehamoy K
Know More About Rational Performance - Snehamoy KKnow More About Rational Performance - Snehamoy K
Know More About Rational Performance - Snehamoy KRoopa Nadkarni
 
3 know more_about_rational_performance_tester_8-1-snehamoy_k
3 know more_about_rational_performance_tester_8-1-snehamoy_k3 know more_about_rational_performance_tester_8-1-snehamoy_k
3 know more_about_rational_performance_tester_8-1-snehamoy_kIBM
 
Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.Malinda Kapuruge
 
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App TestingSencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App TestingSencha
 
Podila mesos con-northamerica_sep2017
Podila mesos con-northamerica_sep2017Podila mesos con-northamerica_sep2017
Podila mesos con-northamerica_sep2017Sharma Podila
 
No Devops Without Continuous Testing
No Devops Without Continuous TestingNo Devops Without Continuous Testing
No Devops Without Continuous TestingParasoft
 
PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko Neotys
 
Integration testing in enterprises using TaaS
Integration testing in enterprises using TaaS Integration testing in enterprises using TaaS
Integration testing in enterprises using TaaS Anand Bagmar
 
Load testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerLoad testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerAndrew Siemer
 
Alexander Podelko - Context-Driven Performance Testing
Alexander Podelko - Context-Driven Performance TestingAlexander Podelko - Context-Driven Performance Testing
Alexander Podelko - Context-Driven Performance TestingNeotys_Partner
 
Tools. Techniques. Trouble?
Tools. Techniques. Trouble?Tools. Techniques. Trouble?
Tools. Techniques. Trouble?Testplant
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Startupfest
 
Monitoring Containerized Micro-Services In Azure
Monitoring Containerized Micro-Services In AzureMonitoring Containerized Micro-Services In Azure
Monitoring Containerized Micro-Services In AzureAlex Bulankou
 
3 Keys to Performance Testing at the Speed of Agile
3 Keys to Performance Testing at the Speed of Agile3 Keys to Performance Testing at the Speed of Agile
3 Keys to Performance Testing at the Speed of AgileNeotys
 

Similaire à Performance Testing Java Applications (20)

Leveraging HP Performance Center
Leveraging HP Performance CenterLeveraging HP Performance Center
Leveraging HP Performance Center
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance Testing
 
Know More About Rational Performance - Snehamoy K
Know More About Rational Performance - Snehamoy KKnow More About Rational Performance - Snehamoy K
Know More About Rational Performance - Snehamoy K
 
3 know more_about_rational_performance_tester_8-1-snehamoy_k
3 know more_about_rational_performance_tester_8-1-snehamoy_k3 know more_about_rational_performance_tester_8-1-snehamoy_k
3 know more_about_rational_performance_tester_8-1-snehamoy_k
 
Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.
 
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App TestingSencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
 
Podila mesos con-northamerica_sep2017
Podila mesos con-northamerica_sep2017Podila mesos con-northamerica_sep2017
Podila mesos con-northamerica_sep2017
 
Fundamentals Performance Testing
Fundamentals Performance TestingFundamentals Performance Testing
Fundamentals Performance Testing
 
No Devops Without Continuous Testing
No Devops Without Continuous TestingNo Devops Without Continuous Testing
No Devops Without Continuous Testing
 
PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko
 
Integration testing in enterprises using TaaS
Integration testing in enterprises using TaaS Integration testing in enterprises using TaaS
Integration testing in enterprises using TaaS
 
Training - What is Performance ?
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
 
Load testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerLoad testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew Siemer
 
Alexander Podelko - Context-Driven Performance Testing
Alexander Podelko - Context-Driven Performance TestingAlexander Podelko - Context-Driven Performance Testing
Alexander Podelko - Context-Driven Performance Testing
 
Tools. Techniques. Trouble?
Tools. Techniques. Trouble?Tools. Techniques. Trouble?
Tools. Techniques. Trouble?
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
 
JMeter
JMeterJMeter
JMeter
 
Monitoring Containerized Micro-Services In Azure
Monitoring Containerized Micro-Services In AzureMonitoring Containerized Micro-Services In Azure
Monitoring Containerized Micro-Services In Azure
 
Agile Testing Days
Agile Testing DaysAgile Testing Days
Agile Testing Days
 
3 Keys to Performance Testing at the Speed of Agile
3 Keys to Performance Testing at the Speed of Agile3 Keys to Performance Testing at the Speed of Agile
3 Keys to Performance Testing at the Speed of Agile
 

Plus de C4Media

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoC4Media
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileC4Media
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020C4Media
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsC4Media
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No KeeperC4Media
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like OwnersC4Media
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaC4Media
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideC4Media
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 

Plus de C4Media (20)

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No Keeper
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like Owners
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 

Dernier

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Dernier (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Performance Testing Java Applications

  • 1. Performance Testing Java Applications Martin Thompson - @mjpt777
  • 2. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /performance-testing-java InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month
  • 3. Presented at QCon London www.qconlondon.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 4.
  • 8. Throughput vs. Latency • How does an application cope under burst conditions? • Are you able to measure queuing delay? Latency • Back-off strategies and other effects Typical Possible • Amortise the expensive operations – Smart Batching Load
  • 10. Performance Requirements • What throughput and latency does your system require?  Do you need to care?  How will you be competitive?  Does performance drive business? • Investments start from a business plan  Work with the business folk  Set Transaction Budget limits • As the business scales does the software scale in an economic fashion?  Don’t limit design options
  • 11. Decompose the Transaction Budget • How much time is each layer in the architecture allowed? • Do all technology choices pay their way?  Think Aircraft or Spacecraft! • Profile to ensure budget is enforced • What happens when throughput increases? X µs Total with  Queuing delay introduced? Breakdown  Scale out at constant latency?
  • 12. How can we test Performance?
  • 13. Types of Performance Testing 1. Throughput / Bandwidth Testing 2. Latency / Response Testing 3. Stress Testing 4. Concurrent / Contention Testing 5. Endurance / Soak Testing 6. Capacity Testing
  • 14. Understand Algorithm Behaviour • Need to model realistic scenarios  Read to write ratios  Distribution across data sets  No single entity / item tests! • Model based on production • Are unbounded queries allowed?  Deal in manageable chunks
  • 15. The “Onion” • Separation of Concerns is key  Layer your architecture • Test individual components • Test assemblies of components with a focus on interactions  Beware micro-benchmarking! • Test core infrastructure  Useful for catching upgrade issues • Same patterns at different levels of scale
  • 16. Know Your Platform/Infrastructure • Stress test until breaking point  Do things degrade gracefully?  Do things crash?  Order of the algorithms? • What are the infrastructure capabilities?  Profile to know relative costs of components  Operations Per Second  Bandwidth  Latency  Endurance • What happens when redundant components take over?
  • 17. When should we test Performance?
  • 18. Performance Test & Profile “Premature optimization is the root of all evil” – Donald Knuth / Tony Hoare • What does “optimization” mean?  Specialisation vs. Flexibility?  Very different from knowing your system capabilities  Test / profile early and often • Integrate performance testing to CI • Monitor production systems • Change your development practices...
  • 19. Development Practices • Performance “Test First” • Red, Green, Debug, Profile, Refactor...  A deeper understanding makes you faster • Use “like live” pairing stations • Don’t add features you don’t need • Poor performance should fail the build!
  • 21. The Java Pitfalls • Runtime Compiler  JIT & On Stack Replacement (OSR)  Polymorphism and In-lining  Dead code elimination  Race conditions in optimisation • Garbage Collection  Which collector - Dev vs. Production  Skewed results from pauses  Beware “Card Marking” • Class Loading
  • 22. Micro Benchmarking • Framework should handle warm up • Representative Data Sets public class MyBenchmark  Vary set size extends Benchmark { public void timeMyOp(int reps) { • Key Measures int i = reps + 1;  Ops Per Second (per thread) while (-–i != 0) {  Allocation rates MyClass.myOperation(); } } } • Concurrent Testing  Scaling effects with threads  Queuing effects
  • 23. Anatomy Of A Micro Benchmark public class MapBenchmark extends Benchmark { private int size; private Map<Long, String> map = new MySpecialMap<Long, String>(); private long[] keys; private String[] values; // setup method to init keys and values public void timePutOperation(int reps) { for (int i = 0; i < reps; i++) { map.put(keys[i], values[i]); } } }
  • 24. Performance Testing Concurrent Components • Straight Performance Tests  Ramp number of threads for plotting scaling characteristics  Measure Ops / Sec throughput – Averages vs. Intervals  Measure latency for queuing effects • Validating Performance Tests  Check invariants and sequences
  • 25. System Performance Tests Observer Distributed Load Generation Agents << XML / JSON / Binary >> Vary numbers and firepower!!! Acceptance Test Runners? System Under Test
  • 26. System Performance Testing Analysis • Build a latency histogram for given throughput  Disruptor Histogram, HdrHistogram  Investigate the outliers! • Gather metrics from the system under test  Design system to be instrumented  Don’t forget the Operating System  Plot metrics against latency and throughput  Capacity planning from this is possible • Generate micro-bursts  They show up queuing effects at contention points  Uncover throughput bottlenecks
  • 28. Performance Profiling • Java Applications  JVisualVM, YourKit, Solaris Studio, etc  What is the GC doing?  Learn bytecode profiling • Operating System  htop, iostat, vmstat, pidstat, netstat, etc. • Hardware  Perf Counters – perf, likwid, VTune • Follow Theory of Constraints for what to tackle!
  • 30. Mechanical Sympathy • Java Virtual Machines  Garbage Collection  Optimization  Locks • Operating Systems  Schedulers  Virtual Memory  File Systems & IO • Hardware  Hardware capabilities and interactions  Profile the counters for greater understanding
  • 31. The Issues With “Time” • NTP is prone to time correction  Careful of System.currentTimeMillis() • Monotonic time not synchronised across sockets  System.nanoTime() is monotonic  RDTSC is not an ordered instruction • Not all servers and OSes are equal  Pre Nehalem TSC was not invariant  Older OSes and VT can be expensive  Resolution is highly variable by OS/JVM
  • 32. Beware Being Too Predictable • CPU Branch Prediction  Fake Orders  Taking same path in code • Cache hits  Disk loaded into memory  Memory loaded into CPU cache  Application level caching
  • 33. Beware YAGNI YAGNI
  • 34. The “Performance Team” Anti-Pattern • They struggle to keep up with rate of change • Performance testing is everyone's responsibility • Better to think of a “Performance Team” as a rotating R&D exercise • Performance specialists should pair on key components and spread knowledge
  • 35. Lame Excuses - “It’s only …” • It is only start-up code...  MTTF + MTTR • It is only test code...  Feedback cycles! • It is only UI code...  Read “High Performance Web Sites” by Steve Souders
  • 36. Questions? Blog: http://mechanical-sympathy.blogspot.com/ Twitter: @mjpt777 Links: https://github.com/giltene/HdrHistogram https://github.com/LMAX- Exchange/disruptor/blob/master/src/main/java/com/lmax/disruptor/collecti ons/Histogram.java https://code.google.com/p/caliper/ http://grinder.sourceforge.net/ http://www.javaworld.com/javaworld/jw-08-2012/120821-jvm-performance- optimization-overview.html