楼主: zhanghw31961

[精华] dbw是把cold dirty buffer 写入data file,还是把所有dirty buffers 写入?

[复制链接]
论坛徽章:
0
11#
 楼主| 发表于 2002-8-1 17:52 | 只看该作者
First  thank  Yong Huang

after look your answer , i  look the Database Concepts
Release again and  think for a long time. i get my conclusion  as following:

under the first condition

At specific times, all modified database buffers in the SGA are written to the datafiles by DBWn. (This event is called a checkpoint. )The checkpoint process is responsible for signaling DBWn at checkpoints and updating all the datafiles and control files of the database to indicate the most recent checkpoint.

the DBWn which was signalled by CKPT will write all dirty buffer to data file . this is  the  bottleneck commented by Yong Huang .

and  before DBWn wirte , the LGWR will write all redo records associated.

under the second condition

When a server process cannot find a clean reusable buffer after scanning a threshold number of buffers, it signals DBWn to write. DBWn writes cold dirty buffers (not all dirty buffer) to data files.

---------------------------
我觉得我已经把这个问题搞清楚了,在大家的帮助下。
thank Yong Hong again, and thank all brothers

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
12#
发表于 2002-8-1 18:09 | 只看该作者

我希望你说明一下你下面的这段话是来自哪个版本的

When a server process cannot find a clean reusable buffer after scanning a threshold number of buffers, it signals DBWn to write. DBWn writes cold dirty buffers (not all dirty buffer) to data files.

因为根据我了解的信息,至少在816以后似乎已经发生了变化,不需要这么做
这是因为所谓的ckpt的机制已经和以前的版本发生了变化
以前是去扫描内存,根据块头信息来决定是否要写入磁盘,当扫描到一定块数却还没有发现脏数据块,为了尽快完成这次ckpt避免让数据库过分的等待,所以采取了这么一个“过渡”策略。
但后来已经发生了变化,ckpt写的数据块不再是去数据缓冲区扫描查找,这个开销太大了,现在脏数据块已经有了一个脏数据块队列,ckpt发生的时候,dbwr只需要按照这个脏数据块队列顺序的写入磁盘就行了

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
13#
发表于 2002-8-2 01:45 | 只看该作者

Re: 我希望你说明一下你下面的这段话是来自哪个版本的

最初由 biti_rainy 发布
[B]When a server process cannot find a clean reusable buffer after scanning a threshold number of buffers, it signals DBWn to write. DBWn writes cold dirty buffers (not all dirty buffer) to data files.

因为根据我了解的信息,至少在816以后似乎已经发生了变化,不需要这么做
这是因为所谓的ckpt的机制已经和以前的版本发生了变化
以前是去扫描内存,根据块头信息来决定是否要写入磁盘,当扫描到一定块数却还没有发现脏数据块,为了尽快完成这次ckpt避免让数据库过分的等待,所以采取了这么一个“过渡”策略。
但后来已经发生了变化,ckpt写的数据块不再是去数据缓冲区扫描查找,这个开销太大了,现在脏数据块已经有了一个脏数据块队列,ckpt发生的时候,dbwr只需要按照这个脏数据块队列顺序的写入磁盘就行了
[/B]


biti_rainy,

The documentation still says that in 8i (didn't check 9i) and I believe it's correct. You still don't seem to make a distinction between DBWn regular writes and DBWn checkpoint (I also suggest you not use the word "ckpt" because it sounds like the CKPT background process). These two types of writes are different. What you're referring to is the checkpoint queue. Beginning with Oracle 8, Oracle maintains that queue separate from other LRU lists so at checkpoint DBWn only needs to write all buffers listed on that queue to disks. But regular writes still follow the LRU algorithm. Of course the algorithm is based on touch count now, beginning with 8i.

Please read
http://www.ixora.com.au/q+a/0103/07160329.htm
http://www.ixora.com.au/newsletter/2001_05.htm#incremental

Yong Huang

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
14#
发表于 2002-8-2 08:30 | 只看该作者

thanks

我想由于自己对于这类问题很少和人交流,在说法上总是出很多让人误会的地方,就象你所说的,如果自己写本书,错误百出


现在脏数据块已经有了一个脏数据块队列:  这个说法很不好,这会让人认为是数据块已经实际的复制出来存在于另外的地方了。

事实上,关于  这些  lists,我想,用一个链状指针来形容是不是更恰当?

使用道具 举报

回复
论坛徽章:
7
ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-03-01 11:06:23ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41
15#
发表于 2002-8-2 10:45 | 只看该作者
请继续探讨!

使用道具 举报

回复
论坛徽章:
0
16#
 楼主| 发表于 2002-8-2 14:03 | 只看该作者
Hi biti_rainy,

Oracle9i Database Concepts Release 2 (9.2)  Part Number A96524-01
中是这么讲的:
IF an Oracle user process searches the threshold limit of buffers without finding a free buffer, the process stops searching the LRU list and signals the DBW0 background process to write some of the dirty buffers to disk.

我觉得上面说的 some of the dirty buffers (即将被DBW0写入disk)也就是 write list 中的buffer ,也就是cold dirty buffer; DBW0在把dirty buffer 写入磁盘后,会顺便把这些buffer标志为clean ,并且插入LRU队列的 LRU 端.

而在checkpoint发生时,DBW0 会把all dirty buffer 写入磁盘。

请问,我的这个理解对吗?

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
17#
发表于 2002-8-2 14:42 | 只看该作者

o

IF an Oracle user process searches the threshold limit of buffers without finding a free buffer, the process stops searching the LRU list and signals the DBW0 background process to write some of the dirty buffers to disk.
我想这句话你理解的有歧义:如果oracle的用户进程在LRU上试图查找free  buffer(找来给自己使用),但找了the threshold limit of buffers 还没有找着,(这个时候它将认为脏数据块太多)于是通知dbwr把一些脏数据块写如磁盘。这样将让用户进程在分配数据缓冲区的时候迅速的找到可用缓冲区而不至于因为搜索了很久仍然没有找着非 dirty buffer而继续搜索,这将提高效率。我想关于这一点很容易理解是不是

事实上,用户进程在搜索的这个过程中应该是从 LRU的低端开始的,但这里没有说,对么?  

使用道具 举报

回复
论坛徽章:
0
18#
 楼主| 发表于 2002-8-2 14:51 | 只看该作者
hi ,biti_rainy
as you say :
(这个时候它将认为脏数据块太多)于是通知dbwr把一些脏数据块写如磁盘。

关键的问题就是:你所说的一些脏数据块,这些脏数据块是哪些脏数据快?我认为就是write list 中所有的数据块,你认为不是吗?那应该是什么呢?难道还会包括 LRU list 中尚未被server proess 放进write list 的 hot dirty buffer 吗?

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
19#
发表于 2002-8-2 15:16 | 只看该作者

关键的问题就是:你所说的一些脏数据块,这些脏数据块是哪些脏数据快 :

但这些数据块实际上跟 write list 中所有的数据块 本来就应该是一回事,数据块的物理拷贝只应该有一份,write list 按照书上的说法是redo  list,但由于存在一个块可能被更新超过1次的情况,所以有可能hot  dirty  buffer位于write list的低端(write list的顺序是不会改变的),这样可能写的时候,既包含了LRU 高端的也有低端的

我上面描述的时候说了比较含糊的 “于是通知dbwr把一些脏数据块写如磁盘”,果然被你把这个地方抓出来了,因为关于这点,我没有从任何地方获得信息,只能说按照我认为的一种合理的方式来推测了。事实上因为经常有这样一种感觉,那就是我费劲心思琢磨后,如果发现oracle的算法(做法)不是最好的,明显有缺陷并可以改进,那么很可能就是我自己理解错了。而oracle实际上是选择了更合理的做法。

关于这里,当用户进程发现这个后,应该就触发检查点(也就是所谓的统治 dbwr写)。我想不应该是在检查点以外还存在决定让dbwr写数据文件的情况把,这个  the threshold limit of buffers  ,是跟哪个参数相关,是不是 跟  fast_start_io_target  什么的有关系……再求证一下吧

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
20#
发表于 2002-8-2 16:34 | 只看该作者
Cache buffer managerment is composed of three internal structures:cache buffer chains and two chain lists,the dirty list and LRU list. In different events, sometimes DBWR will write part of the whole dirty blocks, sometimes DBWR will write all of the dirty blocks, sometimes DBWR write from dirty list, sometimes DBWR direct write dirty blocks from LRU list. One of this event was Yong Huang mentioned above, DBWR write dirty blocks every there seconds timeout which prevents DBWR from being too idle. In general, DBWR is a server process whose main function is to manage the buffer cache by making buffers available when requested and “clean it” when dirty.  There are some undocument init parameters control the internal behavior, such as foreground scan depth(influenced by init.ora _db_block_max_scan_count) etc, but  it doesn’t recommend to change these undocument parameters.
Biti_rainy, Oracle9i uses new parameter FAST_START_MTTR_TARGET to enable you to specify the number of seconds the database takes to perform crash recovery of a single instance.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表