SlideShare a Scribd company logo
Performance? That's what version 2 is for!


Eduard Tudenhöfner
Performance? That's what version 2 is for!

Overview
►   Introduction / Motivation

►   Performance Issues & Solution Strategies


►   How to proactively reduce risk of Performance Issues?


►   Conclusion
Introduction / Motivation
Why is performance important?



                                      Trustworthy
        Real User Experience
                                                USABILITY
                               Profit
             Performance                                    Monitoring
                 Maintenance                 SPEED MATTERS
Success Factor  Stress
      Bottlenecks
                                           Revenue      Economical
                Efficiency
     Less Resources             Stability     Security

  Conversion Rate FASTERSatisfied customers SPEED SLA Monitoring
                                        More
                  Higher Fault Tolerance      BETTER
     Key Performance Indicators               Reputation
                                           SALES
Why is performance important?



A page that was 2 seconds slower      400 ms delay cause 0.59% drop
         results in a 4.3%                   in searches/user
      drop in revenue/user
              (Bing)                             (Google)


    400 ms slowdown cause           Introducing gzip compression resulted
   5-9% drop in full-page traffic   in 13-25% speedup and cut outbound
                                            network traffic by 50%
             (Yahoo)                               (Netflix)
                                                            Source: www.stevesouders.com




                  Investing in Performance
                        really pays off
Consequences of Poor Performance

Consequences
►   Damaged customer relations
      –   Reputation of the company suffers
      –   People will continue to associate poor performance with the product, even when
          the issue is fixed later on


►   Lost income & Delayed project schedules
      –   Revenue is lost
      –   Penalties have to be paid due to late delivery


►   Increased development & maintenance costs
      –   Delivering features requires more time and effort if performance issues are
          hindering the acceptance of those features
      –   Additional time and resources are required if performance issues are found
Consequences of Poor Performance

The cost to fix a performance issue
►   Is a Technical Debt (defined by Ward
    Cunningham)
       – doing things the quick&dirty way sets us
          up with technical debt


      –   technical debt incurs interest payments
          (in the form of additional effort)


      –   The later technical debt is payed         Source: Steven Haines. Pro Java EE 5: Performance Management
                                                                            and Optimization
          back, the higher the interest will be


►   So should we pay huge interest at the end or
    pay back technical debt every development
    cycle?
Performance Issues & Solution Strategies
Performance Issues & Solution Strategies



                      Application Server




 Client




              Databases
                                     Legacy Systems / Service Provider
Performance Issues & Solution Strategies



                      Application Server




                                                     Application
 Client




              Databases
                                     Legacy Systems / Service Provider
Performance Issues & Solution Strategies



                      Application Server




                                                     Application
 Client




              Databases
                                     Legacy Systems / Service Provider
Performance Issues & Solution Strategies

Client (UI / Browser)
►   Bloated Clients


►   Very expensive DOM manipulations


►   Too many requests required until a page is fully loaded
      – Time to first impression

      –   JavaScript files are at the wrong places


►   Unsuitable communication patterns
      –   long running synchronous calls that block the UI


►   Network bandwidth
      –   especially in the mobile area
Performance Issues & Solution Strategies
                                           done with: www.webpagetest.org
                                           Chrome / DSL (1.5 Mbps/384Kbps)
                                                   50ms RTT
Performance Issues & Solution Strategies
                                                    done with: www.webpagetest.org
                                                    Chrome / DSL (1.5 Mbps/384Kbps)
                                                            50ms RTT

                                     DOM complete
                                      after 2.6 s




                                               Rendering starts
                                                  after 3.4 s


                 49 requests
                                                two uncompressed
                                                     images



                                                       3.9 s till page
                                                       is fully loaded
Performance Issues & Solution Strategies

Solution Approach
►   Reducing RTTs by
      – Reducing number of resources

      –   Avoiding bad requests
      –   Minimizing redirects
      –   Combining CSS / JS resources (e.g. during build process)
►   Reducing Request overhead by
      –   Using compression (gzip, deflate)
      –   Minifying CSS / JS resources (cssminifier.com, jscompress.com)
►   Placement of CSS and JS files
      –   CSS at the top / JS at the bottom
           ●   browser should start rendering as early as possible (user perceives a faster loading
               page)
           ●   anything below the script is blocked from rendering and downloading until after the
               script is loaded (even when threads are available)→ entire page is delayed
Performance Issues & Solution Strategies

How to achieve that in Java (e.g. in JSF)?
►   JAWR (jawr.java.net)
      – Built-in minification

      –   Enforced caching
      –   Bundling of resources
      –   CSS image sprite generation
      –   Can be integrated in Ant / Maven
      –   Can be used with (JSF, Spring MVC, Wicket, Grails, ...)
Performance Issues & Solution Strategies
                                                         source: jawr.java.net

   JAWR




What we would     How we want             How we can define
like to achieve    to structure             files bundles
                     our work
Performance Issues & Solution Strategies



                      Application Server




                                                     Application
 Client




              Databases
                                     Legacy Systems / Service Provider
Performance Issues & Solution Strategies

Application Server / Application                                               eden
►   Memory issues
      – Memory leaks / OutOfMemoryErrors (but not every leak leads to OOME)   survivor
                                                                              survivor
      –   Unnecessary creation of expensive objects
      –   Static fields and Lists / ThreadLocal usage within AppServer
      –   inappropriate GC strategy / Heap sizing (for generational GC)
                                                                               old

►   Caching
      –   Wrong caching strategy
      –   Too much or the wrong stuff is cached                                perm


►   Remote boundaries too fine-grained
      –   remote communication often done transparently for the developer
      –   increased round trips
      –   increased serializations/deserializations
Performance Issues & Solution Strategies

Application Server / Application
►   Synchronization issues
      – synchronized blocks are too wide (method locks vs block locks) → code is locked that
         is not necessary
      –   issue will not be present when doing tests with a small number of users
      –   can't scale when number of requests grows (the surprise comes when doing load tests
          or putting application to production)
      –   not taking advantage of lock-free data structures (java.util.concurrent.atomic)


►   Verbose Logging      log.debug("Starting " + getInstName() + "/" + getInst());
      –   What is the cost of getInstName() and getInst()?
      –   too much is logged / unnecessary string concatenations


►   Not taken advantage of the possiblities of the underlying containers (Web, EJB, …)
      –   unsuitable pool sizes (Thread Pools, EJB Pools, Connection Pools, …)
Performance Issues & Solution Strategies

Solution Approaches                                                                           eden
►   Memory
      – Generation sizing (for generational GC)                                              survivor
           ●   -XX:NewRatio=3 → 1:3 (Young:Old) → Young takes ¼ of what was specified        survivor
               with -Xmx
           ●   Sizing proportion between Old/Young generation is important for performance
           ●   e.g. if too many short-lived objects are created, they are moved to the old
               generation
                                                                                              old
           ●   An oversized young generation can also cause performance problems
                 –Space on old generation is reserved for emergencies (so that all objects
                  can be copied)
           ●   Memory analysis with e.g. VisualVM, -verbose:gc

                                                                                              perm
      –   ThreadLocal variables in an application server
           ●   Threads are reused but data is kept
           ●   Need to delete ThreadLocal variables before thread is reused by application
               server


      –   Static fields and Lists
           ●   Best Approach: use only for data that never changes
Performance Issues & Solution Strategies

VisualVM with VisualGC Plugin
Performance Issues & Solution Strategies

Solution Approaches                                                                              eden
►   Memory
      – Generation sizing (for generational GC)                                                 survivor
           ●
               -XX:NewRatio=3 → 1:3 (Young:Old) → Young takes ¼ of what was specified           survivor
               with -Xmx
           ●
               Sizing proportion between Old/Young generation is important for performance
           ●
               e.g. if too many short-lived objects are created, they are moved to the old
               generation                                                                        old
           ●
               An oversized young generation can also cause performance problems
                 –   Space on old generation is reserved for emergencies (so that all objects
                     can be copied)
           ●
               Memory analysis with e.g. VisualVM, -verbose:gc
                                                                                                 perm
      –   ThreadLocal variables in an application server
           ●
               Threads are reused but data is kept
           ●
               Need to delete ThreadLocal variables before thread is reused by application
               server


      –   Static fields and Lists
           ●
               Best Approach: use only for data that never changes
Performance Issues & Solution Strategies

Solution Approaches
►   Remote boundaries
      – Decrease number of remote calls → „The best call is the call that is not
        done“
      –   Boundaries should be more coarse-grained e.g. by using wrapper classes
          (of course that contain only the really required information)
      –   Depending on the communication parties (heterogeneous/homogeneous),
          the right protocol should be used


►   Logging
      –   carefully plan what to log and on which level
              => Log messages should have the ability to run fast in production
              environment and at same time help in identifying any issue in QA and
              TEST environment
Performance Issues & Solution Strategies



                      Application Server




                                                     Application
 Client




              Databases
                                     Legacy Systems / Service Provider
Performance Issues & Solution Strategies

Databases (from an application's point-of-view)
►   More / Less data is retrieved than actually required


►   Same data is retrieved over and over again (n+1 query problem)

►   High normalization good for reducing redundancy, but bad for performance


►   Inappropriate connection pool sizes


►   Usage of O/R mappers
      – can lead to unexpected behavior if used in a wrong way

      –   possibilities of JPA framework not known or not used efficiently
Performance Issues & Solution Strategies

Solution Approaches
►   Data Retrieval
      – Read-Only queries (query.setHint(“eclipselink.read-only“, “true“) )

           ●
               improves performance by avoiding copying and change tracking the objects
      –   Fetch Joins
      –   Batch Reads
      –   Other loading optimizations
           ●
               Use projection queries where appropriate
           ●
               Use pagination for large result sets (query.setMaxResults(), query.setFirstResults())
           ●
               Use named queries (likely to be precompiled by provider, reusability)


►   Updating Data
      –   Batch Update
           ●
               allows a bunch of update operations to be performed as a single DB access
           ●
               reduces round trips to the database
            <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
Performance Issues & Solution Strategies

 Fetch Joins - Example
Query query = em.createQuery(“SELECT po from PurchaseOrder po WHERE
             po.status = 'ACTIVE' AND po.customer.address.city = 'Stuttgart'”);

List<PurchaseOrder> orders = query.getResultList();

for (PurchaseOrder order: orders) {
   order.getCustomer().getName();
}

         {returns N purchase orders} → 100 positions = 101 SQLs


         Better:
SELECT po from PurchaseOrder po FETCH JOIN po.customer...


          {returns N purchase orders} → 100 positions = 1 SQL

→ related objects will be joined into the query instead of being queried independently
Performance Issues & Solution Strategies

 Batch Reads - Example
Query query = em.createQuery(“SELECT po from PurchaseOrder po WHERE
             po.status = 'ACTIVE' AND po.customer.address.city = 'Stuttgart'”);

query.setHint(“eclipselink.batch”, “po.customer”);

...

         {returns N purchase orders} → 100 positions = 2 SQLs
                                       (one additional for each relationship)



 → subsequent queries of related objects can be optimized in batches instead of
    being retrieved one-by-one


 → Batch reading is more efficient than joining because it avoids reading
    duplicate data.
Performance Issues & Solution Strategies

Solution Approaches
►   Data Retrieval
      – Read-Only queries (query.setHint(“eclipselink.read-only“, “true“) )

           ●   improves performance by avoiding copying and change tracking the objects
      –   Fetch Joins
      –   Batch Reads
      –   Other loading optimizations
           ●   Use projection queries where appropriate
           ●
               Use pagination for large result sets (query.setMaxResults(), query.setFirstResults())
           ●   Use named queries (likely to be precompiled by provider, reusability)


►   Updating Data
      –   Batch Update
           ●
               allows a bunch of update operations to be performed as a single DB access
           ●   reduces round trips to the database
           <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
Performance Issues & Solution Strategies



                      Application Server




                                                     Application
 Client




              Databases
                                     Legacy Systems / Service Provider
Performance Issues & Solution Strategies

Legacy Systems / Service Provider
►   They are often out ouf our control


►   Legacy Systems
      – often very difficult to troubleshoot legacy systems

      –   running dinosaurs
      –   limited insight into those systems
►   Service Providers
      – No influence on them

      –   SLAs
How to proactively reduce risk of Performance Issues?
How to proactively reduce risk of Performance Issues?

Pragmatic Solution Approach
►   1. From a general point-of-view
       – Define someone that is responsible for Performance Management in the project

      –   Identify Performance Risks early
      –   Define Performance Objectives (measurable & realistic)
           ●
               otherwise there is a risk that objectives are simply ignored because too
               difficult to achieve
      –   Conduct Architectural Reviews (continually)
           ●
               to find out whether the architecture is really capable of meeting performance
               objectives
      –   Do Performance Tests (before application goes to production)
      –   Monitor your Application (especially in PreProduction & Production)
           ●
               to find out how the application is really used (application usage pattterns)
           ●
               to identify trends (important for capacity planning)
      –   Know your users
How to proactively reduce risk of Performance Issues?

Pragmatic Solution Approach
►   2. From a technical point-of-view
       – Know the used technologies

      –   Always look out for possible performance improvements in those technical
          areas
           ●   Important: analyze the effects of „improvements“ and „Best Practices“
      –   Pay back technical debt as soon as possible
      –   Add small performance tests and not just unit tests (and automate them)
Conclusion

Conclusion
►   Investing time & money in performance really pays off


►   There needs to be someone responsible for APM


►   Performance issues can reside anywhere in an architecture
      – Architectural reviews, performance tests, aware
          developers/architects/testers can help in reducing the risk


►   From the managements point-of-view it seems that performance engineering
    seems to cause initially more costs than bringing value
      –   Problem: difficult to demonstrate success, but poorly performing
          applications are clearly observable as failures
          “Why do we have performance engineers
          if we don't have performance problems?”            by Connie U. Smith
Thank you for your Attention!


Please also have a look at the PERT Wiki space at
https://www.adesso.de/wiki/index.php/PERT



PERT@adesso.de
eduard.tudenhoefner@adesso.de
www.adesso.de

More Related Content

Viewers also liked

Hamlet, Act IV
Hamlet, Act IVHamlet, Act IV
Hamlet, Act IV
Mohammed Raiyah
 
Hamlet, ACT II
Hamlet, ACT IIHamlet, ACT II
Hamlet, ACT II
Mohammed Raiyah
 
Hamlet, ACT I
Hamlet, ACT IHamlet, ACT I
Hamlet, ACT I
Mohammed Raiyah
 
Hamlet, Act V
Hamlet, Act VHamlet, Act V
Hamlet, Act V
Mohammed Raiyah
 
The Necklace by Guy de Maupassant
The Necklace by Guy de Maupassant The Necklace by Guy de Maupassant
The Necklace by Guy de Maupassant Mohammed Raiyah
 
2012_11_28_Dont think about working at other companies_BeuthHS_Anne
2012_11_28_Dont think about working at other companies_BeuthHS_Anne2012_11_28_Dont think about working at other companies_BeuthHS_Anne
2012_11_28_Dont think about working at other companies_BeuthHS_AnneWooga
 
Pygmalion by George Bernard Shaw
Pygmalion by George Bernard Shaw Pygmalion by George Bernard Shaw
Pygmalion by George Bernard Shaw Mohammed Raiyah
 
Making a Systematic Business Case for Analytics
Making a Systematic Business Case for AnalyticsMaking a Systematic Business Case for Analytics
Making a Systematic Business Case for Analytics
Ashwin Malshe
 
NoSQL Games
NoSQL GamesNoSQL Games
NoSQL Games
Wooga
 
More than syntax
More than syntaxMore than syntax
More than syntax
Wooga
 

Viewers also liked (10)

Hamlet, Act IV
Hamlet, Act IVHamlet, Act IV
Hamlet, Act IV
 
Hamlet, ACT II
Hamlet, ACT IIHamlet, ACT II
Hamlet, ACT II
 
Hamlet, ACT I
Hamlet, ACT IHamlet, ACT I
Hamlet, ACT I
 
Hamlet, Act V
Hamlet, Act VHamlet, Act V
Hamlet, Act V
 
The Necklace by Guy de Maupassant
The Necklace by Guy de Maupassant The Necklace by Guy de Maupassant
The Necklace by Guy de Maupassant
 
2012_11_28_Dont think about working at other companies_BeuthHS_Anne
2012_11_28_Dont think about working at other companies_BeuthHS_Anne2012_11_28_Dont think about working at other companies_BeuthHS_Anne
2012_11_28_Dont think about working at other companies_BeuthHS_Anne
 
Pygmalion by George Bernard Shaw
Pygmalion by George Bernard Shaw Pygmalion by George Bernard Shaw
Pygmalion by George Bernard Shaw
 
Making a Systematic Business Case for Analytics
Making a Systematic Business Case for AnalyticsMaking a Systematic Business Case for Analytics
Making a Systematic Business Case for Analytics
 
NoSQL Games
NoSQL GamesNoSQL Games
NoSQL Games
 
More than syntax
More than syntaxMore than syntax
More than syntax
 

Similar to Performance? That's what version 2 is for!

Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
Betclic Everest Group Tech Team
 
Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)
camunda services GmbH
 
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
Teamstudio
 
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Amazon Web Services
 
Salesforce Performance hacks - Client Side
Salesforce Performance hacks - Client SideSalesforce Performance hacks - Client Side
Salesforce Performance hacks - Client Side
Paris Salesforce Developer Group
 
Performance Testing from Scratch + JMeter intro
Performance Testing from Scratch + JMeter introPerformance Testing from Scratch + JMeter intro
Performance Testing from Scratch + JMeter intro
Mykola Kovsh
 
Trouble with distribution
Trouble with distributionTrouble with distribution
Trouble with distribution
J On The Beach
 
Geek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPGeek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVP
IDERA Software
 
Tuenti Tech Teams. Frontend, Backend, Systems and more, working together
Tuenti Tech Teams. Frontend, Backend, Systems and more, working togetherTuenti Tech Teams. Frontend, Backend, Systems and more, working together
Tuenti Tech Teams. Frontend, Backend, Systems and more, working togetherTuenti
 
L21 scalability
L21 scalabilityL21 scalability
L21 scalability
Ólafur Andri Ragnarsson
 
Микола Ковш “Performance Testing Implementation From Scratch. Why? When and H...
Микола Ковш “Performance Testing Implementation From Scratch. Why? When and H...Микола Ковш “Performance Testing Implementation From Scratch. Why? When and H...
Микола Ковш “Performance Testing Implementation From Scratch. Why? When and H...
Dakiry
 
Dojo 1.0: Great Experiences For Everyone
Dojo 1.0: Great Experiences For EveryoneDojo 1.0: Great Experiences For Everyone
Dojo 1.0: Great Experiences For Everyone
slightlyoff
 
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
Rodolfo Kohn
 
Life on the Edge with ESI
Life on the Edge with ESILife on the Edge with ESI
Life on the Edge with ESI
Kit Chan
 
Tuenti teams - Php Conference
Tuenti teams - Php ConferenceTuenti teams - Php Conference
Tuenti teams - Php ConferenceGuille -bisho-
 
Grokking Techtalk #37: Data intensive problem
 Grokking Techtalk #37: Data intensive problem Grokking Techtalk #37: Data intensive problem
Grokking Techtalk #37: Data intensive problem
Grokking VN
 
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Nati Shalom
 
L12 Session State and Distributation Strategies
L12 Session State and Distributation StrategiesL12 Session State and Distributation Strategies
L12 Session State and Distributation Strategies
Ólafur Andri Ragnarsson
 
Running a Megasite on Microsoft Technologies
Running a Megasite on Microsoft TechnologiesRunning a Megasite on Microsoft Technologies
Running a Megasite on Microsoft Technologies
goodfriday
 
Building Low Cost Scalable Web Applications Tools & Techniques
Building Low Cost Scalable Web Applications   Tools & TechniquesBuilding Low Cost Scalable Web Applications   Tools & Techniques
Building Low Cost Scalable Web Applications Tools & Techniques
rramesh
 

Similar to Performance? That's what version 2 is for! (20)

Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
 
Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)
 
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
 
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
 
Salesforce Performance hacks - Client Side
Salesforce Performance hacks - Client SideSalesforce Performance hacks - Client Side
Salesforce Performance hacks - Client Side
 
Performance Testing from Scratch + JMeter intro
Performance Testing from Scratch + JMeter introPerformance Testing from Scratch + JMeter intro
Performance Testing from Scratch + JMeter intro
 
Trouble with distribution
Trouble with distributionTrouble with distribution
Trouble with distribution
 
Geek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPGeek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVP
 
Tuenti Tech Teams. Frontend, Backend, Systems and more, working together
Tuenti Tech Teams. Frontend, Backend, Systems and more, working togetherTuenti Tech Teams. Frontend, Backend, Systems and more, working together
Tuenti Tech Teams. Frontend, Backend, Systems and more, working together
 
L21 scalability
L21 scalabilityL21 scalability
L21 scalability
 
Микола Ковш “Performance Testing Implementation From Scratch. Why? When and H...
Микола Ковш “Performance Testing Implementation From Scratch. Why? When and H...Микола Ковш “Performance Testing Implementation From Scratch. Why? When and H...
Микола Ковш “Performance Testing Implementation From Scratch. Why? When and H...
 
Dojo 1.0: Great Experiences For Everyone
Dojo 1.0: Great Experiences For EveryoneDojo 1.0: Great Experiences For Everyone
Dojo 1.0: Great Experiences For Everyone
 
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
 
Life on the Edge with ESI
Life on the Edge with ESILife on the Edge with ESI
Life on the Edge with ESI
 
Tuenti teams - Php Conference
Tuenti teams - Php ConferenceTuenti teams - Php Conference
Tuenti teams - Php Conference
 
Grokking Techtalk #37: Data intensive problem
 Grokking Techtalk #37: Data intensive problem Grokking Techtalk #37: Data intensive problem
Grokking Techtalk #37: Data intensive problem
 
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
 
L12 Session State and Distributation Strategies
L12 Session State and Distributation StrategiesL12 Session State and Distributation Strategies
L12 Session State and Distributation Strategies
 
Running a Megasite on Microsoft Technologies
Running a Megasite on Microsoft TechnologiesRunning a Megasite on Microsoft Technologies
Running a Megasite on Microsoft Technologies
 
Building Low Cost Scalable Web Applications Tools & Techniques
Building Low Cost Scalable Web Applications   Tools & TechniquesBuilding Low Cost Scalable Web Applications   Tools & Techniques
Building Low Cost Scalable Web Applications Tools & Techniques
 

Recently uploaded

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 

Performance? That's what version 2 is for!

  • 1. Performance? That's what version 2 is for! Eduard Tudenhöfner
  • 2. Performance? That's what version 2 is for! Overview ► Introduction / Motivation ► Performance Issues & Solution Strategies ► How to proactively reduce risk of Performance Issues? ► Conclusion
  • 4. Why is performance important? Trustworthy Real User Experience USABILITY Profit Performance Monitoring Maintenance SPEED MATTERS Success Factor Stress Bottlenecks Revenue Economical Efficiency Less Resources Stability Security Conversion Rate FASTERSatisfied customers SPEED SLA Monitoring More Higher Fault Tolerance BETTER Key Performance Indicators Reputation SALES
  • 5. Why is performance important? A page that was 2 seconds slower 400 ms delay cause 0.59% drop results in a 4.3% in searches/user drop in revenue/user (Bing) (Google) 400 ms slowdown cause Introducing gzip compression resulted 5-9% drop in full-page traffic in 13-25% speedup and cut outbound network traffic by 50% (Yahoo) (Netflix) Source: www.stevesouders.com Investing in Performance really pays off
  • 6. Consequences of Poor Performance Consequences ► Damaged customer relations – Reputation of the company suffers – People will continue to associate poor performance with the product, even when the issue is fixed later on ► Lost income & Delayed project schedules – Revenue is lost – Penalties have to be paid due to late delivery ► Increased development & maintenance costs – Delivering features requires more time and effort if performance issues are hindering the acceptance of those features – Additional time and resources are required if performance issues are found
  • 7. Consequences of Poor Performance The cost to fix a performance issue ► Is a Technical Debt (defined by Ward Cunningham) – doing things the quick&dirty way sets us up with technical debt – technical debt incurs interest payments (in the form of additional effort) – The later technical debt is payed Source: Steven Haines. Pro Java EE 5: Performance Management and Optimization back, the higher the interest will be ► So should we pay huge interest at the end or pay back technical debt every development cycle?
  • 8. Performance Issues & Solution Strategies
  • 9. Performance Issues & Solution Strategies Application Server Client Databases Legacy Systems / Service Provider
  • 10. Performance Issues & Solution Strategies Application Server Application Client Databases Legacy Systems / Service Provider
  • 11. Performance Issues & Solution Strategies Application Server Application Client Databases Legacy Systems / Service Provider
  • 12. Performance Issues & Solution Strategies Client (UI / Browser) ► Bloated Clients ► Very expensive DOM manipulations ► Too many requests required until a page is fully loaded – Time to first impression – JavaScript files are at the wrong places ► Unsuitable communication patterns – long running synchronous calls that block the UI ► Network bandwidth – especially in the mobile area
  • 13. Performance Issues & Solution Strategies done with: www.webpagetest.org Chrome / DSL (1.5 Mbps/384Kbps) 50ms RTT
  • 14. Performance Issues & Solution Strategies done with: www.webpagetest.org Chrome / DSL (1.5 Mbps/384Kbps) 50ms RTT DOM complete after 2.6 s Rendering starts after 3.4 s 49 requests two uncompressed images 3.9 s till page is fully loaded
  • 15. Performance Issues & Solution Strategies Solution Approach ► Reducing RTTs by – Reducing number of resources – Avoiding bad requests – Minimizing redirects – Combining CSS / JS resources (e.g. during build process) ► Reducing Request overhead by – Using compression (gzip, deflate) – Minifying CSS / JS resources (cssminifier.com, jscompress.com) ► Placement of CSS and JS files – CSS at the top / JS at the bottom ● browser should start rendering as early as possible (user perceives a faster loading page) ● anything below the script is blocked from rendering and downloading until after the script is loaded (even when threads are available)→ entire page is delayed
  • 16. Performance Issues & Solution Strategies How to achieve that in Java (e.g. in JSF)? ► JAWR (jawr.java.net) – Built-in minification – Enforced caching – Bundling of resources – CSS image sprite generation – Can be integrated in Ant / Maven – Can be used with (JSF, Spring MVC, Wicket, Grails, ...)
  • 17. Performance Issues & Solution Strategies source: jawr.java.net JAWR What we would How we want How we can define like to achieve to structure files bundles our work
  • 18. Performance Issues & Solution Strategies Application Server Application Client Databases Legacy Systems / Service Provider
  • 19. Performance Issues & Solution Strategies Application Server / Application eden ► Memory issues – Memory leaks / OutOfMemoryErrors (but not every leak leads to OOME) survivor survivor – Unnecessary creation of expensive objects – Static fields and Lists / ThreadLocal usage within AppServer – inappropriate GC strategy / Heap sizing (for generational GC) old ► Caching – Wrong caching strategy – Too much or the wrong stuff is cached perm ► Remote boundaries too fine-grained – remote communication often done transparently for the developer – increased round trips – increased serializations/deserializations
  • 20. Performance Issues & Solution Strategies Application Server / Application ► Synchronization issues – synchronized blocks are too wide (method locks vs block locks) → code is locked that is not necessary – issue will not be present when doing tests with a small number of users – can't scale when number of requests grows (the surprise comes when doing load tests or putting application to production) – not taking advantage of lock-free data structures (java.util.concurrent.atomic) ► Verbose Logging log.debug("Starting " + getInstName() + "/" + getInst()); – What is the cost of getInstName() and getInst()? – too much is logged / unnecessary string concatenations ► Not taken advantage of the possiblities of the underlying containers (Web, EJB, …) – unsuitable pool sizes (Thread Pools, EJB Pools, Connection Pools, …)
  • 21. Performance Issues & Solution Strategies Solution Approaches eden ► Memory – Generation sizing (for generational GC) survivor ● -XX:NewRatio=3 → 1:3 (Young:Old) → Young takes ¼ of what was specified survivor with -Xmx ● Sizing proportion between Old/Young generation is important for performance ● e.g. if too many short-lived objects are created, they are moved to the old generation old ● An oversized young generation can also cause performance problems –Space on old generation is reserved for emergencies (so that all objects can be copied) ● Memory analysis with e.g. VisualVM, -verbose:gc perm – ThreadLocal variables in an application server ● Threads are reused but data is kept ● Need to delete ThreadLocal variables before thread is reused by application server – Static fields and Lists ● Best Approach: use only for data that never changes
  • 22. Performance Issues & Solution Strategies VisualVM with VisualGC Plugin
  • 23. Performance Issues & Solution Strategies Solution Approaches eden ► Memory – Generation sizing (for generational GC) survivor ● -XX:NewRatio=3 → 1:3 (Young:Old) → Young takes ¼ of what was specified survivor with -Xmx ● Sizing proportion between Old/Young generation is important for performance ● e.g. if too many short-lived objects are created, they are moved to the old generation old ● An oversized young generation can also cause performance problems – Space on old generation is reserved for emergencies (so that all objects can be copied) ● Memory analysis with e.g. VisualVM, -verbose:gc perm – ThreadLocal variables in an application server ● Threads are reused but data is kept ● Need to delete ThreadLocal variables before thread is reused by application server – Static fields and Lists ● Best Approach: use only for data that never changes
  • 24. Performance Issues & Solution Strategies Solution Approaches ► Remote boundaries – Decrease number of remote calls → „The best call is the call that is not done“ – Boundaries should be more coarse-grained e.g. by using wrapper classes (of course that contain only the really required information) – Depending on the communication parties (heterogeneous/homogeneous), the right protocol should be used ► Logging – carefully plan what to log and on which level => Log messages should have the ability to run fast in production environment and at same time help in identifying any issue in QA and TEST environment
  • 25. Performance Issues & Solution Strategies Application Server Application Client Databases Legacy Systems / Service Provider
  • 26. Performance Issues & Solution Strategies Databases (from an application's point-of-view) ► More / Less data is retrieved than actually required ► Same data is retrieved over and over again (n+1 query problem) ► High normalization good for reducing redundancy, but bad for performance ► Inappropriate connection pool sizes ► Usage of O/R mappers – can lead to unexpected behavior if used in a wrong way – possibilities of JPA framework not known or not used efficiently
  • 27. Performance Issues & Solution Strategies Solution Approaches ► Data Retrieval – Read-Only queries (query.setHint(“eclipselink.read-only“, “true“) ) ● improves performance by avoiding copying and change tracking the objects – Fetch Joins – Batch Reads – Other loading optimizations ● Use projection queries where appropriate ● Use pagination for large result sets (query.setMaxResults(), query.setFirstResults()) ● Use named queries (likely to be precompiled by provider, reusability) ► Updating Data – Batch Update ● allows a bunch of update operations to be performed as a single DB access ● reduces round trips to the database <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
  • 28. Performance Issues & Solution Strategies Fetch Joins - Example Query query = em.createQuery(“SELECT po from PurchaseOrder po WHERE po.status = 'ACTIVE' AND po.customer.address.city = 'Stuttgart'”); List<PurchaseOrder> orders = query.getResultList(); for (PurchaseOrder order: orders) { order.getCustomer().getName(); } {returns N purchase orders} → 100 positions = 101 SQLs Better: SELECT po from PurchaseOrder po FETCH JOIN po.customer... {returns N purchase orders} → 100 positions = 1 SQL → related objects will be joined into the query instead of being queried independently
  • 29. Performance Issues & Solution Strategies Batch Reads - Example Query query = em.createQuery(“SELECT po from PurchaseOrder po WHERE po.status = 'ACTIVE' AND po.customer.address.city = 'Stuttgart'”); query.setHint(“eclipselink.batch”, “po.customer”); ... {returns N purchase orders} → 100 positions = 2 SQLs (one additional for each relationship) → subsequent queries of related objects can be optimized in batches instead of being retrieved one-by-one → Batch reading is more efficient than joining because it avoids reading duplicate data.
  • 30. Performance Issues & Solution Strategies Solution Approaches ► Data Retrieval – Read-Only queries (query.setHint(“eclipselink.read-only“, “true“) ) ● improves performance by avoiding copying and change tracking the objects – Fetch Joins – Batch Reads – Other loading optimizations ● Use projection queries where appropriate ● Use pagination for large result sets (query.setMaxResults(), query.setFirstResults()) ● Use named queries (likely to be precompiled by provider, reusability) ► Updating Data – Batch Update ● allows a bunch of update operations to be performed as a single DB access ● reduces round trips to the database <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
  • 31. Performance Issues & Solution Strategies Application Server Application Client Databases Legacy Systems / Service Provider
  • 32. Performance Issues & Solution Strategies Legacy Systems / Service Provider ► They are often out ouf our control ► Legacy Systems – often very difficult to troubleshoot legacy systems – running dinosaurs – limited insight into those systems ► Service Providers – No influence on them – SLAs
  • 33. How to proactively reduce risk of Performance Issues?
  • 34. How to proactively reduce risk of Performance Issues? Pragmatic Solution Approach ► 1. From a general point-of-view – Define someone that is responsible for Performance Management in the project – Identify Performance Risks early – Define Performance Objectives (measurable & realistic) ● otherwise there is a risk that objectives are simply ignored because too difficult to achieve – Conduct Architectural Reviews (continually) ● to find out whether the architecture is really capable of meeting performance objectives – Do Performance Tests (before application goes to production) – Monitor your Application (especially in PreProduction & Production) ● to find out how the application is really used (application usage pattterns) ● to identify trends (important for capacity planning) – Know your users
  • 35. How to proactively reduce risk of Performance Issues? Pragmatic Solution Approach ► 2. From a technical point-of-view – Know the used technologies – Always look out for possible performance improvements in those technical areas ● Important: analyze the effects of „improvements“ and „Best Practices“ – Pay back technical debt as soon as possible – Add small performance tests and not just unit tests (and automate them)
  • 36. Conclusion Conclusion ► Investing time & money in performance really pays off ► There needs to be someone responsible for APM ► Performance issues can reside anywhere in an architecture – Architectural reviews, performance tests, aware developers/architects/testers can help in reducing the risk ► From the managements point-of-view it seems that performance engineering seems to cause initially more costs than bringing value – Problem: difficult to demonstrate success, but poorly performing applications are clearly observable as failures “Why do we have performance engineers if we don't have performance problems?” by Connie U. Smith
  • 37. Thank you for your Attention! Please also have a look at the PERT Wiki space at https://www.adesso.de/wiki/index.php/PERT PERT@adesso.de eduard.tudenhoefner@adesso.de www.adesso.de