Title: Performance Tuning and Optimization Tools and Methods
1Performance Tuning and Optimization Tools and
Methods
- CSSE 514Programming Methods
- Presented May 22, 2001
- By Team 1
- Paul Murray, Lisa Black, Mike Rodgers, Marie
Murray
2Agenda
- More Optimization
- Techniques Lisa
- Caching
- Pooling
- Parallelization (1) (2)
- Measurement-Mike
- Benchmarks
- Tools
- Example-Marie
- The Reference Model-Paul
- Performance Defined
- Gon Fishing
- The Life Cycle
- Low Hanging Fruit and Plown It Under
- Infrastructure Component Interactions (1) (2)
3The Reference ModelPerformance Defined
- Performance refers to the responsiveness of the
system the time required to respond to stimuli
(events) or the number of events processed in
some interval of time. - Bass, Clements Kazman
- Software Architecture in Practice
- Measuring software performance is done relative
to a specific set programmatic interfaces using a
specific set of inputs and targeting a specific
set of outputs. - The final performance measurement is the result
of accumulated performance cost contributions of
each hardware and software module involved in the
production of the output(s) along the critical
path.
4The Reference Model Gon Fishing
5The Life CycleLow Hanging Fruit and Plown
It Under
Estimate Future Response Time by using
appropriately sized test data (workload) with
healthy scaling margin.
Prioritization should balance performance
gain, client development needs, cost and timing
of complete re-write.
Instrument code and configure tools to isolate
potential performance culprit.
Avoid code rot by preemptive re-writes
Review infrastructure API evolution
6Infrastructure Component Interactions (1)
- Review application code interaction with
infrastructure components - Example - configuring DBMS client interfaces
- Trust no one! Isolate all interaction points and
check - Client component versions
- Other sources for components
- Appropriate query scopes?
- Appropriate transaction scopes?
- Appropriate caching policies?
7Infrastructure Component Interactions (2) Example
Application
ActiveX Data Objects
ODE-DB Provider for ODBC
Oracle Objects for OLE
ODBC Driver for Oracle
Oracle Call Interface
Network Interface
8More Optimization Techniques
- Class material covered improvements to
application algorithms and code structure. - Additional techniques may include
- Application level data caching
- Application level object pooling
- Application level multi-threading
9Caching
- Definition Storing frequently used application
specific data where it can be quickly accessed
(e.g. in memory). - Refreshing the cache one of the most difficult
issues to resolve to use caching effectively - Client/Server Database Example
- Pre-fetch database data and store it in a
location with faster access, often a feature of
client library components. - World Wide Web Example
- Client side (browser) storage of most recently
accessed web pages for rapid re-access in
page-back operation / revising sites.
10Pooling
- Graphical Image Pools Pre-rendered, complex
graphical images which may be reused through out
the User Interface. - Connection Thread Pools - create a pool of
threads when the server launches, store incoming
connections in a queue, and have the threads in
the pool progressively remove connections from
the queue and process them. - Example Connection Pool JDBC DBConnectionPool
Class - get an open connection from the pool,
- return a connection to the pool,
- release all resources and close all connections
at shutdown - handles connection failures, such as time-outs
- limit the number of connections in the pool to a
predefined max value.
11Parallelization (1)
- Advantages
- Single Processor Platform increased
availability - Multiple Processor Platform increased
throughput - Implementations
- Multi-threading multiple light weight threads
- Multi-processing multiple heavy weight threads
- For Multiple Processors
- Amdahls Law The performance that can be gained
by parallel processing is limited by the amount
of time that must be sequential - Used to determine ROI(return on investment) for
changes - Speed-up 1/Sequential Processing Time
12Parallelization (2) Gotchas
- Startup Cost Try to create a thread pool at the
start of the program, since thread creation is
expensive and can outweigh the threading
advantages. - Synchronous Access Cost Try to avoid situations
where many threads must often access shared data
sequentially. - Race Conditions Anomalous behavior due to
unexpected critical dependence on the relative
timing of events. - Dead Locks A situation where two or more threads
are unable to proceed because each is waiting for
one of the others to do something.
13Benchmarking
- Define your workload
- Measurable
- Reproducible
- Representative of the whole system
- Pick the right tools
- Sampling
- Instrumentation
14Benchmarking Sampling
- Work at the system level
- Monitor the entire system
- Only valid over time and with a measurable
workload - Examples
- Time-based, Event Based
- Microsoft Performance Monitor
15Benchmarking Instrumentation
- Modify the application
- Insert code to count performance data
- Do not change execution flow
- Do change timing of events
- Increase the code size
- Examples
- Intels Vtune
- Rational Quantify Software
16Measurement Metrics
- Know what you are trying to measure and select
appropriate metrics and tools - Total elapsed time
- Number of transactions per minute
- Number of supported users
- Where most time is spent in application
(profiling)
17Benchmarking Caveats
- Number of ways to alter the results
- The blatant cheat
- Targeted optimization
- Flag fiascos
- Bait and switch
- Bending the rules
- Rigging the game
- Benchmarks run by someone else should be suspect
- The best benchmark is always your own application
- Licensing agreements can prohibit public
disclosure of results
18Tools Benchmarking/Performance Monitoring (1)
Â
19Tools Benchmarking/Performance Monitoring (2)
20Example ToolIntels VTune Performance Analyzer
- http//developer.intel.com/software/products/vtune
/index.htm - Cost --524
- Functionality
- Time and event-based system-wide sampling
- C/C, Java, Fortran
- Call Graph
- how many times a function called another
- how much time
- Static Code Analysis
- analysis of each block without executing
- estimate of performance
- creates a database of results
- code coach to help optimize code (algorithms,
processor instructions) - Hot Spot Analysis
21Intel Vtune Performance Analyser
22Intel Vtune Performance Analyser