Raw disk I/O

Conor P. Cahill cpcahil at virtech.uucp
Sun Feb 18 11:48:30 AEST 1990


In article <1990Feb15.212708.19046 at ladc.bull.com> fmayhar at hermes.ladc.bull.com writes:
>In article <MARC.90Feb14083116 at focsys.uucp>, marc at focsys.uucp (Marc H.
>Morin) writes:
>> I am investigating using the raw disk interface to increase performance
>> of our application. The application is an imaging system,  thus the I/O
>> consists of large data transfers to and from the disk.

>> 3) Any experiences that you might have had with raw disk I/O.
>
>We were looking into this as well.  After testing, we decided to
>continue to use
>the block device, since it was at least three times faster than the raw device.

This kind of conclusion is very dependent upon the way you are using the
data on the device and on the specific device driver itself.

On most systems, if you have a single process that is reading very large
sections of the disk drive, you will get better performance by using
the raw partition.  For example: I wrote a program that restores a database
file to a disk partition (not to the filesys, the database used the disk 
partition directly).  Initially in restoring 300MB from tape to disk using
the block partition, it took almost 3 hours to restore the data and the 
performance on the system while this was going on was real slow.  When
I changed it to use the raw device, the same restoration took only 45 minutes
and it had almost no effect on system performance.

Some of the matters to consider are:

	1. How much data are you reading/writing at a time.  If you are only
	accessing small amounts (remember i/o to a raw partition must be a
	minimum size depending on the device, usually 512 or 1024 bytes), 
	you probably would get better performance from the block device.
	However, using the block device will be a performance gain over 
	using a larg file in a file system since no block indirection will take
	place, the data blocks will be shared amongst processes, and delayed
	writes will be utilized.

	2. Will multiple processes be accessing the same data?  If they are
	accessing the same data frequently, the buffer caching available on
	the block device should inprove performance.


>Of course, we're using System V.  I think you'll probably see the same thing
>under BSD, though.

This isn't a SV vs BSD thing, it is a driver vs driver, hardware vs hardware
thing.



-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.wizards mailing list