DB_WRITER_PROCESSES和DBWR_IO_SLAVES参数的一些说明

 

上一个blog中,alter日志报错:Private strand flush not complete,解决这个问题的办法就是增加DBWR进程(当然这也不是个问题),如果是多个processer的话设置DB_WRITER_PROCESSER参数,如果是单个processer的话,只能用DBWR_IO_SLAVES来模拟多核了。

DB_WRITER_PROCESSES replaces the Oracle7 parameter DB_WRITERS and specifies the initial number of database writer processes for an instance. If you use DBWR_IO_SLAVES, only one database writer process will be used, regardless of the setting for DB_WRITER_PROCESSES

DB_WRITER_PROCESSES参数就是在Oracle 7中的DB_WRITERS参数,用来指定数据库实例的DBWR进程个数,当系统中还配置了DBWR_IO_SLAVES参数时(默认为0),则只能利用到一个DBWn进程,而忽略其他的。

DBWR_IO_SLAVES

If it is not practical to use multiple DBWR processes, then Oracle provides a facility whereby the I/O load can be distributed over multiple slave processes. The DBWR process is the only process that scans the buffer cache LRU list for blocks to be written out. However, the I/O for those blocks is performed by the I/O slaves. The number of I/O slaves is determined by the parameter DBWR_IO_SLAVES.

当使用单一DBWR进程时,Oralce提供了使用多个I/O slave进程来完成模拟异步IO,去完成全本应该由DBWR做的事情(写LRU上的数据块到磁盘文件),这个slave的数量是通过DBWR_IO_SLAVES参数来指定的

DBWR_IO_SLAVES is intended for scenarios where you cannot use multiple DB_WRITER_PROCESSES (for example, where you have a single CPU). I/O slaves are also useful when asynchronous I/O is not available, because the multiple I/O slaves simulate nonblocking, asynchronous requests by freeing DBWR to continue identifying blocks in the cache to be written. Asynchronous I/O at the operating system level, if you have it, is generally preferred.

DBWR_IO_SLAVES参数通常被用在单CPU的场景中,因为单CPU即使设置了多DBWR进程数也是没有效果的。无论操作系统是否支持异步IO,使用多个I/O slaves都是有效的,可以分担DBWR的任务。如果使用了异步IO,那就更加推荐设置了

DBWR I/O slaves are allocated immediately following database open when the first I/O request is made. The DBWR continues to perform all of the DBWR-related work, apart from performing I/O. I/O slaves simply perform the I/O on behalf of DBWR. The writing of the batch is parallelized between the I/O slaves.

DBWR的I/O slaves当数据库open时发生第一次I/O请求时被分配,DBWR进程继续完成与自身相关任务,而分离出部分I/O处理任务给I/O slaves,各个I/O slaves之间的I/O处理都是并行的

Choosing Between Multiple DBWR Processes and I/O Slaves

Configuring multiple DBWR processes benefits performance when a single DBWR process is unable to keep up with the required workload. However, before configuring multiple DBWR processes, check whether asynchronous I/O is available and configured on the system. If the system supports asynchronous I/O but it is not currently used, then enable asynchronous I/O to see if this alleviates the problem. If the system does not support asynchronous I/O, or if asynchronous I/O is already configured and there is still a DBWR bottleneck, then configure multiple DBWR processes.

关于如何选择多个DBWR进程和I/O slaves进程

当单一的DBWR进程无法胜任大量的写工作负载,配置多个DBWR进程是有效的。但是在配置多个DBWR进程前,需要先检查OS上是否支持异步I/O,如果支持但未开启,那么先开启;如果系统不支持或已经配置了异步IO后,仍然有DBWR瓶颈,那么就可以配置多个DBWR进程

Using multiple DBWRs parallelizes the gathering and writing of buffers. Therefore, multiple DBWn processes should deliver more throughput than one DBWR process with the same number of I/O slaves. For this reason, the use of I/O slaves has been deprecated in favor of multiple DBWR processes. I/O slaves should only be used if multiple DBWR processes cannot be configured.

开启多个DBWR进程就意味着可以并行写更多的脏缓存(dirty buffer)到数据文件,而多个DBWR的吞吐量,也要比1个DBWR+相当数量的I/O slaves的要高,因此,当开启了多个DBWR进程时,就不应该再配置DBWR_IO_SLAVES(如果原来是非零的话),可以把这个参数设置为0

总结:

DBWR_IO_SLAVES主要用于模拟异步环境,在不支持异步操作的OS上,可以提高IO的读写速度。
多个DBWR进程可以并行地从data buffer中获取dirty block并且并行地写入磁盘。但是,在单DBWR+多个I/O slaves的场景下,只能是一个DBWR负责从data buffer中获取,而多个I/O slaves并行写入。如果系统支持AIO(disk_async_io=true),一般不用设置多dbwr 或io slaves。

如果在有多个cpu的情况下建议使用DB_WRITER_PROCESSES,因为这样的情况下不用去模拟异步模式,但要注意进程数量不能大于cpu数量。而在只有一个cpu的情况下建议使用DBWR_IO_SLAVES来模拟异步模式,以便提高数据库性能。

猜你喜欢

转载自blog.csdn.net/jolly10/article/details/81329476
今日推荐