Re: Raw vs. cooked
Posted in 1999
Topics: Platform-Specific Issues
"Obnoxio The Clown" <obnoxio@hotmail.com> writes: > Jeez, imagine that, a Sun sales engineer who believes that their filesystem > is faster than raw IO. Linux has no raw block devices. The prevailing wisdom is that O_SYNC is good enough. Of course, this means that for crash recovery, you must use a filesystem that supports O_SYNC, like ext2fs. Does the Informix Linux port use O_SYNC like the Oracle Linux port does? I don't know. One can always make a cooked device smoke a raw device by stirring in liberal amounts of cache policy. However, I suspect that database consistency and crash recovery aren't high on the list of benchmark priorities. -- Forte International, P.O. Box 1412, Ridgecrest, CA 93556-1412 Ronald Cole <ronald@forte-intl.com> Phone: (760) 499-9142 President, CEO Fax: (760) 499-9152 My PGP fingerprint: 15 6E C7 91 5F AF 17 C4 24 93 CB 6B EB 38 B5 E5
Ronald Cole wrote: > > "Obnoxio The Clown" <obnoxio@hotmail.com> writes: > > Jeez, imagine that, a Sun sales engineer who believes that their filesystem > > is faster than raw IO. > > Linux has no raw block devices. The prevailing wisdom is that O_SYNC > is good enough. Of course, this means that for crash recovery, you > must use a filesystem that supports O_SYNC, like ext2fs. Does the > Informix Linux port use O_SYNC like the Oracle Linux port does? I > don't know. > > One can always make a cooked device smoke a raw device by stirring in > liberal amounts of cache policy. However, I suspect that database > consistency and crash recovery aren't high on the list of benchmark > priorities. Yes Informix does use O_SYNC and that is the problem with performance on COOKED disks. On RAW disk the write system call takes the data directly from the application's buffers, in this case the Informix data buffer or BIG buffer, and writes it directly to disk. With COOKED files the data is first memcpy()'d to the filesystem's buffers then if O_SYNC is set that buffer is immediately written to disk otherwise the FS waits until it is not busy or a timeperiod passes. The cost of copying the data from the application buffer to the FS buffer is the difference between RAW and COOKED w/O_SYNC performance. Without O_SYNC, COOKED will be faster than RAW, at least it will appear so, because the write call returns immediately after the memcpy(), but the data is not safe so all reliable database servers, Informix included, use O_SYNC. With O_SYNC EVERY BENCHMARK I HAVE EVER SEEN shows that RAW disk is 15-35% faster than COOKED. The 15% usually represented by writing to the /dev/dsk (COOKED) device rather than the /dev/rdsk device, and the 35% represented when an actual FS file is used due to the added overhead of maintaining the inode as the file grows and the cost of the data blocks making up the file not being contiguous. Art S. Kagel