博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Tuning 04 Sizing the Buffer Cache
阅读量:6042 次
发布时间:2019-06-20

本文共 3487 字,大约阅读时间需要 11 分钟。

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 操作也是很重要的

转载于:https://www.cnblogs.com/moveofgod/p/3629975.html

你可能感兴趣的文章
2.4 salt grains与pillar jinja的模板
查看>>
VDI序曲二十 桌面虚拟化和RemoteApp集成到SharePoint 2010里
查看>>
移动互联网,入口生死战
查看>>
JAVA多线程深度解析
查看>>
Kafka High Level Consumer 会丢失消息
查看>>
时间轴
查看>>
java 获取系统当前时间的方法
查看>>
Ubuntu 10.04升级git 到1.7.2或更高的可行方法
查看>>
Spring Security4实战与原理分析视频课程( 扩展+自定义)
查看>>
第一周博客作业
查看>>
thinkpython2
查看>>
oracle recyclebin与flashback drop
查看>>
svmlight使用说明
查看>>
Swing 和AWT之间的关系
查看>>
Mysql设置自增长主键的初始值
查看>>
Android计时器正确应用方式解析
查看>>
获取post传输参数
查看>>
ASP生成静态页面的方法
查看>>
HDU 1325 Is It A Tree? 判断是否为一棵树
查看>>
Shell命令-文件压缩解压缩之gzip、zip
查看>>