X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 24DD253DEF for ; Thu, 14 Apr 2005 03:37:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29548-05 for ; Thu, 14 Apr 2005 06:37:27 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id D952D53DCC for ; Thu, 14 Apr 2005 03:37:26 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1DLxyW-0006Rl-00; Thu, 14 Apr 2005 02:37:16 -0400 To: Kevin Brown Cc: pgsql-performance@postgresql.org Subject: Re: How to improve db performance with $7K? References: <42515198.9090903@sfnet.cc> <33c6269f05040412126b5bc719@mail.gmail.com> <33c6269f050406083533d2045d@mail.gmail.com> <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> In-Reply-To: <20050414055655.GB19518@filer> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 14 Apr 2005 02:37:15 -0400 Message-ID: <878y3lj23o.fsf@stark.xeocode.com> Lines: 40 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/268 X-Sequence-Number: 11665 Kevin Brown 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