消除11.2上的db file parallel read

客户在11.2.0.3环境中进行压力测试,发现出现大量的db file parallel read等待事件。

 

 

这个等待是11g以后才出现的,而在11g以前,一般这个等待事件发生在数据文件的恢复过程中。而11g新增了prefetch的特性,也可能导致这个等待事件的产生。

当运行压力测试时,后台的等待事件如下:

SQL> select event, count(*) from v$session where username = user group by event order by 2;

EVENT                                                              COUNT(*)
---------------------------------------------------------------- ----------
SQL*Net message from client                                               1
SQL*Net message to client                                                 1
db file sequential read                                                  24
db file scattered read                                                   33
db file parallel read                                                    42

可以看到用户进程经历比较严重的IO等待,而此时的db file parallel read,并不会带来性能提升。

可以通过添加隐含参数的方法来屏蔽prefetch功能,从而避免db file parallel read等待事件的产生:

_db_block_prefetch_limit=0
_db_block_prefetch_quota=0
_db_file_noncontig_mblock_read_count=0

控制文件添加这三个隐含参数后,重启数据库,再次运行压力测试,发现db file parallel read等待事件已经消失:

SQL> select event, count(*) from v$session where username = user group by event order by 2;

EVENT                                                              COUNT(*)
---------------------------------------------------------------- ----------
SQL*Net message to client                                                 1
db file scattered read                                                   30

上一篇:【等待事件】System I/O类 等待事件(3.2)--control file parallel write


下一篇:Java 8 - 并行流计算入门