Buffer Cache 特性

The buffer cache holds copies of the data blocks from the data files. Because the buffer cache is a part of the SGA, these blocks can be shared by all users. The server processes read data from the data files into buffer cache.(是server process 将数据从硬盘读取到内存的) To improve performance, the server process sometimes reads multiple blocks in a single read. The DBWn process writes data from the buffer cache into the data files. To improve performance, DBWn writes multiple blocks in a single write.

DB_CACHE_SIZE: specifies the size of default buffer pool in bytes.

DBA_KEEP_CACHE_SIZE: specifies the size of keep buffer pool in bytes.

DBA_RECYCLE_CACHE_SIZE: specifies the size of recycle buffer pool in bytes.

The blocks in the buffer cache are managed using two lists:

- The least recently used(LRU) list is used to keep the most recently accessed blocks in memory. The blocks on the list are organized from the most recently used(MRU) to the recently used. (最后最多被使用)

- The dirty list points to blocks in the buffer cache that have been modified but not written to disk.

Blocks in the buffer cache can be in one or three states:

- Free buffers are blocks that have the same image on disk and in memory. These blocks are availiable for reuse.

- Dirty blocks are blocks with a different image in memory than the image on disk. These blocks must be written to disk before they can be reused.

- Pinned buffers are memory blocks that are currently being accessed.

When a server needs a block, it follows these steps to read the block:

1. Firstm the server checks wether the required block is available in the buffer cache using a hash function. If the block is found, it is moved to another point in LRU list away from the LRU end. This is a logical read, because no actual I/O took place. If the block is not found in the buffer cache, the server process has to read the block from the data file.

2. Before reading from the data file, the server process searches the LRU list for a free block.

3. While searching the LRU list, the server process moves dirty blocks to the dirty list.

4. If the dirty list exceeds its size threshold, the server signals DBWn to flush dirty blocks from the data buffer cache. If the server cannot find a free block within a search threshold, it signals DBWn to flush.

5. After a free block is found, the server reads the block from the data file into the free block in the database buffer cache. Oracle server process moves the block away from the LRU end of the LRU list.

6. If the block is not consistent, the server rebuilds an earlier version of the block from the current block and rollback segments.

7. Dirty List Exceeds its Size Threshold: A server process finds that the dirty list has exceeded its size threshold, so it signals DBWn to flush. DBWn writes out the blocks on the dirty list.

8. Search Threshold Exceeded: A server process that cannot find a free block on the LRU list within the search threshold signals DBWn to flush dirty blocks. DBWn writes out dirty blocks directly from the LRU list.

可见, buffer cache 还是要提高命中率的问题, 即 让 server process 想找的block恰好在memory中, 直接进行操作.

To improve the cache hit ratio, the DBA can:

  • Increase the size of buffer cache
  • Use multiple buffer pools to separate blocks by access characteristics
  • Configure the tables to be cached in memory
  • Configure to bypass the buffer cache for sorting and parallel reads if possible.

另外一点可以看出, 监控系统的 I/O 操作也是很重要的

Tuning 04 Sizing the Buffer Cache的更多相关文章

  1. Page Cache buffer Cache

    https://www.thomas-krenn.com/en/wiki/Linux_Page_Cache_Basics References Jump up ↑ The Buffer Cache ( ...

  2. Linux中的Buffer Cache和Page Cache echo 3 > /proc/sys/vm/drop_caches Slab内存管理机制 SLUB内存管理机制

    Linux中的Buffer Cache和Page Cache echo 3 > /proc/sys/vm/drop_caches   Slab内存管理机制 SLUB内存管理机制 http://w ...

  3. buffer cache —— buffer busy waits/read by other session

    oracle提供非常精确.有效的row level lock机制,多个用户同时修改数据时,为了保护数据,以块为单位挂起锁的情况不会发生.但这不太正确.以块为单位的锁虽然不存在,但正因为oracle I ...

  4. tuning 03 Sizing the Share pool

    share pool : (组成) library cache: stores shared sql and pl/sql code (包含 statement text, parsed code, ...

  5. 相克军_Oracle体系_随堂笔记005-Database buffer cache

    本章主要阐述SGA中的Database buffer cache. Buffer cache { 1.pin (读写瞬间的状态) 2.clean 3.dirty 4.unused } --Databa ...

  6. Buffer cache hit ratio性能计数器真的可以作为内存瓶颈的判断指标吗?

    Buffer cache hit ratio官方是这么解释的:“指示在缓冲区高速缓存中找到而不需要从磁盘中读取的页的百分比.” Buffer cache hit ratio被很多人当做判断内存的性能指 ...

  7. Buffer Cache

    Buffer Cache Buffer Cache是SGA区中专门用于存放从数据文件中读取的的数据块拷贝的区域.Oracle进程如果发现需要访问的数据块已经在buffer cache中,就直接读写内存 ...

  8. Oracle buffer cache

    Buffer Cache buffer cache 结构图 HASH链 ORACLE使用HASH算法,把buffer cache中每个buffer的buffer header串联起来,组成多条hash ...

  9. Oracle优化 -- 关于Database Buffer Cache相关参数DB_CACHE_SIZE的优化设置

    select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v ...

随机推荐

  1. next 前缀字符串

    我们在一个母字符串中查找一个子字符串有很多方法.KMP是一种最常见的改进算法,它可以在匹配过程中失配的情况下,有效地多往后面跳几个字符,加快匹配速度. 当然我们可以看到这个算法针对的是子串有对称属性, ...

  2. vue - 条件语句

    1.与小程序不同之处一,小程序无论变量还是常亮都可以用双向绑定来解决{{}},而vue一旦双(单)引号包起来以后就失效了. 2.注意一点,切记双引号注意不要混淆哈,这里是一排双引号包单引号,那里是一排 ...

  3. jackson 转换 yyyy-MM-dd格式 少了一个小时问题解决(仅限中国)

    如果你在你的实体类上面指定了@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") 然后发现换成json后 小 ...

  4. jQuery中的append()和prepend(),after()和before()的差别

    jQuery中的append()和preappend(),after()和before()的差别 append()和prepend() 如果 <div class='a'> //<- ...

  5. Drupal启动阶段之四:系统变量

    Drupal的系统变量是指保存在后台数据库variable表中的一些参数设置,透过variable_get()和variable_set()存取: 先看一看_drupal_bootstrap_vari ...

  6. StarUML 破解方法

    在安装目录的:StarUML\www\license\node 找到LicenseManagerDomain.js 在 try 前面加上: return { name:"0xcb" ...

  7. 详解Android中那些酷炫返回方式的实现

    Android手机都会有返回键,不管是实体键,还是虚拟键.Android用户主要也都是通过这个返回键操控页面返回方式的,不比IOS逼格甚高的只保留一个操作键.这种方式是最普遍的返回方式,还有一种也是比 ...

  8. 电子商务(电销)平台中订单模块(Order)数据库设计明细(转载)

    电子商务(电销)平台中订单模块(Order)数据库设计明细 以下是自己在电子商务系统设计中的订单模块的数据库设计经验总结,而今发表出来一起分享,如有不当,欢迎跟帖讨论~ 订单表 (order)|-- ...

  9. 解决Win10系统下 C# DateTime 出现星期几的问题 解决ASP.NET MVC 接受Request Playload参数问题

    解决Win10系统下 C# DateTime 出现星期几的问题 昨天晚上写代码的时候偶然发现 DateTime 里出现了星期几,当时一阵凌乱,去网上百度没有详细解决办法,很多人说可以用用 ToStri ...

  10. jmeter ---测试TCP服务器/模拟发送TCP请求

    jmeter测试TCP服务器/模拟发送TCP请求 jmeter测试TCP服务器,使用TCP采样器模拟发送TCP请求. TCP采样器:打开一个到指定服务器的TCP / IP连接,然后发送指定文本并等待响 ...