Tuning your applications with the Quest Central Performance pack


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Tuning your applications with the Quest Central Performance pack

  1. 1. Robert Wijnbelt Health Check your Database A Performance Tuning Methodology
  2. 2. WHAT IS PERFORMANCE TUNING? <ul><li>A combination of identifying and reacting to performance problems </li></ul><ul><ul><li>Proactively preventing such problems from occurring </li></ul></ul><ul><li>Key responsibility for Oracle DBAs </li></ul><ul><ul><li>Ensures that service levels are being met </li></ul></ul><ul><ul><li>Avoids costly hardware upgrades </li></ul></ul>
  3. 3. Why is performance tuning important? <ul><li>‘ At the core of business logic, and at the core of business data for most production applications, is a relational database management system ” </li></ul><ul><ul><li>– Ray Paquet of Gartner, July, 2002 </li></ul></ul><ul><li>No access = no data = no business </li></ul><ul><ul><li>Includes poor performance, missed SLA’s </li></ul></ul>
  4. 4. MAJOR CAUSES OF PROBLEMS <ul><li>Poorly tuned application code: SQL & PL/SQL </li></ul><ul><li>Contention for internal Oracle Resources: locks, latches buffers </li></ul><ul><li>IO bottlenecks </li></ul><ul><li>Inadequate hardware resources </li></ul>
  5. 5. Procrastination? <ul><li>Only when the application and RDBMS is tuned can the possibility of adding hardware be considered </li></ul><ul><ul><ul><ul><li>Don Burleson </li></ul></ul></ul></ul><ul><ul><li>Number one resolution to performance issues in past three years was to upgrade hardware, add memory and add disk. </li></ul></ul><ul><ul><li>Problems still persist! </li></ul></ul>
  6. 6. Health Check Best Practices? <ul><li>Where are the most common problems past and present? </li></ul><ul><li>How do I resolve those problems? </li></ul><ul><li>How much benefit can I get from fixing the problems identified? </li></ul><ul><li>How much effort is involved in resolution? </li></ul><ul><li>What can I do to prevent future issues? </li></ul>
  7. 7. ‘Tuning Methodology’ Best Practices <ul><li>Identify issues happening now </li></ul><ul><ul><li>Resolve quickly </li></ul></ul><ul><li>Find problems in the past </li></ul><ul><ul><li>Resolve methodically </li></ul></ul><ul><li>How to prevent future occurrences </li></ul><ul><ul><li>Set Goals </li></ul></ul><ul><ul><li>‘What and How to tune’ </li></ul></ul>
  8. 8. APPLICATION TUNING Resolutions <ul><li>The greatest and most common performance gains are attained through SQL tuning </li></ul><ul><li>A relative effort is modifying improper parameter settings </li></ul><ul><li>Just as important is resolving management of database space and data layout </li></ul>
  9. 9. 4 Step Action Plan For a Database Healthcheck
  10. 10. Step 1: Optimize the Application Workload <ul><li>Effectively use the Oracle Optimizer </li></ul><ul><ul><li>Set optimizer mode to: RULE, COST or CHOOSE </li></ul></ul><ul><li>Optimize SQL Statements </li></ul><ul><ul><li>Set Optimizer initialization parameters </li></ul></ul><ul><ul><li>Determine SQL Code needs optimization </li></ul></ul><ul><ul><li>SQL Coding Best Practices </li></ul></ul><ul><ul><li>PL/SQL coding Best Practices </li></ul></ul>
  11. 11. Step 2: Reduce Contention <ul><li>Identify and reduce Latch contention </li></ul><ul><li>Identify and reduce Lock contention </li></ul><ul><li>Optimize Redo Log configuration </li></ul><ul><li>Reduce other internal contention </li></ul>
  12. 12. Identify and reduce Latch contention <ul><li>Types of Latches in the SGA that suffer most contention: </li></ul><ul><ul><li>Buffer Cache Latches, caused by: </li></ul></ul><ul><ul><ul><li>SQL statements with very high logical or physical I/O, due to unselective indexes (large index range scans) or many full table scans. </li></ul></ul></ul><ul><ul><ul><li>DBWR not keeping up with the dirty workload, which forces the foreground process to hold the latch longer looking for a free buffer. </li></ul></ul></ul><ul><ul><ul><li>Undersized buffer cache. </li></ul></ul></ul><ul><ul><li>Library Cache Latches </li></ul></ul><ul><ul><ul><li>Misses on this latch occur when SQL is executed at very high rates. There is little you can do to reduce the load on this latch, although using private rather than public synonyms (or even direct object references such as OWNER.TABLE) can help. </li></ul></ul></ul><ul><ul><ul><li>Use bind variables in your code </li></ul></ul></ul>
  13. 13. Identify and reduce Lock contention <ul><li>Often caused in the application code and Data model: </li></ul><ul><ul><li>Code for Concurrent use </li></ul></ul><ul><ul><li>Index Foreign Key relations </li></ul></ul><ul><ul><li>Reduce Ad-Hoc querying </li></ul></ul><ul><ul><li>Try to reduce Updates </li></ul></ul>
  14. 14. Optimize Redo Log configuration <ul><li>Use Fast disks </li></ul><ul><ul><li>avoid RAID 5, use 0+1 or Filesystem level replication </li></ul></ul><ul><li>Multiplex Your RedoLogs </li></ul><ul><li>Use NOLOGGING table operations </li></ul><ul><li>Use multiple Disks for different Group members </li></ul><ul><li>Adjust Log Buffer size </li></ul>
  15. 15. Reduce Shared Pool contention <ul><li>Rewrite SQL </li></ul><ul><li>Pin PL/SQL objects or SQL cursor objects in the shared pool, use the DBMS_SHARED_POOL.KEEP </li></ul><ul><li>Fully qualify tables and objects with the schema owner name. This will eliminate some reparsing requirements. </li></ul><ul><li>Increase the shared pool size when shared cursors are being flushed out </li></ul><ul><li>Decrease the shared pool size when the application does not use bind variables and when cursors are not shared and reused. </li></ul>
  16. 16. Reduce Shared Pool contention continued <ul><li>consider setting the parameter cursor_sharing = force (first available in 8.1.6). When this parameter is set, Oracle replaces embedded literal values with bind variables prior to parsing the statement, to avoid additional hard parses for SQL statements that differ only by literal values. </li></ul><ul><li>Add cursors to stored procedures/packages. Stored procedures/packages can be pinned in the shared pool, which prevents them from being flushed and subsequently reparsed. </li></ul><ul><li>Use the same bind variable length and array size in SQL statements. When an SQL statement with different bind variable lengths is used throughout an application, it cannot be shared. </li></ul>
  17. 17. Step 3: Physical IO Optimization <ul><li>Tune Sorting parameters (Sort_Area) </li></ul><ul><li>Tune SQL (avoid Full Table Scans) </li></ul><ul><li>Reduce Row Chaining and Migration </li></ul><ul><li>Balance IO </li></ul><ul><li>Increase number of datafile devices </li></ul><ul><li>Implement OFA </li></ul><ul><li>Increase DB Block size </li></ul>
  18. 18. Step 4: Consider Best Practices <ul><li>Tune Top Down </li></ul><ul><ul><li>Start with Network, IO, Instance and Database design before tuning SQL </li></ul></ul><ul><li>Set Benchmarks </li></ul><ul><ul><li>Identify some SQL statements, and rerun them as test </li></ul></ul><ul><ul><li>Identify and monitor critical modules </li></ul></ul><ul><li>Quantify the problem and the expectations. </li></ul><ul><li>Make sure there is not some problem with the infrastructure, get everyone involved. </li></ul><ul><li>Involve the developers in your tuning efforts. </li></ul>
  19. 19. <ul><li>Understand all the features of the database you are using. Use as many standard Oracle provided functions as possible. </li></ul><ul><li>Learn how to generate and read execution plans. </li></ul><ul><li>Tune to reduce logical IO’s. Reducing the number of LIO’s will reduce both overall CPU usage as well as physical IO requirements. Generally, index usage will reduce LIO requirements, but sometimes the reverse it true. </li></ul>Best Practices continued
  20. 20. <ul><li>Consider that sometimes writing PL/SQL can ultimately improve performance over SQL. </li></ul><ul><li>If you have lots of large queries doing full table scans, make sure that parallel query is configured correctly. </li></ul><ul><li>If Oracle is performing many hash joins, make sure the database parameters associated with hash joins (e.g. hash_area_size) are set correctly. </li></ul>Best Practices continued
  21. 21. Quest Central Health Check <ul><li>A free service from Quest in which our consultants use Quest Central Performance management to diagnose the health of your database </li></ul>
  22. 22. What does it do? <ul><li>Collects Metrics using PL/SQL packages at a user defined interval </li></ul><ul><li>Stores that information in a repository </li></ul><ul><li>Allows you to run analysis against any number of those stored collections </li></ul><ul><li>Produces problems, recommendations, solutions, reports, and goals for tuning </li></ul>
  23. 23. WHAT IS QUEST CENTRAL <ul><li>An integrated comprehensive solution for Oracle DBAs </li></ul><ul><ul><li>Real-time and Historical Diagnostics and Analysis </li></ul></ul><ul><ul><li>Space Management </li></ul></ul><ul><ul><li>SQL Tuning </li></ul></ul><ul><ul><li>Database Administration </li></ul></ul>
  24. 24. THANK YOU FOR LISTENING Robert Wijnbelt Register for a Free Database Health Check http://www.quest.com/ healthcheck /