Re: Poor read performance when sequential write presents

Andrew Morton (akpm@zip.com.au)
Thu, 23 May 2002 12:51:31 -0700


"chen, xiangping" wrote:
>
> Hi,
>
> I did a IO test with one sequential read and one sequential write
> to different files. I expected somewhat similar throughput on read
> and write. But it seemed that the read is blocked until the write
> finishes. After the write process finished, the read process slowly
> picks up the speed. Is Linux buffer cache in favor of write? How
> to tune it?
>

Reads and writes are very different beasts - writes deal with
the past and have good knowledge of what to do. But reads
must predict the future.

You need to do two things:

1: Configure the device for a really big readahead window.

Configuring readahead in 2.4 is a pig. Try one of the
following:

echo file_readahead:N > /proc/ide/hda/settings (N is kilobytes)
blockdev --setra M /dev/hda (M is in 512 byte sectors)
echo K > /prov/sys/vm/max-readahead (K is in pages - 4k on x86)

You'll find that one of these makes a difference.

2: Apply http://www.zip.com.au/~akpm/linux/patches/2.4/2.4.19-pre5/read-latency2.patch
which will prevent reads from being penalised by writes.
Or use a -ac kernel, which already has this patch.

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/