SlideShare une entreprise Scribd logo
1  sur  44
Developing B2 for
Performance and Scalability
               Noriaki Tatsumi
                Kevin Weisser
Why Performance Matters?


• User experience
  – Your users don’t like slow and unresponsive apps
  – Slow applications lose users in frustrations
  – Users tend to wander off beyond captive response
    time of 7 – 10 seconds
• User adoption
  – Google saw 25% decline in searches within 6
    weeks after introducing 0.5s delay (~$2.5B loss)
  – Wikia observed up to 20% user loss as the page
    load time reached 5 seconds
Wikia – Exit rate (abandon)
http://assets.en.oreilly.com/1/event/27/Varnish%20-%20A%20State%20of%20the%20Art%20High-Performance%20Reverse%20Proxy%20Presentation.pdf
“With great power comes great
      responsibility” – Uncle Ben, Spiderman
• Reputations at stake
• System resources are shared and limited
• B2s with scalability problem impacts system
  performance
  – System-wide performance degradation
  – Server downtime
What is an anti-pattern?


• Some repeated pattern of action, process or
  structure that initially appears to be beneficial,
  but ultimately produces more bad consequences
  than beneficial results
• A refactored solution exists that is clearly
  documented, proven in actual practice and
  repeatable.

  - Definition from Wikipedia
How can anti-patterns help?


• Prevents performance as an afterthought
• Helps identify performance issues that typically
  don’t arise until deployed in production
• Prevents pre-mature optimizations
How do I use anti-patterns?


• Identify and correct the occurrences of anti-
  patterns during:
  –   Design review
  –   Implementation/code review
  –   Execution of experiments and profiling
  –   Static code analysis
Top 10 violated high-level performance
anti-patterns fixed in Blackboard Learn™
      Inefficient Filtering


  Unnecessary Processing


               The Ramp


         Data Overreach

                                                     Frequency (%)
Unlimited Resource Usage


          Functional Bug


    Excessive Granularity


             More is Less

 Usage of Outdated Tools
        and APIs

 Mishandled Concurrency


                              0   5   10   15   20                   25   30
Top 10 violated low-level performance
anti-patterns fixed in Blackboard Learn™
                  Missing or non-optimal index [db]


                Inefficient or erroneous criteria [db]


                   Unnecessary data retrieval [app}


                 Too many objects in memory [app}


               Presentation of unlimited results [ui]

                                                                           Frequency (%)
                          Inefficient access path [ui]


                              No data caching [app}


Not releasing resource (immediately) after use [app}


          Incompatiblity with HA deployment [app}


                      Excessive DB round trips [app}


                                                         0   5   10   15                   20   25
Most violated high-level anti-pattern
         #1: Inefficient Filtering
• Description
  – Querying data using inefficient logic, algorithm, or
    technique
• Problem
  – Consumes resources that can be used by other
    processes
  – Increases execution/response time
• Solution
  – Store data in both centralized and organized manner
  – Search against smaller data set first, fail fast, and don’t
    look at unnecessary data
  – Leverage indexing and other efficient
    techniques/algorithms
Most violated high-level anti-pattern
          #1: Inefficient Filtering
Missing or non-optimal index (DB)
• Most violated low-level anti-pattern
• Problem
   – Missing appropriate index on search columns leads to
     inefficient data retrieval operation by SQL query optimizer
   – Having index can inversely add unnecessary overhead if the
     column is never used for searched criteria
• Solution
   – Analyze SQL execution plan to verify usage of proper index
   – Create index on foreign keys
   – Create unique index on unique columns
   – Use an index to eliminate unnecessary full-table or index
     scans to access small percentage of data on a large table
   – Use covering index for key lookup
Creating Database Objects with B2


• Release 9.1 SP1 and above
  – B2s authored by independent developers can now
    define and install schema elements
• Not enabled by default
  – Administrators must enable this functionality from
    the B2 management section of the admin panel
• Documentation
  – http://www.edugarage.com/display/BBDN/Creating+
    Database+Objects+with+Building+Blocks
Most violated high-level anti-pattern
          #1: Inefficient Filtering
Inefficient or erroneous criteria (DB)
• The second most violated low-level anti-pattern
• Problem
   – Duplicate, unnecessary, incorrect, or missing predicate
     checks and joins exist in SQL
   – Increases response time, system resource consumption, and
     locking
• Solution
   –   Be specific on what data you need
   –   Keep it simple and avoid unnecessary checks
   –   Use JOIN criteria that aligns with index
   –   Analyze execution plan to derive efficient and balanced query
Most violated high-level anti-pattern
          #1: Inefficient Filtering
Wrapping filtering column in a function (DB)
• Problem
  – The query optimizer does not see the column
  – Available index likely does not get used
• Solution
  – Rewrite query to avoid using function if possible
  – Format bind variables in application tier
Example of bad T-SQL function usage
             - Without -
Example of bad T-SQL function usage
          - With LOWER-
Example of bad T-SQL function usage
              - Comparison -



                     Without T-SQL function   With T-SQL function
Logical I/O reads    3                        3238
Estimated CPU cost   0.396307                 15.454153
Most violated high-level anti-pattern
           #1: Inefficient Filtering
Other low-level anti-pattern examples
•   Filtering larger query first
•   Implicit data type conversion
•   Inefficient CSS selectors
•   Inefficient DOM element lookup
•   Inefficient regex
•   Unnecessary query on VIEW instead of table
•   Usage of "NOT IN" comparison rather than JOIN
•   Usage of wrong index
•   Using UNION when returned records always unique
Most violated high-level anti-pattern
      #2: Unnecessary Processing
• Description
  – Processing when not needed or not needed at the time
  – Excessive or duplicate executions
• Problem
  – Consumes resources that can be used by important
    work
  – Increases execution/response time
• Solution
  – Remove, postpone (asynchronous), prioritize, or reorder
    the processing steps
  – Leverage caching to reuse loaded or calculated data
Most violated high-level anti-pattern
      #2: Unnecessary Processing
Presentation of Unlimited Results (UI Design)
• 5th most violated low-level anti-pattern
• Problem
  – Users typically do not consume all data when presented
    with large amount so the used resources are wasted
  – Severe system performance issue can arise depending
    on the volume of prepared results
• Solution
  – Paginate results
  – Guide users to narrow down search criteria
  – Limit amount of data that can be returned
Example usage of pagination and limiting
    the number of returned results
Most violated high-level anti-pattern
      #2: Unnecessary Processing
Inefficient access path (UI Design)
• 6th most violated low-level anti-pattern
• Problem
   – Room for optimization exists in actions/clicks users
     must take to complete his/her task
   – Results to creating additional work for the system
     (also impacts user’s time to task)
• Solution
   – Refactor UI or click path to let users accomplish
     their tasks more efficiently
Example of enhancing access path
Most violated high-level anti-pattern
      #2: Unnecessary Processing
Other low-level anti-pattern examples
• Excessive executions of maintenance task
• HTTP 404 error on cacheable static content
• Missing short-circuit logic
• No data caching
• No http caching
• Unnecessary cache reload
• Unnecessary conditional check
• Unnecessary object creation
• Updating unchanged data
Most violated high-level anti-pattern
              #3: The Ramp
• Description
  – Processing time increases or the system crashes as the
    application gets used over a period of time
• Problem
  – The application cannot handle the increased volume of
    data/traffic
  – Resource consumption increases or exhausts
• Solution
  – Select algorithms or data structures based on maximum
    size expected
  – Use algorithms/designs that adapt to the increasing size
    or doesn’t get effected by it (ex. flyweight
    pattern, streaming technique)
Most violated high-level anti-pattern
              #3: The Ramp
Too many objects in memory
• #4 most violated low-level anti-pattern
• Problem
   – Loading large amount of data or objects at once for
     processing can result to out-of-memory error and other
     system-level performance impact
   – Examples include unmarshalling entire DB resultset in
     heap and generation of large XML documents using
     DOM object
• Solution
   – Flyweight and lazy loading patterns
   – Streaming and chunking techniques
Example of streaming database result set
              - Overview -
• DataList/DataListIterator
   – Interface for a list/iterator data structure materialized
     from a data source, such as a database or a file
   – Extends the List/Iterator interface to leverage
     polymorphism
• ResultSetDataList
   – Implementation of DataList that’s materialized from a
     SQL resultset
   – Unmarshalls the resultset rows one by one as the getter
     method is called
• ResultSetDataListIterator
   – Iterator that’s materialized from ResultSetDataList
Example of streaming database result set
       - Usage considerations -
Avoid out-of-memory and SQL timeout
• Use ResultSet.TYPE_FORWARD_ONLY
• Set Statement fetch size
   – Default for Oracle JDBC = 10
   – Default for i-net MERLIA = 0
      • ‘0’ uses client cursor that reads all rows into memory
      • Specify fetch size to use cursor on server side
• Use flyweight pattern in the unmarshaller if possible
Example of streaming database result set
            - Code sample -
• See Appendix A
Most violated high-level anti-pattern
              #3: The Ramp
Not releasing resource (immediately) after use
• #8 most violated low-level anti-pattern
• Problem
  – Cause of connection leaks, deadlocks, performance
    degradation and other unexpected behavior
  – Threads, sockets, database connection, file
    handler, and other resources can be a victim
• Solution
  – Use finally block to ensure release
  – Release resource as quickly as possible
Example of resource management
              - CSContext -
CSContext csCtxt=null;
try {
    csCtxt = CSContext.getContext();
    // your code
} catch (Exception e) {
    csCtxt.rollback();
    csCtxt=null;
} finally {
    if (csCtxt!=null) {
    csCtxt.commit();
}
Most violated high-level anti-pattern
                #3: The Ramp
Other low-level anti-pattern examples
•   Exceeding max number of expressions in a list
•   No data caching
•   No priority logic
•   Not releasing resource (immediately) after use
•   Presentation of unlimited results
•   Transaction isolation unnecessarily wide
•   Unlimited cache storage
Low-level performance anti-patterns
    fixed in Blackboard Learn™ by tier

Application




 Database




                                      Frequency (%)
 UI Design




   Browser




  Network



              0   10   20   30   40                   50   60
Tools to identify anti-patterns:
             First line of defense
• Peer code review
  – Atlassian Crucible
  – Review Board
• Static code analyzer
  –   FindBugs
  –   PMD
  –   Sonar
  –   Custom rules
• Performance unit testing
  – JUnitPerf
Tools to identify anti-patterns:
                Deeper analysis
• Java
  – VisualVM
  – Memory Analyzer (MAT)
  – YourKit
• Browser
  –   Firebug
  –   Google Page Speed
  –   dynaTrace AJAX Edition
  –   Fiddler
  –   WebPagetest
Tools to identify anti-patterns:
             Deeper analysis
• Database
  – MS SQL Server
    • SQL Server Management Studio
    • SQL Server Profiler
    • Performance Dashboard
  – Oracle
    • SQL*Plus
    • Automatic Workload Repository (AWR)
    • Active Session History (ASH)
Takeaways


• The importance of performance and scalability
  for your B2
• Top violated performance anti-patterns in
  Blackboard Learn™
• Forensics Tools
Please provide feedback for this session by emailing
        DevConFeedback@blackboard.com.


           The title of this session is:
  Developing B2 for Performance and Scalability
Appendix A:
Example of streaming database result set
Example of streaming database result set
            - DataList.java -

public interface DataList<E> extends List<E>
{
  /**
   Closes the list and releases all of the resources that back
    the list
   */
  void close();
}
Example of streaming database result set
       - ResultSetDataList.java -
public <X> ResultSetDataList( DataListSelectQuery<X> query )
 {
   // make sure the query object and resultset object in the query object are not null
   …
   try {
     if ( query.getRst().isClosed() ) {
       throw new IllegalArgumentException( "Result set must not be closed" );
     }
     // Use this information to restrict the usage of methods that require scrolling
     _resultSetType = query.getRst().getType();
   } catch ( SQLException e ) {
     throw new IllegalArgumentException( "Unable to validate input result set", e );
   }
   _query = query;
   _rst = query.getRst();
   _unmarshaller = query.getUnmarshaller();
…
Example of streaming database result set
       - ResultSetDataList.java -
public E get( int index ) {
  if ( _resultSetType == ResultSet.TYPE_FORWARD_ONLY ) {
    String msg = "You must use the Iterator because your ResultSet is set to
     TYPE_FORWARD_ONLY.";
    throw new IllegalArgumentException( msg );
  }
  if ( index < 0 ) {
    throw new IndexOutOfBoundsException();
  }
  try {
    if ( _rst.absolute( index + 1 ) ) {
      if ( _rst.getRow() != index + 1 ) {
        throw new IndexOutOfBoundsException();
      }
      return (E) _unmarshaller.unmarshall();
    } else {
      throw new IndexOutOfBoundsException();
    }…
Example of streaming database result set
       - ResultSetDataList.java -

/**
      The close() method closes the prepared statement and result set wrapped in this
      object. This is called by the finalize method that garbage collector executes when
      appropriate. However, it should still be called as soon as this object is no longer
      necessary by the programmer. Please do not rely on the garbage collector.
*/
 @Override
  protected void finalize() throws Throwable {
    try {
      close();
    } finally {
      super.finalize();
    }
  }
Example of streaming database result set
    - ResultSetDataListIterator.java -
@Override
public E next()
{
  if ( !hasNext() )
  {
    throw new NoSuchElementException();
  }
  try
  {
     E element = (E) _list._unmarshaller.unmarshall();
    _elementRetrieved = true;
    return element;
  }
  //handle exceptions
  …

Contenu connexe

Similaire à Blackboard DevCon 2011 - Developing B2 for Performance and Scalability

Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxJasonTuran2
 
performancetestinganoverview-110206071921-phpapp02.pdf
performancetestinganoverview-110206071921-phpapp02.pdfperformancetestinganoverview-110206071921-phpapp02.pdf
performancetestinganoverview-110206071921-phpapp02.pdfMAshok10
 
Чурюканов Вячеслав, “Code simple, but not simpler”
Чурюканов Вячеслав, “Code simple, but not simpler”Чурюканов Вячеслав, “Code simple, but not simpler”
Чурюканов Вячеслав, “Code simple, but not simpler”EPAM Systems
 
The 5S Approach to Performance Tuning by Chuck Ezell
The 5S Approach to Performance Tuning by Chuck EzellThe 5S Approach to Performance Tuning by Chuck Ezell
The 5S Approach to Performance Tuning by Chuck EzellDatavail
 
Building data intensive applications
Building data intensive applicationsBuilding data intensive applications
Building data intensive applicationsAmit Kejriwal
 
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!Richard Robinson
 
An Automation Framework That Really Works
An Automation Framework That Really WorksAn Automation Framework That Really Works
An Automation Framework That Really WorksBasivi Reddy Junna
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Lari Hotari
 
How Microsoft ALM Tools Can Improve Your Bottom Line
How Microsoft ALM Tools Can Improve Your Bottom LineHow Microsoft ALM Tools Can Improve Your Bottom Line
How Microsoft ALM Tools Can Improve Your Bottom LineImaginet
 
Микола Ковш “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
 
Meeting Performance Goals in multi-tenant Hadoop Clusters
Meeting Performance Goals in multi-tenant Hadoop ClustersMeeting Performance Goals in multi-tenant Hadoop Clusters
Meeting Performance Goals in multi-tenant Hadoop ClustersDataWorks Summit/Hadoop Summit
 
Building high performance and scalable share point applications
Building high performance and scalable share point applicationsBuilding high performance and scalable share point applications
Building high performance and scalable share point applicationsTalbott Crowell
 
Goal driven performance optimization (Пётр Зайцев)
Goal driven performance optimization (Пётр Зайцев)Goal driven performance optimization (Пётр Зайцев)
Goal driven performance optimization (Пётр Зайцев)Ontico
 
Performance Testing from Scratch + JMeter intro
Performance Testing from Scratch + JMeter introPerformance Testing from Scratch + JMeter intro
Performance Testing from Scratch + JMeter introMykola Kovsh
 
February 2017 HUG: Slow, Stuck, or Runaway Apps? Learn How to Quickly Fix Pro...
February 2017 HUG: Slow, Stuck, or Runaway Apps? Learn How to Quickly Fix Pro...February 2017 HUG: Slow, Stuck, or Runaway Apps? Learn How to Quickly Fix Pro...
February 2017 HUG: Slow, Stuck, or Runaway Apps? Learn How to Quickly Fix Pro...Yahoo Developer Network
 
Monitorando performance no Azure SQL Database
Monitorando performance no Azure SQL DatabaseMonitorando performance no Azure SQL Database
Monitorando performance no Azure SQL DatabaseVitor Fava
 

Similaire à Blackboard DevCon 2011 - Developing B2 for Performance and Scalability (20)

ADF Performance Monitor
ADF Performance MonitorADF Performance Monitor
ADF Performance Monitor
 
Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptx
 
ADF performance monitor at AMIS25
ADF performance monitor at AMIS25ADF performance monitor at AMIS25
ADF performance monitor at AMIS25
 
performancetestinganoverview-110206071921-phpapp02.pdf
performancetestinganoverview-110206071921-phpapp02.pdfperformancetestinganoverview-110206071921-phpapp02.pdf
performancetestinganoverview-110206071921-phpapp02.pdf
 
Чурюканов Вячеслав, “Code simple, but not simpler”
Чурюканов Вячеслав, “Code simple, but not simpler”Чурюканов Вячеслав, “Code simple, but not simpler”
Чурюканов Вячеслав, “Code simple, but not simpler”
 
The 5S Approach to Performance Tuning by Chuck Ezell
The 5S Approach to Performance Tuning by Chuck EzellThe 5S Approach to Performance Tuning by Chuck Ezell
The 5S Approach to Performance Tuning by Chuck Ezell
 
Building data intensive applications
Building data intensive applicationsBuilding data intensive applications
Building data intensive applications
 
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
 
An Automation Framework That Really Works
An Automation Framework That Really WorksAn Automation Framework That Really Works
An Automation Framework That Really Works
 
Performance Testing Overview
Performance Testing OverviewPerformance Testing Overview
Performance Testing Overview
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014
 
How Microsoft ALM Tools Can Improve Your Bottom Line
How Microsoft ALM Tools Can Improve Your Bottom LineHow Microsoft ALM Tools Can Improve Your Bottom Line
How Microsoft ALM Tools Can Improve Your Bottom Line
 
Микола Ковш “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...
 
Meeting Performance Goals in multi-tenant Hadoop Clusters
Meeting Performance Goals in multi-tenant Hadoop ClustersMeeting Performance Goals in multi-tenant Hadoop Clusters
Meeting Performance Goals in multi-tenant Hadoop Clusters
 
Building high performance and scalable share point applications
Building high performance and scalable share point applicationsBuilding high performance and scalable share point applications
Building high performance and scalable share point applications
 
Goal driven performance optimization (Пётр Зайцев)
Goal driven performance optimization (Пётр Зайцев)Goal driven performance optimization (Пётр Зайцев)
Goal driven performance optimization (Пётр Зайцев)
 
Performance Testing from Scratch + JMeter intro
Performance Testing from Scratch + JMeter introPerformance Testing from Scratch + JMeter intro
Performance Testing from Scratch + JMeter intro
 
February 2017 HUG: Slow, Stuck, or Runaway Apps? Learn How to Quickly Fix Pro...
February 2017 HUG: Slow, Stuck, or Runaway Apps? Learn How to Quickly Fix Pro...February 2017 HUG: Slow, Stuck, or Runaway Apps? Learn How to Quickly Fix Pro...
February 2017 HUG: Slow, Stuck, or Runaway Apps? Learn How to Quickly Fix Pro...
 
Resolving problems & high availability
Resolving problems & high availabilityResolving problems & high availability
Resolving problems & high availability
 
Monitorando performance no Azure SQL Database
Monitorando performance no Azure SQL DatabaseMonitorando performance no Azure SQL Database
Monitorando performance no Azure SQL Database
 

Plus de Noriaki Tatsumi

Feature drift monitoring as a service for machine learning models at scale
Feature drift monitoring as a service for machine learning models at scaleFeature drift monitoring as a service for machine learning models at scale
Feature drift monitoring as a service for machine learning models at scaleNoriaki Tatsumi
 
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...Noriaki Tatsumi
 
Voice Summit 2018 - Millions of Dollars in Helping Customers Through Searchin...
Voice Summit 2018 - Millions of Dollars in Helping Customers Through Searchin...Voice Summit 2018 - Millions of Dollars in Helping Customers Through Searchin...
Voice Summit 2018 - Millions of Dollars in Helping Customers Through Searchin...Noriaki Tatsumi
 
Microservices, Continuous Delivery, and Elasticsearch at Capital One
Microservices, Continuous Delivery, and Elasticsearch at Capital OneMicroservices, Continuous Delivery, and Elasticsearch at Capital One
Microservices, Continuous Delivery, and Elasticsearch at Capital OneNoriaki Tatsumi
 
Operating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud MicroservicesOperating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud MicroservicesNoriaki Tatsumi
 
Application Performance Management
Application Performance ManagementApplication Performance Management
Application Performance ManagementNoriaki Tatsumi
 
Blackboard DevCon 2013 - Advanced Caching in Blackboard Learn Using Redis Bui...
Blackboard DevCon 2013 - Advanced Caching in Blackboard Learn Using Redis Bui...Blackboard DevCon 2013 - Advanced Caching in Blackboard Learn Using Redis Bui...
Blackboard DevCon 2013 - Advanced Caching in Blackboard Learn Using Redis Bui...Noriaki Tatsumi
 
Blackboard DevCon 2013 - Hackathon
Blackboard DevCon 2013 - HackathonBlackboard DevCon 2013 - Hackathon
Blackboard DevCon 2013 - HackathonNoriaki Tatsumi
 
Blackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityBlackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityNoriaki Tatsumi
 
Blackboard DevCon 2011 - Performance Considerations for Custom Theme Development
Blackboard DevCon 2011 - Performance Considerations for Custom Theme DevelopmentBlackboard DevCon 2011 - Performance Considerations for Custom Theme Development
Blackboard DevCon 2011 - Performance Considerations for Custom Theme DevelopmentNoriaki Tatsumi
 
Blackboard DevCon 2012 - How to Turn on the Lights to Your Blackboard Learn E...
Blackboard DevCon 2012 - How to Turn on the Lights to Your Blackboard Learn E...Blackboard DevCon 2012 - How to Turn on the Lights to Your Blackboard Learn E...
Blackboard DevCon 2012 - How to Turn on the Lights to Your Blackboard Learn E...Noriaki Tatsumi
 

Plus de Noriaki Tatsumi (11)

Feature drift monitoring as a service for machine learning models at scale
Feature drift monitoring as a service for machine learning models at scaleFeature drift monitoring as a service for machine learning models at scale
Feature drift monitoring as a service for machine learning models at scale
 
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
 
Voice Summit 2018 - Millions of Dollars in Helping Customers Through Searchin...
Voice Summit 2018 - Millions of Dollars in Helping Customers Through Searchin...Voice Summit 2018 - Millions of Dollars in Helping Customers Through Searchin...
Voice Summit 2018 - Millions of Dollars in Helping Customers Through Searchin...
 
Microservices, Continuous Delivery, and Elasticsearch at Capital One
Microservices, Continuous Delivery, and Elasticsearch at Capital OneMicroservices, Continuous Delivery, and Elasticsearch at Capital One
Microservices, Continuous Delivery, and Elasticsearch at Capital One
 
Operating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud MicroservicesOperating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud Microservices
 
Application Performance Management
Application Performance ManagementApplication Performance Management
Application Performance Management
 
Blackboard DevCon 2013 - Advanced Caching in Blackboard Learn Using Redis Bui...
Blackboard DevCon 2013 - Advanced Caching in Blackboard Learn Using Redis Bui...Blackboard DevCon 2013 - Advanced Caching in Blackboard Learn Using Redis Bui...
Blackboard DevCon 2013 - Advanced Caching in Blackboard Learn Using Redis Bui...
 
Blackboard DevCon 2013 - Hackathon
Blackboard DevCon 2013 - HackathonBlackboard DevCon 2013 - Hackathon
Blackboard DevCon 2013 - Hackathon
 
Blackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityBlackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code Quality
 
Blackboard DevCon 2011 - Performance Considerations for Custom Theme Development
Blackboard DevCon 2011 - Performance Considerations for Custom Theme DevelopmentBlackboard DevCon 2011 - Performance Considerations for Custom Theme Development
Blackboard DevCon 2011 - Performance Considerations for Custom Theme Development
 
Blackboard DevCon 2012 - How to Turn on the Lights to Your Blackboard Learn E...
Blackboard DevCon 2012 - How to Turn on the Lights to Your Blackboard Learn E...Blackboard DevCon 2012 - How to Turn on the Lights to Your Blackboard Learn E...
Blackboard DevCon 2012 - How to Turn on the Lights to Your Blackboard Learn E...
 

Dernier

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Dernier (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Blackboard DevCon 2011 - Developing B2 for Performance and Scalability

  • 1. Developing B2 for Performance and Scalability Noriaki Tatsumi Kevin Weisser
  • 2. Why Performance Matters? • User experience – Your users don’t like slow and unresponsive apps – Slow applications lose users in frustrations – Users tend to wander off beyond captive response time of 7 – 10 seconds • User adoption – Google saw 25% decline in searches within 6 weeks after introducing 0.5s delay (~$2.5B loss) – Wikia observed up to 20% user loss as the page load time reached 5 seconds
  • 3. Wikia – Exit rate (abandon) http://assets.en.oreilly.com/1/event/27/Varnish%20-%20A%20State%20of%20the%20Art%20High-Performance%20Reverse%20Proxy%20Presentation.pdf
  • 4. “With great power comes great responsibility” – Uncle Ben, Spiderman • Reputations at stake • System resources are shared and limited • B2s with scalability problem impacts system performance – System-wide performance degradation – Server downtime
  • 5. What is an anti-pattern? • Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results • A refactored solution exists that is clearly documented, proven in actual practice and repeatable. - Definition from Wikipedia
  • 6. How can anti-patterns help? • Prevents performance as an afterthought • Helps identify performance issues that typically don’t arise until deployed in production • Prevents pre-mature optimizations
  • 7. How do I use anti-patterns? • Identify and correct the occurrences of anti- patterns during: – Design review – Implementation/code review – Execution of experiments and profiling – Static code analysis
  • 8. Top 10 violated high-level performance anti-patterns fixed in Blackboard Learn™ Inefficient Filtering Unnecessary Processing The Ramp Data Overreach Frequency (%) Unlimited Resource Usage Functional Bug Excessive Granularity More is Less Usage of Outdated Tools and APIs Mishandled Concurrency 0 5 10 15 20 25 30
  • 9. Top 10 violated low-level performance anti-patterns fixed in Blackboard Learn™ Missing or non-optimal index [db] Inefficient or erroneous criteria [db] Unnecessary data retrieval [app} Too many objects in memory [app} Presentation of unlimited results [ui] Frequency (%) Inefficient access path [ui] No data caching [app} Not releasing resource (immediately) after use [app} Incompatiblity with HA deployment [app} Excessive DB round trips [app} 0 5 10 15 20 25
  • 10. Most violated high-level anti-pattern #1: Inefficient Filtering • Description – Querying data using inefficient logic, algorithm, or technique • Problem – Consumes resources that can be used by other processes – Increases execution/response time • Solution – Store data in both centralized and organized manner – Search against smaller data set first, fail fast, and don’t look at unnecessary data – Leverage indexing and other efficient techniques/algorithms
  • 11. Most violated high-level anti-pattern #1: Inefficient Filtering Missing or non-optimal index (DB) • Most violated low-level anti-pattern • Problem – Missing appropriate index on search columns leads to inefficient data retrieval operation by SQL query optimizer – Having index can inversely add unnecessary overhead if the column is never used for searched criteria • Solution – Analyze SQL execution plan to verify usage of proper index – Create index on foreign keys – Create unique index on unique columns – Use an index to eliminate unnecessary full-table or index scans to access small percentage of data on a large table – Use covering index for key lookup
  • 12. Creating Database Objects with B2 • Release 9.1 SP1 and above – B2s authored by independent developers can now define and install schema elements • Not enabled by default – Administrators must enable this functionality from the B2 management section of the admin panel • Documentation – http://www.edugarage.com/display/BBDN/Creating+ Database+Objects+with+Building+Blocks
  • 13. Most violated high-level anti-pattern #1: Inefficient Filtering Inefficient or erroneous criteria (DB) • The second most violated low-level anti-pattern • Problem – Duplicate, unnecessary, incorrect, or missing predicate checks and joins exist in SQL – Increases response time, system resource consumption, and locking • Solution – Be specific on what data you need – Keep it simple and avoid unnecessary checks – Use JOIN criteria that aligns with index – Analyze execution plan to derive efficient and balanced query
  • 14. Most violated high-level anti-pattern #1: Inefficient Filtering Wrapping filtering column in a function (DB) • Problem – The query optimizer does not see the column – Available index likely does not get used • Solution – Rewrite query to avoid using function if possible – Format bind variables in application tier
  • 15. Example of bad T-SQL function usage - Without -
  • 16. Example of bad T-SQL function usage - With LOWER-
  • 17. Example of bad T-SQL function usage - Comparison - Without T-SQL function With T-SQL function Logical I/O reads 3 3238 Estimated CPU cost 0.396307 15.454153
  • 18. Most violated high-level anti-pattern #1: Inefficient Filtering Other low-level anti-pattern examples • Filtering larger query first • Implicit data type conversion • Inefficient CSS selectors • Inefficient DOM element lookup • Inefficient regex • Unnecessary query on VIEW instead of table • Usage of "NOT IN" comparison rather than JOIN • Usage of wrong index • Using UNION when returned records always unique
  • 19. Most violated high-level anti-pattern #2: Unnecessary Processing • Description – Processing when not needed or not needed at the time – Excessive or duplicate executions • Problem – Consumes resources that can be used by important work – Increases execution/response time • Solution – Remove, postpone (asynchronous), prioritize, or reorder the processing steps – Leverage caching to reuse loaded or calculated data
  • 20. Most violated high-level anti-pattern #2: Unnecessary Processing Presentation of Unlimited Results (UI Design) • 5th most violated low-level anti-pattern • Problem – Users typically do not consume all data when presented with large amount so the used resources are wasted – Severe system performance issue can arise depending on the volume of prepared results • Solution – Paginate results – Guide users to narrow down search criteria – Limit amount of data that can be returned
  • 21. Example usage of pagination and limiting the number of returned results
  • 22. Most violated high-level anti-pattern #2: Unnecessary Processing Inefficient access path (UI Design) • 6th most violated low-level anti-pattern • Problem – Room for optimization exists in actions/clicks users must take to complete his/her task – Results to creating additional work for the system (also impacts user’s time to task) • Solution – Refactor UI or click path to let users accomplish their tasks more efficiently
  • 23. Example of enhancing access path
  • 24. Most violated high-level anti-pattern #2: Unnecessary Processing Other low-level anti-pattern examples • Excessive executions of maintenance task • HTTP 404 error on cacheable static content • Missing short-circuit logic • No data caching • No http caching • Unnecessary cache reload • Unnecessary conditional check • Unnecessary object creation • Updating unchanged data
  • 25. Most violated high-level anti-pattern #3: The Ramp • Description – Processing time increases or the system crashes as the application gets used over a period of time • Problem – The application cannot handle the increased volume of data/traffic – Resource consumption increases or exhausts • Solution – Select algorithms or data structures based on maximum size expected – Use algorithms/designs that adapt to the increasing size or doesn’t get effected by it (ex. flyweight pattern, streaming technique)
  • 26. Most violated high-level anti-pattern #3: The Ramp Too many objects in memory • #4 most violated low-level anti-pattern • Problem – Loading large amount of data or objects at once for processing can result to out-of-memory error and other system-level performance impact – Examples include unmarshalling entire DB resultset in heap and generation of large XML documents using DOM object • Solution – Flyweight and lazy loading patterns – Streaming and chunking techniques
  • 27. Example of streaming database result set - Overview - • DataList/DataListIterator – Interface for a list/iterator data structure materialized from a data source, such as a database or a file – Extends the List/Iterator interface to leverage polymorphism • ResultSetDataList – Implementation of DataList that’s materialized from a SQL resultset – Unmarshalls the resultset rows one by one as the getter method is called • ResultSetDataListIterator – Iterator that’s materialized from ResultSetDataList
  • 28. Example of streaming database result set - Usage considerations - Avoid out-of-memory and SQL timeout • Use ResultSet.TYPE_FORWARD_ONLY • Set Statement fetch size – Default for Oracle JDBC = 10 – Default for i-net MERLIA = 0 • ‘0’ uses client cursor that reads all rows into memory • Specify fetch size to use cursor on server side • Use flyweight pattern in the unmarshaller if possible
  • 29. Example of streaming database result set - Code sample - • See Appendix A
  • 30. Most violated high-level anti-pattern #3: The Ramp Not releasing resource (immediately) after use • #8 most violated low-level anti-pattern • Problem – Cause of connection leaks, deadlocks, performance degradation and other unexpected behavior – Threads, sockets, database connection, file handler, and other resources can be a victim • Solution – Use finally block to ensure release – Release resource as quickly as possible
  • 31. Example of resource management - CSContext - CSContext csCtxt=null; try { csCtxt = CSContext.getContext(); // your code } catch (Exception e) { csCtxt.rollback(); csCtxt=null; } finally { if (csCtxt!=null) { csCtxt.commit(); }
  • 32. Most violated high-level anti-pattern #3: The Ramp Other low-level anti-pattern examples • Exceeding max number of expressions in a list • No data caching • No priority logic • Not releasing resource (immediately) after use • Presentation of unlimited results • Transaction isolation unnecessarily wide • Unlimited cache storage
  • 33. Low-level performance anti-patterns fixed in Blackboard Learn™ by tier Application Database Frequency (%) UI Design Browser Network 0 10 20 30 40 50 60
  • 34. Tools to identify anti-patterns: First line of defense • Peer code review – Atlassian Crucible – Review Board • Static code analyzer – FindBugs – PMD – Sonar – Custom rules • Performance unit testing – JUnitPerf
  • 35. Tools to identify anti-patterns: Deeper analysis • Java – VisualVM – Memory Analyzer (MAT) – YourKit • Browser – Firebug – Google Page Speed – dynaTrace AJAX Edition – Fiddler – WebPagetest
  • 36. Tools to identify anti-patterns: Deeper analysis • Database – MS SQL Server • SQL Server Management Studio • SQL Server Profiler • Performance Dashboard – Oracle • SQL*Plus • Automatic Workload Repository (AWR) • Active Session History (ASH)
  • 37. Takeaways • The importance of performance and scalability for your B2 • Top violated performance anti-patterns in Blackboard Learn™ • Forensics Tools
  • 38. Please provide feedback for this session by emailing DevConFeedback@blackboard.com. The title of this session is: Developing B2 for Performance and Scalability
  • 39. Appendix A: Example of streaming database result set
  • 40. Example of streaming database result set - DataList.java - public interface DataList<E> extends List<E> { /** Closes the list and releases all of the resources that back the list */ void close(); }
  • 41. Example of streaming database result set - ResultSetDataList.java - public <X> ResultSetDataList( DataListSelectQuery<X> query ) { // make sure the query object and resultset object in the query object are not null … try { if ( query.getRst().isClosed() ) { throw new IllegalArgumentException( "Result set must not be closed" ); } // Use this information to restrict the usage of methods that require scrolling _resultSetType = query.getRst().getType(); } catch ( SQLException e ) { throw new IllegalArgumentException( "Unable to validate input result set", e ); } _query = query; _rst = query.getRst(); _unmarshaller = query.getUnmarshaller(); …
  • 42. Example of streaming database result set - ResultSetDataList.java - public E get( int index ) { if ( _resultSetType == ResultSet.TYPE_FORWARD_ONLY ) { String msg = "You must use the Iterator because your ResultSet is set to TYPE_FORWARD_ONLY."; throw new IllegalArgumentException( msg ); } if ( index < 0 ) { throw new IndexOutOfBoundsException(); } try { if ( _rst.absolute( index + 1 ) ) { if ( _rst.getRow() != index + 1 ) { throw new IndexOutOfBoundsException(); } return (E) _unmarshaller.unmarshall(); } else { throw new IndexOutOfBoundsException(); }…
  • 43. Example of streaming database result set - ResultSetDataList.java - /** The close() method closes the prepared statement and result set wrapped in this object. This is called by the finalize method that garbage collector executes when appropriate. However, it should still be called as soon as this object is no longer necessary by the programmer. Please do not rely on the garbage collector. */ @Override protected void finalize() throws Throwable { try { close(); } finally { super.finalize(); } }
  • 44. Example of streaming database result set - ResultSetDataListIterator.java - @Override public E next() { if ( !hasNext() ) { throw new NoSuchElementException(); } try { E element = (E) _list._unmarshaller.unmarshall(); _elementRetrieved = true; return element; } //handle exceptions …

Notes de l'éditeur

  1. Q: Do you like waiting for applications?Q: Have you guys seen the study done by Google?
  2. Illustrates the direct correlation of site exit rate to increase in page load time = this is why you should care about performance and scalability of your B2s
  3. Anti-patterns produced from root-cause analysis of performance bugs that were fixed since 8/2009 (~200 bugs).
  4. More concrete examples of anti-pattern violations.
  5. Q: Why should I care about table indexes? A: Because you can create database objects in 9.1 SP1 and above!
  6. Solution:Postpone -&gt; asynchronous
  7. ResultSet.TYPE_FORWARD_ONLY:Cursor may move forward only
  8. - The top level state manager for a series of Blackboard Content System calls- For every set of actions grouped together into one transaction, a new context is created and used- A Context instance contains transactional state for that request (i.e. commit, rollback)
  9. Segway to tools
  10. Eclipse integration available for:FindBugsPMDSonarJUnitPerf
  11. SQL Server Management Studio:- Use to get execution plans and run DMV queriesSQLDiag:http://msdn.microsoft.com/en-us/library/ms162833.aspxSimplifies diagnostic information gathering for SQL ServerPAL:http://pal.codeplex.com/Reads in a performance monitor counter log and analyzes it using known thresholdsAWR:http://www.oracle-base.com/articles/10g/AutomaticWorkloadRepository10g.phpUsed to collect performance statistics (ex. Wait events, resource intensive SQL statements, system and session statistics) ASHhttp://www.orafaq.com/wiki/ASHTracks session activity and simplify performance tuning
  12. DataListSelectQuery extends