From: Kevin Brown <kevin@sysexperts.com>
To: pgsql-performance@postgresql.org
Subject: Re: How to improve db performance with $7K?
Date: Thu, 14 Apr 2005 01:36:08 -0700
Message-ID: <20050414083608.GC19518@filer> (raw)
In-Reply-To: <878y3lj23o.fsf@stark.xeocode.com>
References: <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>
<878y3lj23o.fsf@stark.xeocode.com>
Greg Stark wrote:
> 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.
Well, strictly speaking it doesn't *have* to. It could delay for a
couple of milliseconds to see if other requests come in, and then
issue the read if none do. If there are already other requests being
fulfilled, then it'll schedule the request in question just like the
rest.
> 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.
This is true, but now you're talking about a situation where the
system goes from an essentially idle state to one of furious
activity. In other words, it's a corner case that I strongly suspect
isn't typical in situations where SCSI has historically made a big
difference.
Once the first request has been fulfilled, the driver can now schedule
the rest of the queued-up requests in disk-layout order.
I really don't see how this is any different between a system that has
tagged queueing to the disks and one that doesn't. The only
difference is where the queueing happens. In the case of SCSI, the
queueing happens on the disks (or at least on the controller). In the
case of SATA, the queueing happens in the kernel.
I suppose the tagged queueing setup could begin the head movement and,
if another request comes in that requests a block on a cylinder
between where the head currently is and where it's going, go ahead and
read the block in question. But is that *really* what happens in a
tagged queueing system? It's the only major advantage I can see it
having.
> 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?
Perhaps.
But I rather doubt that has to be a huge penalty, if any. When a
process issues an fsync (or even a sync), the kernel doesn't *have* to
drop everything it's doing and get to work on it immediately. It
could easily gather a few more requests, bundle them up, and then
issue them. If there's a lot of disk activity, it's probably smart to
do just that. All fsync and sync require is that the caller block
until the data hits the disk (from the point of view of the kernel).
The specification doesn't require that the kernel act on the calls
immediately or write only the blocks referred to by the call in
question.
--
Kevin Brown kevin@sysexperts.com
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: kevin@sysexperts.com
Subject: Re: How to improve db performance with $7K?
In-Reply-To: <20050414083608.GC19518@filer>
* 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