From: Greg Stark <gsstark@mit.edu>
To: Kevin Brown <kevin@sysexperts.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: How to improve db performance with $7K?
Date: 14 Apr 2005 02:37:15 -0400
Message-ID: <878y3lj23o.fsf@stark.xeocode.com> (raw)
In-Reply-To: <20050414055655.GB19518@filer>
References: <42515198.9090903@sfnet.cc>
<33c6269f05040412126b5bc719@mail.gmail.com>
<d30377$1jn8$1@news.hub.org>
<33c6269f050406083533d2045d@mail.gmail.com>
<d31f71$2epm$1@news.hub.org>
<33c6269f050406151241b01148@mail.gmail.com>
<20050406224102.GM93835@decibel.org>
<33c6269f0504061732195f6ae4@mail.gmail.com>
<87wtrfmgt5.fsf@stark.xeocode.com>
<13449.1112847297@sss.pgh.pa.us>
<20050414055655.GB19518@filer>
Kevin Brown <kevin@sysexperts.com> writes:
> My question is: why does this (physical I/O scheduling) seem to matter
> so much?
>
> Before you flame me for asking a terribly idiotic question, let me
> provide some context.
>
> The operating system maintains a (sometimes large) buffer cache, with
> each buffer being mapped to a "physical" (which in the case of RAID is
> really a virtual) location on the disk. When the kernel needs to
> flush the cache (e.g., during a sync(), or when it needs to free up
> some pages), it doesn't write the pages in memory address order, it
> writes them in *device* address order. And it, too, maintains a queue
> of disk write requests.
I think you're being misled by analyzing the write case.
Consider the read case. When a user process requests a block and that read
makes its way down to the driver level, the driver can't just put it aside and
wait until it's convenient. It has to go ahead and issue the read right away.
In the 10ms or so that it takes to seek to perform that read *nothing* gets
done. If the driver receives more read or write requests it just has to sit on
them and wait. 10ms is a lifetime for a computer. In that time dozens of other
processes could have been scheduled and issued reads of their own.
If any of those requests would have lied on the intervening tracks the drive
missed a chance to execute them. Worse, it actually has to backtrack to get to
them meaning another long seek.
The same thing would happen if you had lots of processes issuing lots of small
fsynced writes all over the place. Postgres doesn't really do that though. It
sort of does with the WAL logs, but that shouldn't cause a lot of seeking.
Perhaps it would mean that having your WAL share a spindle with other parts of
the OS would have a bigger penalty on IDE drives than on SCSI drives though?
--
greg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: gsstark@mit.edu, kevin@sysexperts.com
Subject: Re: How to improve db performance with $7K?
In-Reply-To: <878y3lj23o.fsf@stark.xeocode.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox