Oracle I/O and Operation System Cache

[转]

Direct or Async I/O

It’s pretty well documented that the most efficient configuration for Oracle is direct asynchronous I/O.

Direct I/O means to avoid unnecessarily copying bits from one memory location to another between the hardware and the SGA. Every flavor of Unix implements some form of caching for block devices and filesystems; in Linux the buffer cache (for block devices) or page cache (for filesystem data) can cache database blocks. Most applications benefit from this caching – however Oracle does not. There are two primary reasons this caching is bad for Oracle:

  1. Oracle caches this data itself in the SGA and it does a far better job of predicting what blocks will be best retained in memory. When the OS caches data you essentially end up with two copies of every data block – one that’s really unused. You waste half the memory in your server with almost no performance benefit.
  2. The data has to be copied extra times before arriving in the SGA – and these extra “copy” operations slow down your read operations.

Asynchronous I/O means to multitask your read and write operations. Remember how in MSDOS you could only run one program at a time? Believe it or not, this is how most Unix filesystems do I/O by default – one thing at a time. Using Asynchronous is equivalent to upgrading to an Operating System that allows you to run more than one program at a time. It allows Oracle to issue multiple read and write operations concurrently – this is obviously more efficient.

There are different ways of implementing Direct I/O and Asynchronous I/O in different environments (CIO, QIO, ODM, etc) – but it’s always best to enable them and then shift memory from the OS caches to the SGA.

The Linux I/O Path

I should start out by saying that I’m not a kernel expert. After some digging through source code and mailing lists I think that I’ve got a handle on the main concepts here – but I’m open to correction since this is complicated stuff and I easily could miss some details of how it’s all implemented! Let me know if you have anything to add!

On Linux, asynchronous I/O requests are submitted through the io_submit() call. (Kevin Closson once wrote about tracing this call.) This function essentially puts the I/O request into a queue which is managed by the Linux kernel. I think that this workqueue is a generic kernel object which you can’t and shouldn’t need to tweak. The I/O request is subsequently picked up by one of several kernel AIO background processes and serviced.

What the kernel thread does depends on the underlying device. FC cards support asynchronous requests to the target (it’s part of the SCSI spec) – so in this case the kernel thread will issue a number of SCSI read or write requests in parallel. This is where a secondqueue comes in! And this queue, unlike the kernel workqueues, can be tweaked.

The target device (Symetrix, DSxxxx, 3Par, etc) also has an FC port which has its own queue for I/O requests that are being serviced. On a 3par device these ports only have between 500 and 2000 slots for concurrent I/O requests depending on the model. This means that all the servers accessing any LUNs over that port cannot issue more than 500-2000 concurrent I/O requests – or you will start to see “QUEUE FULL SCSI” errors.

My best guess: this means that the default limit set by the Linux qla2xxx driver for concurrent I/O requests on QLogic cards (32 per LUN) is conservative. The driver sets this limit by limiting the size of the queue. So naturally… my next question was if I could increase performance by increasing this limit…

Tweaking the HBA Queue Depth

I did run a few tests – but I think I’ll save the results for a second post since this one has already gotten pretty long. Any guesses about what the results were?

时间: 2024-08-03 23:20:45

Oracle I/O and Operation System Cache的相关文章

Oracle结果集缓存(Result Cache)--服务器、客户端、函数缓存

Oracle结果集缓存(Result Cache)--服务器.客户端.函数缓存 在11g中,Oracle提供了结果集缓存特性.该缓存是在共享内存中存储全部的结果集,如果一个查询SQL被执行,且它对应的结果集在缓存中,那么,该SQL的几乎全部开销都可以避免.这些开销包括,解析时间.逻辑读.物理读和任意的通常可能会遭遇的争用.但是,在实际的情况中,结果集缓存仅在少数的情况下是有效的,原因有如下几点: (1)有数据重叠的多个SQL会在缓存中保存冗余的数据. (2)对依赖对象的任何改变(包括对查询中引用

Win7旗舰版系统开机提示“Error Loading Operation System”怎么办

  一.Win7旗舰版系统开机提示"Error Loading Operation System"的原因分析 1.分区表指示的分区的起始地址不正确导致; 2.分区引导扇区所在磁道的磁道标志或扇区ID损坏,然而就导致找不到指定的扇区; 3.驱动器读电路故障,不过这种情况比较少见,多数是随机性读错误,因为系统引导进行到此处,可以说是已经正确读取了一个主引导扇区; 二.解决方法 对硬盘进行重新分区,然后用U盘重新安装Win7旗舰版系统,如果有不知道如何安装的朋友们

请高人指教一下:asp.net跟oracle怎样才能连接?System.Data.OracleClient.dll怎么用呀?

问题描述 请高人指教一下:asp.net跟oracle怎样才能连接?System.Data.OracleClient.dll怎么用呀?我看到书籍上面都提到System.Data.OracleClient.dll是关联oracle的工具,但是没有说怎么用.请高人指教一下我吧. 解决方案 解决方案二:除连接字符串外其他基本相同,把sql改成oracle基本就行了exp:sqlconnectionconn=newsqlconnection();oracleconnectionconn=neworacl

ORACLE Active dataguard 一个latch: row cache objects BUG

在Active dataguard遇到latch: row cache objects 查询如下语句 select a.SAMPLE_TIME,a.SQL_ID,a.EVENT,a.P1TEXT,a.P1,a.P2TEXT,a.P2,a.P3TEXT,a.P3,  b.f2   from v$active_session_history a,     (select max(b.SQL_TEXT) f2,sql_id from  v$sql b group by sql_id ) b  wher

oracle blob 图片接收是system.byte[]怎么在image中显示出来,代码如下

问题描述 从数据库接收的:varx=newArray(1,4,'130531196506081012','李男男','B42','System.Byte[]')要显示的位置:<imgid="TP2"src="../Images/Sunset.jpg"alt=""height="70"width="70"/>求高手指教!!!!!!能否在显示图片的html页面进行处理. 解决方案 解决方案二:一般都

一个典型kernel bug的追踪之(一)

原文链接 :  http://kerneldedup.org/forum/forum.php?mod=viewthread&tid=17&extra=page%3D1 一个典型kernel bug的追踪之(一):出错现场分析 昨天偶尔在跑测试的时候发现uksmd的一个极其罕见出现的bug(在一个很难进入的路径上,很久很久没有碰到类似的问题了),本质上属于一个soft lockup的bug.所谓,soft lockup就是说,这个bug没有让系统彻底死机,但是若干个进程(或者kernel t

MySQL服务器内存使用

Every so often people ask me the question how should they estimate memory consumption by MySQL Server in given configuration. What is the formula they could use. 经常有人问我配置MySQL时该如何估算内存的消耗.那么该使用什么公式来计算呢? The reasons to worry about memory usage are quit

UDE-00008: operation generated ORACLE error 31626

哎!人不顺了,喝口冷水都塞牙缝. 下午做了一个很简单的测试就又出来了一个BUG,记录一下吧, SQL> show user ;USER is "SYS"SQL> create directory dir1 as '/home/oracle/bak'; Directory created. SQL> grant write on directory dir1 to yxyup; Grant succeeded. oracle@sles10sp1-db2:~> ex

Oracle中library cache pin与PROCEDURE的重建

前面提到,Oracle10g重建Procedure的处理有所增强,最初看到这个增强的时候,我想这个增强是否可以减少困扰已久的Library Cache的竞争呢? 我们看一下以下测试,首先在第一个session执行操作: SQL> create or replace PROCEDURE pining 2 IS 3 BEGIN 4 NULL; 5 END; 6 / Procedure created. SQL> SQL> alter session set nls_date_format='