Oracle在Linux下使用非同步IO(aio)配置(轉)
1、首先用root使用者安裝以下必要的rpm包
# rpm -Uvh libaio-0.3.106-3.2.x86_64.rpm
# rpm -Uvh libaio-devel-0.3.106-3.2.x86_64.rpm
2、在系統級支援非同步I/O
與[Note 225751.1]介紹的在RHEL3裡面設定非同步IO不同,不需要設定aio-max-size,而且'/proc/sys/fs'路徑下也沒有這個檔案。因為從2.6 kernel開始,已經取消了對IO size的限制[Note 549075.1]。另外根據[Note 471846.1],建議將aio-max-nr的值設定為1048576或更高。
#echo > /proc/sys/fs/aio-max-nr 1048576
3、在資料庫級啟用非同步I/O
首先修改資料庫引數。與[Note 225751.1]在RHEL 3裡面設定非同步IO不同,Oracle10gR2預設是開啟了對非同步IO的支援的,不需要重新編譯資料庫軟體。在'$ORACLE_HOME/rdbms/lib'路徑下,也沒有'skgaioi.o'這個檔案。在某些情況下,Oracle無法將IO行為或事件報告給作業系統[Note 365416.1],因此需要做以下操作。
這裡開始換成oracle使用者
SQL>alter system set disk_asynch_io=TRUE scope=spfile;
SQL>alter system setfilesystemio_options=asynchscope=spfile;
SQL>shutdown immediate
$ cd $ORACLE_HOME/rdbms/lib
$ ln -s /usr/lib/libaio.so.1 skgaio.o
$ make PL_ORALIBS=-laio -f ins_rdbms.mk async_on
SQL>startup
在Oracle10gR2中AIO預設已經是開啟的了。可以透過ldd或者nm來檢查oracle是否已經啟用了AIO支援,有輸出代表已經啟用。
[oraprod@db01 ~]$/usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaio
libaio.so.1 => /usr/lib64/libaio.so.1 (0x00002aaaac4a9000)
[oraprod@db01 ~]$/usr/bin/nm $ORACLE_HOME/bin/oracle | grep io_getevent
w io_getevents@@LIBAIO_0.4
4、檢查非同步I/O是否在使用
根據[Note 370579.1],可以透過檢視slabinfo統計資訊檢視作業系統中AIO是否執行,slab是Linux的記憶體分配器,AIO相關的記憶體結構已經分配,kiocb值的第二列和第三列非0即是已使用。與kernel 2.4.x不同,沒有顯示kiobuf,因為從kernel 2.5.43開始,kiobuf已經從核心中被移除。
$cat /proc/slabinfo | grep kio
kioctx 64 110 384 10 1 : tunables 54 27 8 : slabdata 11 11 0
kiocb 13 315 256 15 1 : tunables 120 60 8 : slabdata 21 21 44
我的實驗過程:
[@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Dec 17 10:37:10 2010
Copyright (c) 1982, 2005, Oracle.All rights reserved.
[oracle@localhost ~]$ /usr/bin/nm $ORACLE_HOME/bin/oracle | grep io_getevent
w io_getevents@@LIBAIO_0.4
[oracle@localhost ~]$
[oracle@localhost ~]$
[oracle@localhost ~]$ /usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaio
libaio.so.1 => /usr/lib/libaio.so.1 (0x00507000)
[oracle@localhost ~]$ cat /proc/slabinfo | grep kio
kioctx1415256151 : tunables120600 : slabdata110
kiocb00128311 : tunables120600 : slabdata000
## 沒有啟用:
SQL> show parameter disk_asynch_io
NAMETYPE
------------------------------------ ----------------------
VALUE
------------------------------
disk_asynch_ioboolean
TRUE
SQL> sho parameter filesystemio_options
NAMETYPE
------------------------------------ ----------------------
VALUE
------------------------------
filesystemio_optionsstring
none
SQL>
SQL>
SQL> alter system set filesystemio_options = setallscope=both;
alter system set filesystemio_options = setallscope=both
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL>
SQL>alter system set filesystemio_options = setallscope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area285212672 bytes
Fixed Size1218992 bytes
Variable Size88082000 bytes
Database Buffers192937984 bytes
Redo Buffers2973696 bytes
Database mounted.
Database opened.
[root@localhost ~]# cat /proc/slabinfo | grep kio
kioctx1315256151 : tunables120600 : slabdata110
kiocb731128311 : tunables120600 : slabdata110
9.1.1.1Asynchronous I/O
With synchronous I/O, when an I/O request is submitted to the operating system, the writing process blocks until the write is confirmed as complete. It can then continue processing. With asynchronous I/O, processing continues while the I/O request is submitted and processed. Use asynchronous I/O when possible to avoid bottlenecks.
Some platforms support asynchronous I/O by default, others need special configuration, and some only support asynchronous I/O for certain underlying file system types.
9.1.1.2FILESYSTEMIO_OPTIONS Initialization Parameter
You can use theFILESYSTEMIO_OPTIONSinitialization parameter to enable or disable asynchronous I/O or direct I/O on file system files. This parameter is platform-specific and has a default value that is best for a particular platform. It can be dynamically changed to update the default setting.
FILESYTEMIO_OPTIONScan be set to one of the following values:
ASYNCH:enable asynchronous I/O on file system files, which has no timing requirement for transmission.
DIRECTIO:enable direct I/O on file system files, which bypasses the buffer cache.
SETALL:enable both asynchronous and direct I/O on file system files.
NONE:disable both asynchronous and direct I/O on file system files.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7191998/viewspace-750846/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- java同步非阻塞IOJava
- Java 非阻塞 IO 和非同步 IOJava非同步
- IO模式和IO多路複用(阻塞IO、非阻塞IO、同步IO、非同步IO等概念)模式非同步
- IO - 同步 非同步 阻塞 非阻塞的區別非同步
- IO通訊模型(二)同步非阻塞模式NIO(NonBlocking IO)模型模式BloC
- BIO、NIO、多路複用IO、AIOAI
- python之IO併發-阻塞IO 非阻塞IO IO多路複用 非同步IO(協程)Python非同步
- 談談對不同I/O模型的理解 (阻塞/非阻塞IO,同步/非同步IO)模型非同步
- 在 Linux 下配置 RAIDLinuxAI
- 如何解讀 Java IO、NIO 中的同步阻塞與同步非阻塞?Java
- 【IO】Linux下的五種IO模型Linux模型
- oracle非同步IO之filesystemio_options引數Oracle非同步
- 11、協程和io教程01 -- 併發 並行 同步 非同步 阻塞 非阻塞 以及 IO多路複用並行非同步
- 【死磕NIO】— 阻塞IO,非阻塞IO,IO複用,訊號驅動IO,非同步IO,這你真的分的清楚嗎?非同步
- Linux 阻塞和非阻塞 IO 實驗學習Linux
- 阻塞IO與非阻塞IO
- 【網路IO系列】IO的五種模型,BIO、NIO、AIO、IO多路複用、 訊號驅動IO模型AI
- 手把手教你如何使用Python的非同步IO框架:asyncio(下)Python非同步框架
- Java網路程式設計和NIO詳解5:Java 非阻塞 IO 和非同步 IOJava程式設計非同步
- 如何給女朋友解釋什麼是IO中的阻塞、非阻塞、同步、非同步?非同步
- Django專案在Linux下基礎配置DjangoLinux
- 在Linux下安裝配置Cntlm代理教程Linux
- 在Linux中,如何配置和使用Xen?Linux
- 今天我們來聊Java IO模型,BIO、NIO、AIO三種常見IO模型Java模型AI
- Elasticsearch 在Linux下的安裝部署和配置ElasticsearchLinux
- ogg for oracle 19c 非cdb安裝配置Oracle
- 在 Linux 命令列下使用“原力”Linux命令列
- asyncio(非同步io)非同步
- jdk在linux下安裝、配置環境變數JDKLinux變數
- 在非 laravel 專案中使用 laravel 的特性 5: 配置 config && envLaravel
- 我在 Linux 中使用的 5 個 Git 配置LinuxGit
- Linux下使用Nginx做CDN伺服器下的配置LinuxNginx伺服器
- 同步非同步,阻塞非阻塞非同步
- 非同步、同步、阻塞、非阻塞非同步
- [作業系統]阻塞io 非阻塞io Epoll作業系統
- FastAPI之阻塞式io和非阻塞式ioASTAPI
- linux下配置javaLinuxJava
- 玩轉 PHP 網路程式設計全套阻塞與非阻塞 IOPHP程式設計
- 使用oracle的logminer同步資料Oracle