linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Hans Reiser <reiser@namesys.com>
Cc: andrea@suse.de, piggin@cyberone.com.au, jakob@unthought.net,
	david.lang@digitalinsight.com, riel@conectiva.com.br,
	ckolivas@yahoo.com.au, linux-kernel@vger.kernel.org,
	axboe@suse.de
Subject: Re: stochastic fair queueing in the elevator [Re: [BENCHMARK] 2.4.20-ck3 / aa / rmap with contest]
Date: Mon, 10 Feb 2003 02:48:10 -0800	[thread overview]
Message-ID: <20030210024810.43a57910.akpm@digeo.com> (raw)
In-Reply-To: <3E4779DD.7080402@namesys.com>

Hans Reiser <reiser@namesys.com> wrote:
>
> readahead seems to be less effective for non-sequential objects.  Or at 
> least, you don't get the order of magnitude benefit from doing only one 
> seek, you only get the better elevator scheduling from having more 
> things in the elevator, which isn't such a big gain.
> 
> For the spectators of the thread, one of the things most of us learn 
> from experience about readahead is that there has to be something else 
> trying to interject seeks into your workload for readahead to make a big 
> difference, otherwise a modern disk drive (meaning, not 30 or so years 
> old) is going to optimize it for you anyway using its track cache.
> 

The biggest place where readahead helps is when there are several files being
read at the same time.  Without readahead the disk will seek from one file
to the next after having performed a 4k I/O.  With readahead, after performing
a (say) 128k I/O.  It really can make a 32x difference.

Readahead is brute force.  The anticipatory scheduler solves this in a
smarter way.

Yes, device readahead helps.  But I believe the caches are only 4-way
segmented or thereabouts, so it is easy to thrash them.  Let's test:

vmm:/mnt/hda6> dd if=/dev/zero of=file1 bs=1M count=100
100+0 records in
100+0 records out
vmm:/mnt/hda6> dd if=/dev/zero of=file2 bs=1M count=100
100+0 records in
100+0 records out
vmm:/mnt/hda6> fadvise file1 0 9999999999 dontneed
vmm:/mnt/hda6> fadvise file2 0 9999999999 dontneed
vmm:/mnt/hda6> time cat file1 > /dev/null & time cat file2 > /dev/null
cat 2 > /dev/null  0.00s user 0.11s system 0% cpu 21.011 total
cat 1 > /dev/null  0.00s user 0.14s system 0% cpu 23.011 total
vmm:/mnt/hda6> 0 blockdev --setra 4 /dev/hda
vmm:/mnt/hda6> fadvise file1 0 9999999999 dontneed
vmm:/mnt/hda6> fadvise file2 0 9999999999 dontneed
vmm:/mnt/hda6> time cat file1 > /dev/null & time cat file2 > /dev/null
cat 2 > /dev/null  0.07s user 0.43s system 1% cpu 31.431 total
cat 1 > /dev/null  0.01s user 0.27s system 0% cpu 31.430 total

OK, so there's a 50% slowdown on a modern IDE disk from not using readahead.

vmm:/mnt/hda6> for i in $(seq 1 8)
for> do
for> dd if=/dev/zero of=file$i bs=1M count=10 
for> sync
for> fadvise file$i 0 999999999 dontneed
for> done

vmm:/home/akpm> 0 blockdev --setra 240 /dev/hda1
for i in $(seq 1 8)
do
time cat file$i >/dev/null&          
done
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 4.422 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 5.801 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 6.012 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 6.261 total
cat file$i > /dev/null  0.00s user 0.02s system 0% cpu 6.401 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 6.494 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 6.754 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 6.757 total

vmm:/mnt/hda6> for i in $(seq 1 8)
do
fadvise file$i 0 999999999 dontneed
done
vmm:/home/akpm> 0 blockdev --setra 4 /dev/hda1
vmm:/mnt/hda6> for i in $(seq 1 8)
do
time cat file$i >/dev/null&          
done
cat file$i > /dev/null  0.00s user 0.02s system 0% cpu 13.373 total
cat file$i > /dev/null  0.00s user 0.04s system 0% cpu 14.849 total
cat file$i > /dev/null  0.00s user 0.02s system 0% cpu 15.816 total
cat file$i > /dev/null  0.00s user 0.04s system 0% cpu 16.808 total
cat file$i > /dev/null  0.00s user 0.05s system 0% cpu 17.824 total
cat file$i > /dev/null  0.00s user 0.03s system 0% cpu 19.004 total
cat file$i > /dev/null  0.00s user 0.03s system 0% cpu 19.274 total
cat file$i > /dev/null  0.00s user 0.03s system 0% cpu 19.301 total

So with eight files, it's a 300% drop from not using readahead.


With 16 files, readahead enabled:
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 9.887 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 10.925 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 11.033 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 11.146 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 11.381 total
cat file$i > /dev/null  0.00s user 0.02s system 0% cpu 11.640 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 11.907 total
cat file$i > /dev/null  0.00s user 0.01s system 0% cpu 12.262 total
....

Readahead disabled:

cat file$i > /dev/null  0.00s user 0.03s system 0% cpu 39.307 total
cat file$i > /dev/null  0.00s user 0.03s system 0% cpu 39.378 total
cat file$i > /dev/null  0.00s user 0.04s system 0% cpu 39.679 total
cat file$i > /dev/null  0.00s user 0.03s system 0% cpu 39.888 total
cat file$i > /dev/null  0.00s user 0.02s system 0% cpu 40.261 total


Still only 300%.  I'd expect to see much larger differences on some older
SCSI disks I have here.



  parent reply	other threads:[~2003-02-10 10:38 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-09 13:30 [BENCHMARK] 2.4.20-ck3 / aa / rmap with contest Con Kolivas
2003-02-09 14:46 ` stochastic fair queueing in the elevator [Re: [BENCHMARK] 2.4.20-ck3 / aa / rmap with contest] Andrea Arcangeli
2003-02-10  3:13   ` Nick Piggin
2003-02-10  3:52     ` Rik van Riel
2003-02-10  4:44       ` Nick Piggin
2003-02-10  5:15         ` usbaudio.c 2.5.59 John
2003-02-10  7:26         ` stochastic fair queueing in the elevator [Re: [BENCHMARK] 2.4.20-ck3 / aa / rmap with contest] Andrea Arcangeli
2003-02-10  7:43           ` Nick Piggin
2003-02-10  3:42   ` Rik van Riel
2003-02-10  4:15     ` Rik van Riel
2003-02-10  4:19       ` David Lang
2003-02-10  4:29         ` Rik van Riel
2003-02-10  7:20           ` Andrea Arcangeli
2003-02-10  4:33         ` Andrew Morton
2003-02-10  4:47           ` Rik van Riel
2003-02-10  7:31             ` Andrea Arcangeli
2003-02-10  4:51           ` Jakob Oestergaard
2003-02-10  4:58             ` Nick Piggin
2003-02-10  5:10               ` Jakob Oestergaard
2003-02-10  6:06                 ` Valdis.Kletnieks
2003-02-10  6:31                   ` Jakob Oestergaard
2003-02-10  7:36               ` Andrea Arcangeli
2003-02-10  7:41                 ` Nick Piggin
2003-02-10  8:08                   ` Andrea Arcangeli
2003-02-10  8:19                     ` Andrew Morton
2003-02-10  8:56                       ` Andrea Arcangeli
2003-02-10  9:09                         ` Andrew Morton
2003-02-10  9:14                           ` Andrea Arcangeli
2003-02-10 10:07                           ` Hans Reiser
2003-02-10 10:15                             ` Andrea Arcangeli
2003-02-10 10:40                               ` Nick Piggin
2003-02-10 11:10                                 ` Andrea Arcangeli
2003-02-10 11:21                                   ` Andrew Morton
2003-02-10 11:31                                     ` Andrea Arcangeli
2003-02-10 11:24                                   ` Nick Piggin
2003-02-10 11:39                                     ` Andrea Arcangeli
2003-02-10 11:45                                       ` Nick Piggin
2003-02-10 12:00                                         ` Andrea Arcangeli
2003-02-10 12:11                                           ` Nick Piggin
2003-02-10 12:22                                             ` Andrea Arcangeli
2003-02-10 12:36                                               ` Nick Piggin
2003-02-10 12:47                                                 ` Andrea Arcangeli
2003-02-10 13:26                                           ` Rik van Riel
2003-02-10 11:48                                       ` Andrew Morton
2003-02-10 11:53                                         ` Nick Piggin
2003-02-10 12:10                                           ` Andrea Arcangeli
2003-02-10 12:14                                             ` Nick Piggin
2003-02-10 12:26                                               ` Andrea Arcangeli
2003-02-10 12:12                                           ` Andrew Morton
2003-02-10 12:25                                             ` Andrea Arcangeli
2003-02-10 12:27                                             ` Nick Piggin
2003-02-10 12:30                                               ` Andrea Arcangeli
2003-02-10 12:34                                                 ` Nick Piggin
2003-02-10 12:43                                                   ` Andrea Arcangeli
2003-02-10 12:55                                                     ` Nick Piggin
2003-02-10 13:30                                             ` Rik van Riel
2003-02-11 19:13                                               ` Rod Van Meter
2003-02-10 12:09                                         ` Andrea Arcangeli
2003-02-10 12:17                                           ` Nick Piggin
2003-02-10 12:28                                             ` Andrea Arcangeli
2003-02-10 12:58                                           ` Hans Reiser
2003-02-10 13:18                                             ` Andrea Arcangeli
2003-02-10 20:14                                               ` Hans Reiser
2003-02-10 13:19                                             ` Nick Piggin
2003-02-10 14:49                                         ` stochastic fair queueing in the elevator [Re: [BENCHMARK] 2 Giuliano Pochini
2003-02-10 15:05                                           ` Andrea Arcangeli
2003-02-10 11:25                                   ` stochastic fair queueing in the elevator [Re: [BENCHMARK] 2.4.20-ck3 / aa / rmap with contest] Hans Reiser
2003-02-10 11:42                                     ` Andrew Morton
2003-02-10 13:00                                       ` Hans Reiser
2003-02-10 10:48                             ` Andrew Morton [this message]
2003-02-10 10:55                               ` Nick Piggin
2003-02-10 11:21                               ` Andrea Arcangeli
2003-02-10 11:33                                 ` Andrew Morton
2003-02-10 11:43                                   ` Andrea Arcangeli
2003-02-10 11:39                                 ` Nick Piggin
2003-02-10  9:59                       ` Hans Reiser
2003-02-10 10:06                         ` Andrew Morton
2003-02-10 10:17                           ` Hans Reiser
2003-02-10 10:39                           ` Hans Reiser
2003-02-10  8:27                     ` Nick Piggin
2003-02-10  9:02                       ` Andrea Arcangeli
2003-02-10  9:18                         ` Nick Piggin
2003-02-10 20:33                         ` Kurt Garloff
2003-02-10 21:43                           ` Rik van Riel
2003-02-10  5:01             ` Andrew Morton
2003-02-10  7:34             ` Andrea Arcangeli
2003-02-10  4:44     ` Rik van Riel
2003-02-10  7:31       ` Andrea Arcangeli
2003-02-10  7:17     ` Andrea Arcangeli
2003-02-10  7:39       ` Nick Piggin
2003-02-10 10:03     ` stochastic fair queueing in the elevator [Re: [BENCHMARK] 2 Giuliano Pochini
2003-02-10 16:23   ` stochastic fair queueing in the elevator [Re: [BENCHMARK] 2.4.20-ck3 / aa / rmap with contest] Pavel Machek
2003-02-11 11:49     ` Andrea Arcangeli
2003-02-11 12:43       ` Jens Axboe
2003-02-11 14:28         ` Jason Lunz
2003-02-11 14:41           ` Jens Axboe
2003-02-11 17:17             ` Jason Lunz
2003-02-11 20:19               ` Jens Axboe
2003-02-10 16:47   ` Pavel Machek
2003-02-11 11:01     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030210024810.43a57910.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=andrea@suse.de \
    --cc=axboe@suse.de \
    --cc=ckolivas@yahoo.com.au \
    --cc=david.lang@digitalinsight.com \
    --cc=jakob@unthought.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=piggin@cyberone.com.au \
    --cc=reiser@namesys.com \
    --cc=riel@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).