X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 02CB1D6FBF for ; Wed, 24 Aug 2005 03:22:05 -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 84569-05 for ; Wed, 24 Aug 2005 06:22:00 +0000 (GMT) Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net [69.17.117.30]) by svr1.postgresql.org (Postfix) with ESMTP id 1D59FD6E30 for ; Wed, 24 Aug 2005 03:21:54 -0300 (ADT) Received: (qmail 10794 invoked from network); 24 Aug 2005 06:21:54 -0000 Received: from dsl081-060-184.sfo1.dsl.speakeasy.net (HELO noodles) ([64.81.60.184]) (envelope-sender ) by mail28.sea5.speakeasy.net (qmail-ldap-1.03) with RC4-MD5 encrypted SMTP for ; 24 Aug 2005 06:21:54 -0000 Subject: Re: Read/Write block sizes From: "Jeffrey W. Baker" To: Tom Lane Cc: Guy Thornley , Josh Berkus , pgsql-performance@postgresql.org, Steve Poe , Chris Browne In-Reply-To: <21700.1124863004@sss.pgh.pa.us> References: <60k6icpapm.fsf@dba2.int.libertyrms.com> <1124846743.12045.94.camel@amd64-laptop-spoe> <200508231931.29682.josh@agliodbs.com> <1124852854.11147.5.camel@noodles> <20050824052023.GB31806@conker.esphion.com> <1124861121.11270.1.camel@noodles> <21700.1124863004@sss.pgh.pa.us> Content-Type: text/plain Date: Tue, 23 Aug 2005 23:22:52 -0700 Message-Id: <1124864572.11270.16.camel@noodles> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200508/378 X-Sequence-Number: 14125 On Wed, 2005-08-24 at 01:56 -0400, Tom Lane wrote: > "Jeffrey W. Baker" writes: > > On Wed, 2005-08-24 at 17:20 +1200, Guy Thornley wrote: > >> Dont forget that already in postgres, you have a process per connection, and > >> all the processes take care of their own I/O. > > > That's the problem. Instead you want 1 or 4 or 10 i/o slaves > > coordinating the I/O of all the backends optimally. For instance, with > > synchronous scanning. > > And why exactly are we going to do a better job of I/O scheduling than > the OS itself can do? ... > There are some things we could do to reduce the impedance between us and > the OS --- for instance, the upthread criticism that a seqscan asks the > OS for only 8K at a time is fair enough. But that doesn't translate > to a conclusion that we should schedule the I/O instead of the OS. Synchronous scanning is a fairly huge and obvious win. If you have two processes 180 degrees out-of-phase in a linear read, neither process is going to get anywhere near the throughput they would get from a single scan. I think you're being deliberately obtuse with regards to file I/O and the operating system. The OS isn't magical. It has to strike a balance between a reasonable read latency and a reasonable throughput. As far as the kernel is concerned, a busy postgresql server is indistinguishable from 100 unrelated activities. All backends will be served equally, even if in this case "equally" means "quite badly all around." An I/O slave process could be a big win in Postgres for many kinds of reads. Instead of opening and reading files the backends would connect to the I/O slave and request the file be read. If a scan of that file were already underway, the new backends would be attached. Otherwise a new scan would commence. In either case, the slave process can issue (sometimes non-dependant) reads well ahead of the needs of the backend. You may think the OS can do this for you but it can't. On postgres knows that it needs the whole file from beginning to end. The OS can only guess. Ask me sometime about my replacement for GNU sort. It uses the same sorting algorithm, but it's an order of magnitude faster due to better I/O strategy. Someday, in my infinite spare time, I hope to demonstrate that kind of improvement with a patch to pg. -jwb