08 November, 2014

StatsPack and AWR Reports -- Bits and Pieces -- 3

This is the third post in this series.
Post 1 is here
Post 2 is here

Note : Some figures / details may be slightly changed / masked to hide the real source.

Identifying Unusual Events / Behaviours / Applications

Here I find a few "unusual" events and mark them out.

Extract A : 11.2 AWR

Snap IdSnap TimeSessionsCursors/Session
Begin Snap:.... 03:00:57107.7
End Snap:.... 07:00:07114.9
Elapsed:239.17 (mins)
DB Time:22.61 (mins)

Top 5 Timed Foreground Events

    EventWaitsTime(s)Avg wait (ms)% DB timeWait Class
    DB CPU1,33298.16
    SQL*Net more data to client49,7012001.50Network
    SQL*Net more data from client213,915500.34Network
    db file scattered read1,159110.08User I/O
    db file sequential read7,547100.07User I/O

    The two "SQL*Net more data" sets of waits are the unusual events.
    The Time on SQL*Net more data to/from client is negligible isn't it ?  So, should I be concerned ?  Over a 4 hour period, only 20seconds were on "SQL*Net more data to client".  Time on "SQL*Net more data from client" is much lower at a total time of 5seconds only.  So "Time based" tuning would ignore these two waits.

    Foreground Wait Events

    EventWaits%Time -outsTotal Wait Time (s)Avg wait (ms)Waits /txn% DB time
    SQL*Net more data to client49,701020037.781.50
    SQL*Net more data from client213,915050162.620.34
    db file scattered read1,1580110.880.08
    db file sequential read7,5500105.740.07







    SQL*Net message to client652,102000495.890.04














    SQL*Net message from client652,1020183,327281495.89

    Not that Oracle treats "SQL*Net message from client" as an idle wait so the 183,327seconds of wait time do NOT appear in the Top 5 Timed Foreground Events list.

    I would draw attention to the high number of "more data from client" waits and the correlation with the "message from client" waits.  Either extremely large SQL statements or PLSQL blocks are being submitted very frequently or row inserts with very large array sizes (number of rows per insert) are being received.  In this case, further investigation reveals an ETL loader that does bulk inserts of a number of rows per array.  If we need tuning, tuning the SDU may help.

    Similarly the "more data to client" indicates large data sets are being returned.  The numbers of columns and rows per every "send" are high.

    Instance Activity Stats (from the same AWR)

    StatisticTotalper Secondper Trans



    Requests to/from client654,73845.63497.90




    SQL*Net roundtrips to/from client654,74045.63497.91




    bytes received via SQL*Net from client1,793,072,463124,950.541,363,553.20
    bytes sent via SQL*Net to client552,048,24738,469.57419,808.55




    logical read bytes from cache762,514,227,20053,135,924.61579,858,727.91




    physical read total bytes8,772,479,488611,311.626,671,087.06



    physical write total bytes25,334,243,3281,765,420.7619,265,584.28




    redo size6,373,204,848444,117.794,846,543.61





    1.793billion bytes received in 654K SQL*Net trips is 2741bytes per trip received at 45 messages per second.  Given that it is still only 2,741bytes per trip, possibly the array size could also be tuned with the SDU and TDU.

    So, this is an AWR that doesn't call for tuning but reveals information about how the database is being used.  Large number of rows (large number of columns) being inserted and retrieved in each call.  The Performance Analyst needs to be aware of the nature of the "application" --- here it is not OLTP users but an ETL job that is the "application".  Although the database had more than a hundred sessions a very small number of sessions (possibly 4 ?) were active doing ETL and checking the status of ETL tables during this window.

    Would you care to analyze the other statistics I've listed -- bytes read and bytes written ?




    Extract B : 10.2 AWR

    Snap IdSnap TimeSessionsCursors/Session
    Begin Snap:
     00:00:072284.5
    End Snap:
     23:00:062324.3
    Elapsed:1,379.97 (mins)
    DB Time:11,543.24 (mins)

    I know.  It is really bad and most likely meaningless to get an AWR for a 24hour range.  (I'll not go into the details about why the AWR is for 24hours -- save that I did NOT ask for a 24hour AWR report).

    Top 5 Timed Events
    EventWaitsTime(s)Avg Wait(ms)% Total Call TimeWait Class
    CPU time258,10137.3
    db file sequential read62,150,655208,148330.1User I/O
    db file scattered read28,242,529141,638520.4User I/O
    RMAN backup & recovery I/O1,597,42137,137235.4System I/O
    enq: TX - row lock contention22,27634,9421,5695.0Application
    The RMAN Backup load is expected.  (Why ? Given a 24hour report, I expect RMAN to have run at least once during the day).
    For performance tuning, I would look at the "db file ... read" events and identify and analyze SQL statements and the schema.

    What is the "unusual" event here ?  It is the "enq: TX - row lock contention".  Over a period of 1,380minutes, there were 22,276 Row-Lock Contention waits.  Actually, this application does not have the same load throughout the 23hours.  Most likely, it had load for 15hours only.  So, we had 22,276 Row-Lock Contention waits over 15hours.  That translates to 1,485 waits per hour or one Row-Lock Contention wait every 2.5seconds.  Now, that is a very high frequency.  Either users are locking each other out for a very short while (1.569seconds per wait on average) or there is/are one or more jobs that run at a very high frequency and update a common "reference" table.  I won't reveal my findings here but analysis of the SQL statements indicates what the "problem" is.

    Now, should "Time based performance tuning" be worried about the 5% of time lost on these waits ?  Probably not.  But they do indicate something peculiar in the design of this system.  There are less than 250 user sessions in this OLTP database but there is/are one or more jobs that is/are locking itself every 2.5seconds -- so there is some point of serialisation occurring.  Is that job also accounting for CPU time or 'db file read' time ?  That needs further analysis.

    Both these cases show how a Performance Analyst needs to know how the database is being used.  What sort of jobs are submitted, besides OLTP users ?

    .
    .
    .



    01 November, 2014

    StatsPack and AWR Reports -- Bits and Pieces -- 2

    This is the second post in a series on reading StatsPack and AWR reports.
    (The first is available here)


    Comparing Reports :

    Here are two 9.2 StatsPack extracts from one database:

    Extract A  : 9.2 StatsPack
    Load Profile
    ~~~~~~~~~~~~                            Per Second       Per Transaction
                                       ---------------       ---------------
                      Redo size:             56,031.63              3,084.68
                  Logical reads:             68,286.24              3,759.32
                  Block changes:                314.88                 17.33
                 Physical reads:                842.92                 46.40
                Physical writes:                134.76                  7.42
                     User calls:                271.32                 14.94
                         Parses:                146.46                  8.06
                    Hard parses:                  7.37                  0.41
                          Sorts:                 93.83                  5.17
                         Logons:                  0.33                  0.02
                       Executes:                296.70                 16.33
                   Transactions:                 18.16
    

    Extract B : 9.2 StatsPack
    Load Profile
    ~~~~~~~~~~~~                            Per Second       Per Transaction
                                       ---------------       ---------------
                      Redo size:             89,615.76              2,960.48
                  Logical reads:            210,302.81              6,947.42
                  Block changes:                541.83                 17.90
                 Physical reads:              1,465.04                 48.40
                Physical writes:                161.68                  5.34
                     User calls:                213.82                  7.06
                         Parses:                125.28                  4.14
                    Hard parses:                  6.13                  0.20
                          Sorts:                104.31                  3.45
                         Logons:                  0.35                  0.01
                       Executes:                664.81                 21.96
                   Transactions:                 30.27
    

    Extract B shows a higher volume of activity -- Transactions per second, Redo Size per second, Logical Reads per second.
    Actually, although these are both from the same database but for two different time-windows on different dates.  The fact that the time-windows aren't the same make the comparisons difficult.  Extract A is for an 11-hour window on day 1 and Extract B is for a 6-hour window on day 6.  The two windows aren't strictly comparable.  You have to be very careful when comparing StatsPack or AWR reports, even when from the same database if they don't cover comparable time-windows with similar loads.  The first Report includes non-peak hours, the second is for Peak hours only. The level of activity averaged out over 11hours that include non-peak hours isn't strictly comparable with a 6hour peak window.

    Extract C : 10.2 AWR
    Load Profile
    Per SecondPer Transaction
    Redo size: 520,776.15 50,948.36
    Logical reads: 353,525.71 34,585.98
    Block changes: 1,854.93 181.47
    Physical reads: 14,285.23 1,397.55
    Physical writes: 295.84 28.94
    User calls: 1,265.14 123.77
    Parses: 822.64 80.48
    Hard parses: 15.40 1.51
    Sorts: 168.09 16.44
    Logons: 0.16 0.02
    Executes: 1,040.31 101.78
    Transactions: 10.22 

    Extract D : 10.2 AWR
    Load Profile
    Per SecondPer Transaction
    Redo size: 517,862.01 54,681.39
    Logical reads: 288,341.09 30,446.12
    Block changes: 1,879.27 198.43
    Physical reads: 12,820.96 1,353.77
    Physical writes: 323.90 34.20
    User calls: 1,115.78 117.82
    Parses: 719.39 75.96
    Hard parses: 17.28 1.82
    Sorts: 95.74 10.11
    Logons: 0.15 0.02
    Executes: 935.33 98.76
    Transactions: 9.47 

    Extracts C and D are from the same database for the same time-window on 2 consecutive workdays.  They are comparable.  A difference of 10% for some statistic may not be significant.  Understand that every business, every activity, every system will have some "normal" fluctuations day-to-day.

    .
    .
    .