eygle.com   eygle.com
eygle.com  
 

« February 19, 2006 | Blog首页 | February 21, 2006 »



February 20, 2006

Oracle7.3.4 Checkpoint行为研究

作者:eygle

出处:http://blog.eygle.com

于检查点的描述,很多文档上大都是简单的一句话,通常是:

When a checkpoint occurs, Oracle must update the headers of all datafiles to record the details of the checkpoint. This is done by the CKPT process. The CKPT process does not write blocks to disk; DBWn always performs that work.

这段描述实际上过于简略了,在不同的版本中,Oracle的检查点策略一直在不断的调整优化,而从Oracle7之后,Oracle不在文档中透漏更多的信息给我们.

在Oracle7中,通过跟踪CKPT进程我们可以看到,当我们手工执行检查点时:

C:\orant\BIN>SVRMGR23.EXE
Oracle Server Manager Release 2.3.4.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Workgroup Server Release 7.3.4.0.0 - Production
With the distributed option
PL/SQL Release 2.3.4.0.0 - Production
SVRMGR> connect internal
Connected to an idle instance.
SVRMGR> startup
ORACLE instance started.
Total System Global Area      99967716 bytes
Fixed Size                       35760 bytes
Variable Size                 58808116 bytes
Database Buffers              40960000 bytes
Redo Buffers                    163840 bytes
Database mounted.
Database opened.
SVRMGR> alter system checkpoint;
Statement processed. 

Oracle后台CKPT进程如下动作:

WAIT #0: nam='control file sequential read' ela= 0 p1=1 p2=1 p3=1
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=4 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=5 p3=1
WAIT #0: nam='db file sequential read' ela= 0 p1=1 p2=1 p3=1
WAIT #0: nam='db file single write' ela= 0 p1=1 p2=1 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=6 p3=1
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=8 p3=1
WAIT #0: nam='db file sequential read' ela= 0 p1=2 p2=1 p3=1
WAIT #0: nam='db file single write' ela= 0 p1=2 p2=1 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='db file sequential read' ela= 0 p1=3 p2=1 p3=1
WAIT #0: nam='db file single write' ela= 0 p1=3 p2=1 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='db file sequential read' ela= 0 p1=4 p2=1 p3=1
WAIT #0: nam='db file single write' ela= 0 p1=4 p2=1 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='rdbms ipc message' ela= 0 p1=300 p2=0 p3=0 

注意,这里的等待事件 "db file single write" 既是对于数据文件头的更新,以刷新数据文件记录的检查点信息.

同样在Oracle7中,当发生log switch之后,触发检查点,CKPT进程需要更新数据文件头及控制文件:

SVRMGR> select * from v$version;
BANNER
----------------------------------------------------------
Oracle7 Workgroup Server Release 7.3.4.0.0 - Production
PL/SQL Release 2.3.4.0.0 - Production
CORE Version 3.5.4.0.0 - Production
TNS for 32-bit Windows: Version 2.3.4.0.0 - Production
NLSRTL Version 3.2.4.0.0 - Production
5 rows selected.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR>

我们看CKPT进程的动作: 

WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=1 p3=1
WAIT #0: nam='control file sequential read' ela= 0 p1=1 p2=1 p3=1
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=3 p3=1
WAIT #0: nam='rdbms ipc message' ela= 0 p1=202 p2=0 p3=0
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=1 p3=1
WAIT #0: nam='control file sequential read' ela= 0 p1=1 p2=1 p3=1
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=3 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=6 p3=1
WAIT #0: nam='db file sequential read' ela= 0 p1=1 p2=1 p3=1
WAIT #0: nam='db file single write' ela= 0 p1=1 p2=1 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=5 p3=1
WAIT #0: nam='control file sequential read' ela= 0 p1=0 p2=7 p3=1
WAIT #0: nam='db file sequential read' ela= 0 p1=2 p2=1 p3=1
WAIT #0: nam='db file single write' ela= 0 p1=2 p2=1 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='db file sequential read' ela= 0 p1=3 p2=1 p3=1
WAIT #0: nam='db file single write' ela= 0 p1=3 p2=1 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='db file sequential read' ela= 0 p1=4 p2=1 p3=1
WAIT #0: nam='db file single write' ela= 0 p1=4 p2=1 p3=1
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='control file parallel write' ela= 0 p1=2 p2=2 p3=2
WAIT #0: nam='rdbms ipc message' ela= 0 p1=300 p2=0 p3=0 

在Oracle7中,logfile switch 和 alter system checkpoint都会触发complete checkpoint, 此时DBWR会把Dirty Buffer写出到数据文件. 从DBWR的跟踪我们可以轻易的看出.

WAIT #0: nam='rdbms ipc message' ela= 0 p1=300 p2=0 p3=0
WAIT #0: nam='db file parallel write' ela= 0 p1=2 p2=3 p3=3
WAIT #0: nam='db file parallel write' ela= 0 p1=2 p2=3 p3=3
WAIT #0: nam='db file parallel write' ela= 0 p1=1 p2=2 p3=2
WAIT #0: nam='rdbms ipc message' ela= 0 p1=218 p2=0 p3=0

而从Oracle8i开始引入增量检查点之后,Oracle的检查点行为就发生了改变(待续...).

Posted by eygle at 2:42 PM | Comments (4)


Google FeedFetcher的更新频率

作者:eygle

出处:http://blog.eygle.com

检查网站的访问日志,偶然发现居然有Google FeedFetcher的访问日志,顺便计算一下Google的更新频率:

1.发现Google每2小时抓取一次index.xml文件,当然有更新时才会具体刷新内容:

grep FeedFetcher-Google access_log.20060217|awk '{print $4 " " $7 " " $12 }'|grep index.xml
[17/Feb/2006:01:34:16 /blog/index.xml "FeedFetcher-Google;
[17/Feb/2006:03:34:09 /blog/index.xml "FeedFetcher-Google;
[17/Feb/2006:05:34:44 /blog/index.xml "FeedFetcher-Google;
[17/Feb/2006:07:34:05 /blog/index.xml "FeedFetcher-Google;
[17/Feb/2006:09:34:00 /blog/index.xml "FeedFetcher-Google;

2.Google同样每2小时抓取一次index.rdf文件更新

grep FeedFetcher-Google access_log.20060217|awk '{print $4 " " $7 " " $12 }'|grep index.rdf
[17/Feb/2006:00:34:20 /blog/index.rdf "FeedFetcher-Google;
[17/Feb/2006:02:34:25 /blog/index.rdf "FeedFetcher-Google;
[17/Feb/2006:04:34:17 /blog/index.rdf "FeedFetcher-Google;
[17/Feb/2006:06:34:12 /blog/index.rdf "FeedFetcher-Google;

实际上也就是每小时要访问一次.

Google.Reader

顺便看了一下Google Reader,也有很多新颖之处,左侧边栏的动感及切换处理感觉很好,相信早晚有一天,Google这个Reader会被越来越多的人所认可和使用.

那么其他的Feed订阅站点呢?

FeedBurner每半小时访问一次:

grep FeedBurner access_log.20060217 |awk '{print $4 " " $7 " " $12 }'
[17/Feb/2006:00:11:42 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:00:41:50 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:01:13:20 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:01:45:48 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:02:16:13 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:02:45:58 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:03:31:57 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:04:06:00 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:04:45:06 /blog/atom.xml "FeedBurner/1.0
[17/Feb/2006:05:15:41 /blog/atom.xml "FeedBurner/1.0 

Bloglines是每半小时一次,但是每次都会依次抓取atom.xml,index.rdf,index.xml文件:

grep Bloglines access_log.20060217 |awk '{print $4 " " $7 " " $12 }'
[17/Feb/2006:00:07:26 /blog/atom.xml "Bloglines/3.0-rho
[17/Feb/2006:00:09:13 /blog/index.rdf "Bloglines/3.0-rho
[17/Feb/2006:00:09:14 /blog/index.xml "Bloglines/3.0-rho
[17/Feb/2006:00:35:52 /blog/atom.xml "Bloglines/3.0-rho
[17/Feb/2006:00:37:35 /blog/index.rdf "Bloglines/3.0-rho
[17/Feb/2006:00:37:38 /blog/index.xml "Bloglines/3.0-rho
[17/Feb/2006:01:05:40 /blog/atom.xml "Bloglines/3.0-rho
[17/Feb/2006:01:07:44 /blog/index.xml "Bloglines/3.0-rho
[17/Feb/2006:01:07:44 /blog/index.rdf "Bloglines/3.0-rho 

再看国内的狗狗:

grep "RSS Online" access_log.20060217 |awk '{print $4 " " $7 " " $12 }'
[17/Feb/2006:01:28:47 /blog/index.xml "http://www.gougou.com
[17/Feb/2006:01:52:54 /blog/index.xml "http://www.gougou.com
[17/Feb/2006:02:12:27 /blog/index.xml "http://www.gougou.com
[17/Feb/2006:02:12:27 /blog/index.xml "http://www.gougou.com
[17/Feb/2006:02:26:01 /blog/index.xml "http://www.gougou.com
[17/Feb/2006:02:46:46 /blog/index.xml "http://www.gougou.com
[17/Feb/2006:03:07:12 /blog/index.xml "http://www.gougou.com
[17/Feb/2006:03:19:24 /blog/index.xml "http://www.gougou.com
[17/Feb/2006:03:37:24 /blog/index.xml "http://www.gougou.com 
这个不太有规律,大约是20分钟左右.

Posted by eygle at 12:35 AM | Comments (1)



CopyRight © 2004-2008 eygle.com, All rights reserved.