How to Read Buffer Cache Advisory Section in AWR and Statspack Reports. (文档 ID 754639.1)

In this Document

 Goal
 Solution

APPLIES TO:

Oracle Database - Enterprise Edition - Version 9.0.1.0 to 11.2.0.3 [Release 9.0.1 to 11.2]
Information in this document applies to any platform.
Oracle Server Enterprise Edition - Version: 9.0.1.0 to 11.2


GOAL

One widespread point of view is that in order to lessen the amount of physical I/O, the database buffer cache size should be increased as much as physical memory on the box for this database. That however does not take into account the overhead of serving the bigger buffer cache (at Oracle level, longer search for a required buffer in a much bigger space, in particular),  which may outweigh benefits of  further reduction in the amount of physical reads, especially if such a reduction is small compared with the portion of the increased buffer cache. Finding the right balance is a difficult task.  Buffer Cache Advisory section  is a way of addressing this task, as it shows correspondence between the size of the buffer cache and estimated number of physical reads in the context of prospective variations of this size up and down.  As seen further from the note, interpreting data in this section is simplified with use of two columns 'Size Factor'  and 'Estimated Physical Read Factor'.

SOLUTION

There are two conditions for the Buffer Cache Advisory section to appear in the AWR and Statspack reports:

1. buffer cache should not be specified with the parameter db_block_buffers

2. parameter db_cache_advice should be set  to 'on' which is default value.

Parameter db_cache_size,  if specified, defines the size of default buffer cache.  If  in addition sga_target > 0 is specified,  db_cache_size defines the minimal size of the default buffer cache, and Oracle may allocate bigger size.  If sga_target >  0 is specified and db_cache_size is not,  then the size of default buffer cache will be allocated by Oracle automatically without  low limit.  Parameter db_block_size determines the size of the buffers in the default buffer cache. 

Apart from default buffer cache - pool (or subpool) which is always present, buffer cache may have other subpools. Buffer Cache Advisory section  will then have separate subsection for each of those subpools distinguished from others by a letter in the very left column  of the section as follows: 

'D' - Default buffer cache (always present), 
'K' - Keep buffer cache (if db_keep_cache_size parameter is defined), 
'R' - Recycle buffer cache (if db_recycle_cache_size parameter is defined), 
<N> - Caches for non-default block sizes (if defined with parameters db_<N>k_cache_size) 

Each subsection is read in the same way.  So we will illustrate the idea on three real examples for default buffer  cache  ('D'); other subpools were not defined in the buffer caches of  the databases chosen for these examples.

1.   In this first example, buffer cache is likely to  be reduced by  ~2 times.

Buffer Pool Advisory for DB: AAA  Instance: aaa  End Snap: 5418
-> Only rows with estimated physical reads >0 are displayed
-> ordered by Block Size, Buffers For Estimate (default block size first)
        Size for       Size      Buffers for    Est Physical    Estimated
P    Estimate (M) Factr    Estimate       Read Factor     Physical Reads
--- ------------ ----- ---------------- ------------- ------------------
D          2,464    .1             155,232          1.21         3,862,380,200
D          4,928    .2             310,464          1.16         3,692,714,242
D          7,392    .3             465,696          1.12         3,583,136,307
D          9,856    .4             620,928          1.10         3,510,375,736
D         12,320    .5            776,160          1.08         3,458,570,629
D         14,784    .6            931,392          1.07         3,410,460,690
D         17,248    .7         1,086,624          1.05         3,353,613,024
D         19,712    .8         1,241,856          1.03         3,297,779,557
D         22,176    .9         1,397,088          1.02         3,245,039,654
D         24,576   1.0        1,548,288          1.00         3,196,928,940
D         24,640   1.0        1,552,320          1.00         3,195,682,435
D         27,104   1.1        1,707,552          0.99         3,149,477,523
D         29,568   1.2        1,862,784          0.97         3,106,095,379
D         32,032   1.3        2,018,016          0.96         3,064,977,501
D         34,496   1.4        2,173,248          0.95         3,025,264,713
D         36,960   1.5        2,328,480          0.93         2,985,276,865
D         39,424   1.6        2,483,712          0.92         2,945,556,353
D         41,888   1.7        2,638,944          0.91         2,907,168,174
D         44,352   1.8        2,794,176          0.90         2,870,031,411
D         46,816   1.9        2,949,408          0.89         2,833,034,310
D         49,280   2.0        3,104,640          0.87         2,796,157,717
          -------------------------------------------------------------

 The Advisory section is read row by row.   You start from the row where third field  'Size Factor'= 1.0.  If there is more than one such row you can choose any one (below) as figures in all of them  for our purpose  will be close. 

       Size for     Size     Buffers for    Est Physical  Estimated 
P      Estimate (M) Factr    Estimate       Read Factor   Physical Reads 
... 
D      24,576       1.0      1,548,288      1.00          3,196,928,940 
...

Rows with 'Size Factor' = 1.0 show approximate actual size of the buffer cache during the time interval of the AWR or statspack report. The size itself is shown in the 2nd column 'Size for Estimate(M)' - figure 24,576 in Mb in the example, it has been allocated either automatically if sga_target > 0 or manually.

Last field of this row - 'Estimated Physical Reads' - shows estimation of physical reads for 24,576Mb size of default buffer cache; it is 3,196,928,940. Note also 'Physical Read Factor' 1.0  in the same row.

Figure 3,196,928,940 is absolute figure.  Although this can be big as in this example, it is not indicative as such without comparing with figures from other rows in this column.

From this row with 'Size Factor' = 1.0 and 'Est Physical Read Factor' = 1.0, you will look at the neighboring  rows up and down. 

Rows down  show how increasing of buffer cache size would influence reduction of 'Estimated Physical Reads'.  Note  how 'Size Factor' increases and 'Estimated Phys Read Factor' decreases.

Rows up show how reduction of buffer cache size would influence increasing of 'Estimated Physical Reads'.  Note how 'Size Factor' decreases and 'Estimated Phys Read Factor' increases. 

Changing 'Size Factor' shows ratio of the proposed size of the buffer cache (increased or decreased)  to the approximate actual size currently in use found in the row with 'Size Factor' = 1.0.

Changing 'Estimated Phys Read Factor' shows ratio of the estimated number of Physical Reads for the proposed (increased or decreased) size of the buffer cache to the number of Physical Reads calculated for the current size of buffer cache found in the row with 'Estimated Phys Read Factor' = 1.0.

The two  'Size Factor'  and  'Estimated Phys Read Factor'  columns show how quickly or slowly number of  'Estimated Physical Reads' goes down or up if the size of the buffer cache would go up or down. They greatly simplify evaluation of the buffer cache situation, as you do not need  to compare big figures  in columns 'Size for Estimate'  and especially 'Estimated Physical Reads'.

So, looking at the rows down from the row where you started ('Size Factor' =1.0  and  'Estimated Physical Read Factor' = 1.0), you see that possible increases of the buffer cache size  ('Size Factor' = 1.2 ... 1.5 ... 1.7 ...)  would lead to only very moderate reduction of estimated number of physical reads  ('Estimated Physical Read Factor' = 0.97 ... 0.93 ... 0.91 ...). 

On the other hand,  looking at the rows up from the row where you started ('Size Factor' =1.0  and  'Estimated Physical Read Factor' = 1.0), you see that possible reductions of the buffer cache size ('Size Factor' =  0.8 ... 0.5 ...) would lead to only very small increase in  the estimated number of physical reads ('Estimated Physical Read Factor' = 1.03 ... 1.08 ...).  In other words,  reduction of the buffer cache by approximately 2 times would lead to quite insignificant  increase in the number of physical reads - strong argument for the actual buffer cache reduction. 

2.  In the second example Buffer Cache advisory section, it shows that buffer cache size is not sufficient and should be increased. 

Buffer Pool Advisory for DB: BBB  Instance: bbb  End Snap: 963
-> Only rows with estimated physical reads >0 are displayed
-> ordered by Block Size, Buffers For Estimate
        Size for       Size      Buffers for  Est Physical     Estimated
P   Estimate (M) Factr    Estimate      Read Factor     Physical Reads
--- ------------ ----- ---------------- ------------- ------------------
D             48       .1            6,006           1.99         8,026,815,668
D             96       .2           12,012          1.94         7,842,306,468
D            144      .3           18,018          1.88         7,608,049,193
D            192      .4           24,024          1.82         7,337,627,088
D            240      .5           30,030          1.73         6,987,739,083
D            288      .6           36,036          1.62         6,521,373,076
D            336      .7           42,042          1.49         5,996,380,018
D            384      .8           48,048          1.36         5,493,817,015
D            432      .8           54,054          1.22         4,940,387,234
D            480      .9           60,060          1.08         4,377,859,080
D            512     1.0          64,064          1.00         4,037,280,095
D            528     1.0          66,066          0.95         3,843,900,452
D            576     1.1          72,072          0.79         3,203,273,501
D            624     1.2          78,078          0.67         2,707,571,042
D            672     1.3          84,084          0.54         2,196,252,661
D            720     1.4          90,090          0.41         1,673,648,182
D            768     1.5          96,096          0.29         1,175,241,425
D            816     1.6         102,102         0.16            637,573,261
D            864     1.7         108,108         0.06            235,313,716
------------------------------------------------------------------------

You will again  start from the row with  'Size Factor' = 1.0 and  'Estimated Physical Read Factor'=1.0 and look at the rows up and down. 

      Size for     Size   Buffers for  Est Physical  Estimated  
P     Estimate (M) Factr  Estimate     Read Factor   Physical Reads  
...  
D     512          1.0    64,064       1.00          4,037,280,095
...  

 

Rows up show that 'Estimated Physical Read Factor' figures grow faster than respective 'Size Factor' figures reduce.   So reduction of the buffer cache is out of question.

Rows down however show that rate of increase of the 'Size Factor' is noticeably less than rate of reduction of the 'Estimated Physical Read Factor'.  This means that relatively small increase in the buffer cache size (1.3 ... 1.5 ... 1.7)  would lead to much bigger reduction in the Estimated Physical Reads (0.54 ... 0.29 ... 0.06). So that any increase of the buffer cache size would be highly beneficial, provided there are conditions for that in terms of physical RAM available for this database, total SGA size and sizes of other pools within SGA, particularly shared pool size.

3.  The third example shows buffer cache advisory section where the size of the buffer cache is considered adequate.

Buffer Pool Advisory for DB: CCC  Instance: ccc  End Snap: 963
-> Only rows with estimated physical reads >0 are displayed
-> ordered by Block Size, Buffers For Estimate

      Size for         Size      Buffers for  Est Physical     Estimated 
P   Estimate (M) Factr     Estimate      Read Factor     Physical Reads 
--- ------------ ----- ---------------- ------------- ------------------ 
D         1,024       .1          127,040          5.92       11,256,788,041 
D         2,048       .2          254,080          3.94        7,490,130,971 
D         3,072       .3          381,120          3.11        5,914,495,655 
D         4,096       .4          508,160          2.48        4,703,487,198 
D         5,120       .5          635,200          2.02        3,831,422,083 
D         6,144       .6          762,240          1.69        3,210,955,247 
D         7,168       .7          889,280          1.45        2,749,235,779 
D         8,192       .8          1,016,320       1.26        2,388,256,258 
D         9,216       .9          1,143,360       1.11        2,109,607,477 
D         10,240     1.0        1,270,400       1.00        1,900,250,999 
D         11,264     1.1        1,397,440       0.91        1,726,824,588 
D         12,288     1.2        1,524,480       0.84        1,592,568,163 
D         13,312     1.3        1,651,520       0.78        1,488,635,936 
D         14,336     1.4        1,778,560       0.74        1,402,347,804 
D         15,360     1.5        1,905,600       0.70        1,330,963,173 
D         16,384     1.6        2,032,640       0.67        1,269,829,390 
D         17,408     1.7        2,159,680       0.64        1,215,972,327 
D         18,432     1.8        2,286,720       0.61        1,166,312,978 
D         19,456     1.9        2,413,760       0.59        1,117,790,332 
D         20,480     2.0        2,540,800       0.57        1,073,867,838

The row to start consideration here is where 'Size Factor' = 1.0 and 'Estimated Physical Read Factor' = 1.00:

    Size for    Size   Buffers for   Est Physical    Estimated     
P   Estimate(M) Factr  Estimate      Read Factor     Physical Reads  
... 
D    10,240     1.0    1,270,400     1.00            1,900,250,999  
...

It is for the current approximate size of the buffer cache 10,240 Mb with Estimated Physical Reads for this size 1,900,250,999. 

From this row you follow the two columns: 'Size Factor' and 'Estimated Physical Read Factor' in both directions up and down. You see that rate of change of the 'Estimated Physical Read Factor' compare with the rate of change of the 'Size Factor' is such  that we won't get substantial gains from increasing or decreasing the size of the buffer cache. So interpretation of this or similar data in the advisory section is that the current actual size of the buffer cache is within acceptable range. In cases when sga_target > 0  and db_cache_size is determined automatically,  similar data would mean that allocated by Oracle size of the buffer cache is  fairly balanced, i.e. not too small to have excessive number of physical reads and not too big  to have unnecessary overhead while serving a bigger buffer cache.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值