欢迎投稿

今日深度:

oracle异步IO之filesystemio_options参数初探

oracle异步IO之filesystemio_options参数初探


异步IO之filesystemio_options参数

近日再跟一个老DBA聊天的时候,听说了一个关于异步IO的参数。于是带着些许的好奇,异步I/O也就意味着读写可同时进行。

于是回来查看了一下这个参数,实验了一下。

在未安装oracle的linux服务器查看

Last login: Fri Jun 5 16:09:07 2015 from 10.53.105.3

[root@master ~]# grep kio /proc/slabinfo

kioctx 0 0 384 10 1 : tunables 54 27 0 : slabdata 0 0 0

kiocb 0 0 256 15 1 : tunables 120 60 0 : slabdata 0 0 0

看到kiocb行显示为0,说明异步IO没有启动。

 

实验前,先到官方文档查一下:

\

ASYNCH: enable asynchronous I/O on file system files, which has no timing requirement for transmission.
在文件系统文件上启用异步I/O,在数据传送上没有计时要求。

DIRECTIO: enable direct I/O on file system files, which bypasses the buffer cache.
在文件系统文件上启用直接I/O,绕过buffer cache。

SETALL: enable both asynchronous and direct I/O on file system files.
在文件系统文件上启用异步和直接I/O。

NONE: disable both asynchronous and direct I/O on file system files.
在文件系统文件上禁用异步和直接I/O。

 

实验:oracle开启异步I/O

 

环境:oracle11.2.0.4 64bit

 

[root@xckydb ~]# grep kio /proc/slabinfo

kioctx 23 36 320 12 1 : tunables 54 27 8 : slabdata 3 3 0

kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0

SQL> show parameter file

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

filesystemio_options string none

ifile file

log_file_name_convert string

max_dump_file_size string unlimited

remote_login_passwordfile string EXCLUSIVE

session_max_open_files integer 10

spfile string /u01/app/oracle/product/11.2.0

/db_1/dbs/spfilexcky.ora

standby_file_management string MANUAL

tracefile_identifier string

utl_file_dir string

SQL> alter system set filesystemio_options=setall

2 ;

alter system set filesystemio_options=setall

*

ERROR at line 1:

ORA-02095: specified initialization parameter cannot be modified

报错了,这个参数不可以在线修改。这应该是个静态参数!我们设置参数文件,重启数据库。

SQL> alter system set filesystemio_options=setall scope=spfile;

System altered.

 

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

 

Total System Global Area 839282688 bytes

Fixed Size 2257880 bytes

Variable Size 507513896 bytes

Database Buffers 327155712 bytes

Redo Buffers 2355200 bytes

Database mounted.

Database opened.

SQL> show parameter filesystemio_options

 

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

filesystemio_options string SETALL

设置已经生效了。

到linux系统下,查看异步IO情况。

[root@xckydb ~]# grep kio /proc/slabinfo

kioctx 24 36 320 12 1 : tunables 54 27 8 : slabdata 3 3 0

kiocb 12 60 256 15 1 : tunables 120 60 8 : slabdata 4 4 0

看到kiocb已经有数据值了,说明异步IO已经生效了。

 

但是,在生产集群环境下查看时,没有开启异步参数,而在linux系统层面查看时,异步IO是启动的。这么说的话,并不是跟上面的实验完全一致。

在某生成环境下查看,如下:

[root@xzxdb1 ~]# grep kio /proc/slabinfo

kioctx 210 280 384 10 1 : tunables 54 27 8 : slabdata 28 28 0

kiocb 15 30 256 15 1 : tunables 120 60 8 : slabdata 2 2 0

 

SQL> show parameter file

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_flash_cache_file string

db_recovery_file_dest string +OCR_ARCH

db_recovery_file_dest_size big integer 4407M

db_securefile string PERMITTED

dg_broker_config_file1 string /u01/app/oracle/product/11.2.0

/db_1/dbs/dr1xzxt.dat

dg_broker_config_file2 string /u01/app/oracle/product/11.2.0

/db_1/dbs/dr2xzxt.dat

file_mapping boolean FALSE

fileio_network_adapters string

filesystemio_options string none

可以看到这个集群生产环境下的filesystemio_options参数设置是none,但是查看异步IO是生效的。我们知道异步IO是通过软件层面实现的,为什么生产环境下集群系统会自动启用呢?这跟oracle集群有关系嘛?带着疑问,在实验环境下启动一套集群环境。

[root@node1 ~]# grep kio /proc/slabinfo

kioctx 108 108 320 12 1 : tunables 54 27 8 : slabdata 9 9 0

kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0

 

SQL> show parameter file

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest string +RCY1

db_recovery_file_dest_size big integer 3552M

db_securefile string PERMITTED

dg_broker_config_file1 string /u01/app/oracle/product/11.2.0

/db_1/dbs/dr1xcky.dat

dg_broker_config_file2 string /u01/app/oracle/product/11.2.0

/db_1/dbs/dr2xcky.dat

file_mapping boolean FALSE

fileio_network_adapters string

filesystemio_options string none

ifile file

发现集群环境下,参数没有设置,而且异步IO也没能启动。

尝试修改参数。

SQL> alter system set filesystemio_options=setall scope=spfile;

System altered.

但是遇到了问题。

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

 

SQL> startup;

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2216944 bytes

Variable Size 557845520 bytes

Database Buffers 167772160 bytes

Redo Buffers 2879488 bytes

Database mounted.

Database opened.

 

SQL> show parameter file;

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest string +RCY1

db_recovery_file_dest_size big integer 3552M

db_securefile string PERMITTED

dg_broker_config_file1 string /u01/app/oracle/product/11.2.0

/db_1/dbs/dr1xcky.dat

dg_broker_config_file2 string /u01/app/oracle/product/11.2.0

/db_1/dbs/dr2xcky.dat

file_mapping boolean FALSE

fileio_network_adapters string

filesystemio_options string SETALL

ifile file

设置成功了,但是在操作系统下看一下,如下:

[oracle@node1 dbs]$ grep kio /proc/slabinfo

kioctx 104 108 320 12 1 : tunables 54 27 8 : slabdata 9 9 0

kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0

到第2个节点也查看一下,如下:

SQL> show parameter filesystemio_options;

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

filesystemio_options string SETALL

SQL>

[oracle@node2 dbs]$ grep kio /proc/slabinfo

kioctx 103 108 320 12 1 : tunables 54 27 8 : slabdata 9 9 0

kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0

下面尝试把参数值设置为asynch(异步),来看一下是否会有所改变呢?

SQL> alter system set filesystemio_options=asynch scope=spfile;

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2216944 bytes

Variable Size 557845520 bytes

Database Buffers 167772160 bytes

Redo Buffers 2879488 bytes

Database mounted.

Database opened.

到操作系统下查看,异步依旧没有生效,如下:

[oracle@node1 dbs]$ grep kio /proc/slabinfo

kioctx 101 108 320 12 1 : tunables 54 27 8 : slabdata 9 9 0

kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0

从上面的现象来看,在我使用的虚拟机RAC环境下,异步I/O并没有实现,实验失败。

小结:

1、对于filesystemio_options产生的异步I/O现象,单实例下测试成功;

2、对于filesystemio_options产生的异步I/O现象,生成库RAC下,无需设置,可能异步I/O是在存储层面启动了(猜测,可能不是这样的。。。);

3、对于filesystemio_options产生的异步I/O现象,单机实验RAC下,测试不成功,没有达到预期。

所以,对于filesystemio_options参数设置对于异步I/O所起到的左右,仍然存疑。

www.htsjk.Com true http://www.htsjk.com/oracle/23583.html NewsArticle oracle异步IO之filesystemio_options参数初探 异步IO之filesystemio_options参数 近日再跟一个老DBA聊天的时候,听说了一个关于异步IO的参数。于是带着些许的好奇,异步I/O也就意味着读写可同时进...
评论暂时关闭