Oracle DB tuning-2.ppt

download Oracle DB tuning-2.ppt

of 24

Transcript of Oracle DB tuning-2.ppt

  • 7/29/2019 Oracle DB tuning-2.ppt

    1/24

    Advanced Oracle DB tuning

    Performance can be defined in verydifferent ways (OLTP versus DSS)

    Specific goals and targets must be set =>clear recognition of success

    Factors include response time andthroughput

    Oracle specific tuning

  • 7/29/2019 Oracle DB tuning-2.ppt

    2/24

    Response time

    Sum of service time + wait time

    Processing strategy has key effect onresponse time

    Eg: Sequential processing

    In a queue, wait time for a job = sum ofservice time of all previous jobs

    If queue gets longer parallel processingrequired

  • 7/29/2019 Oracle DB tuning-2.ppt

    3/24

    response time in Sequential andParallel processing

    time

    jobs

    Wait time

    Service time

    jobs

  • 7/29/2019 Oracle DB tuning-2.ppt

    4/24

    System Throughput

    Amount of work completed in a given time Reduced service time = increased throughput

    Increase in resources = reduced response time

    Under load, contention increases Service may remain the same

    But queues get longer

    In practice, wait time raises exponentially

    O/S scheduler

    DB dispatcherWait time

    contention

  • 7/29/2019 Oracle DB tuning-2.ppt

    5/24

    Critical resources

    CPU, memory, I/O capacity, network broadband

    Capacity (how many?)

    Demand (how many?)

    Wait time (how long?) Consumption (how long?)

    Software issue as much as hardware issue

    Quality of design / programming

    Prioritise jobs Performance loss

    demand

  • 7/29/2019 Oracle DB tuning-2.ppt

    6/24

    Performance adjustments

    Reduce consumpt ion (use fewerresources & reduce I/O per transac.)

    Demand (reschedule / redistribute work) Capacity (increase / relocate res. eg:

    move to parallel proc, increase mem.)

  • 7/29/2019 Oracle DB tuning-2.ppt

    7/24

    Problems for DBAs

    Many performance parameters are set at designstage => limited scope to adjust

    Important targets set at outset => bottlenecks

    can be identified Administer trade-offs More $$$

    Else reschedule to limit contention

    Properly manage user expectations Eg DB versus network problems

    Never sacrifice ability to recover data!

  • 7/29/2019 Oracle DB tuning-2.ppt

    8/24

    Performance tuning

    Always better pro-active =>DBA indevelopment team

    On-going tasks minimised by good planning

    Service time marginal improvements only

    Eg SOCRATE case study

    Oracle prioritised tuning steps forapplication dev.

  • 7/29/2019 Oracle DB tuning-2.ppt

    9/24

    Oracle tuning methodology

    Tune business rules Tune data design Tune application design

    Tune logical structure Tune database operations Tune access paths Tune memory allocation

    Tune I/O and physical structure Tune resource contention Tune platform

  • 7/29/2019 Oracle DB tuning-2.ppt

    10/24

    Business rules

    Normally other direction, but sometime businessrule changed for better perf.

    Also, IT deployment strategy

    Distributed Centralised

    Stick to high level analysis of req. => morefreedom (!?)

    Cheque printing versus direct deposit Threshold value for automatic approuval

    More flexibility in design

  • 7/29/2019 Oracle DB tuning-2.ppt

    11/24

    Data Design

    Structure for data consistency ANDperformance

    Denormalisation

    FAReports

    Summary values

    Data hot spot

  • 7/29/2019 Oracle DB tuning-2.ppt

    12/24

    Application Design

    In view of DB

    In view of Oracle

    Data entry acceleration+ Refer to business rules and notes on

    critical db operations

  • 7/29/2019 Oracle DB tuning-2.ppt

    13/24

    Logical DB structure

    Mostly indexing

    Also locking strategy

  • 7/29/2019 Oracle DB tuning-2.ppt

    14/24

    DB operations

    Post relational DBs eg: oracle

    Extended SQL functions

    New DB functions See Oracle stats on query execution

    Also pl/sql server side programming better

    than application code Query optimiser may provide clues

    Eg: Temporary index on non key attribute

  • 7/29/2019 Oracle DB tuning-2.ppt

    15/24

    Memory allocation

    Dynamic process in Oracle

    Shared pool

    Parameters can be set manually Make sure to keep decent SGA

    See notes on DB creation

  • 7/29/2019 Oracle DB tuning-2.ppt

    16/24

    I/O and physical design

    Use multiple disks + parallel controllers

    Optimise block size (see notes on DBcreation)

    Use extents large enough for indexes

    Avoid use of pctincrease in OLTP tables

    Use raw device

  • 7/29/2019 Oracle DB tuning-2.ppt

    17/24

    Resource contention

    Block contention

    Shared pool contention

    Lock contention All these can be diagnosed with Oracle

    stats

  • 7/29/2019 Oracle DB tuning-2.ppt

    18/24

    Platform

    Need to talk to specialist

    Eg: oracle staff

    Different for different OS

    Cache size

    Paging strategies etc

  • 7/29/2019 Oracle DB tuning-2.ppt

    19/24

    Application

    Always start with specific objectives elsenever achieve anything!

    Max response times for inquiry

    maximum processing time for document

    Picking list

    Invoice

    Month end Goals may conflict, DBA arbitrates

  • 7/29/2019 Oracle DB tuning-2.ppt

    20/24

    Create repeatable tests

    SQL statements

    New versus old in SQL +

    SQL Trace enabled

    Trial and error in a trial environment

    Use multiple scenarios to test effect ofeach change

    Also test in combination

    Test for scalability (growth)

  • 7/29/2019 Oracle DB tuning-2.ppt

    21/24

    Keep records and automate testing

    Write recording into your scripts (table)

    Run scripts on a timer

    Measure against objectives and past perf. Stop when goals achieved

  • 7/29/2019 Oracle DB tuning-2.ppt

    22/24

    Oracle diagnostic tool

    Explain plan

    Oracle trace

    Can be run in combination to compareactuals to estimates

  • 7/29/2019 Oracle DB tuning-2.ppt

    23/24

    Oracle Enterprise Manager

    Common interface for all utilities

    Diagnosis + implementation of changes

    See table 17.4

  • 7/29/2019 Oracle DB tuning-2.ppt

    24/24

    Benchmarking

    Use in product selection Vendor bias?

    Env tuned for test only

    Not repeatable without access to unlimited resources

    Hidden cost of table maintenance outside the test. Cited by every DB vendor on this planet

    Creation of the TPC (Transaction ProcessingPerformance Council) TPC C: order entry benchmark

    TPC H and TCP R: decision support benchmark

    TPC A: web transaction benchmark

    Open source DB benchmark