-   Linux - Newbie (
-   -   Difference between using Raw block device with O_DIRECT and Raw Character Device (

srithi 08-18-2009 05:14 PM

Difference between using Raw block device with O_DIRECT and Raw Character Device

I am running a Sybase Database (version 15.0.3 64-bit) on RHEL 5.3 using LVM Raw Block devices. Basically, Sybase would open the devices using O_DIRECT. I also tried mapping the same Block devices to raw devices (/dev/raw/rawN) and did a database load test to compare the IO speed between Block device with O_DIRECT and raw devices. Noticed that the raw character device database load was faster than the block device with DirectIO. Even though, I used the same set of devices, not sure why there is a difference in IO speed. Will the Linux kernel use different drivers for Block Devices opened with O_DIRECT and Raw character devices? Any suggestions would be greatly appreciated.


MensaWater 08-19-2009 10:52 AM

I can't give details but O_DIRECT and raw are certainly two different things. We've run Oracle RAC on OCFS (Oracle Cluster Filesystem) which uses O_DIRECT on RHEL3 and on ASM on raw devices on RHEL5.

Performance isn't necessarily the biggest concern however. According to later documentation raw devices are deprecated in Linux and may be removed completely in future versions of the kernel. I chose ASM on raw for my RHEL5 install or RAC because most of their documentation was written for RHEL4. It wasn't until I ran across an OCFS2 (which also does O_DIRECT) that I found a suggestion from Oracle to use that instead of ASM on raw because of the deprecation.

I'm not sure why the kernel team feels O_DIRECT is better than raw to the point they'd actually think about taking the latter option away.

By the way - in the above the O_DIRECT is on OCFS filesystems rather than simply on the block devices. I wonder if Sybase has an equivalent filesystem (or even uses the open source OCFS2) that somehow optimizes use of O_DIRECT?

All times are GMT -5. The time now is 01:47 PM.