Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id E9B909FB624 for ; Thu, 5 Apr 2007 15:29:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 59774-06 for ; Thu, 5 Apr 2007 15:28:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 4BEE09FB5CE for ; Thu, 5 Apr 2007 15:28:55 -0300 (ADT) Received: MIR3-FS.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes by MIR3-FS.mir3.com; 05 Apr 2007 11:27:10 -0700 Subject: Re: a question about Direct I/O and double buffering From: Mark Lewis To: Erik Jones Cc: Xiaoning Ding , pgsql-performance@postgresql.org In-Reply-To: <4C4C834E-9304-4E23-AD15-1756921500B5@myemma.com> References: <46152D5D.5030602@cse.ohio-state.edu> <4C4C834E-9304-4E23-AD15-1756921500B5@myemma.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Thu, 05 Apr 2007 11:27:09 -0700 Message-Id: <1175797629.5581.39.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/115 X-Sequence-Number: 23992 Not to hijack this thread, but has anybody here tested the behavior of PG on a file system with OS-level caching disabled via forcedirectio or by using an inherently non-caching file system such as ocfs2? I've been thinking about trying this setup to avoid double-caching now that the 8.x series scales shared buffers better, but I figured I'd ask first if anybody here had experience with similar configurations. -- Mark On Thu, 2007-04-05 at 13:09 -0500, Erik Jones wrote: > On Apr 5, 2007, at 12:09 PM, Xiaoning Ding wrote: > > > Hi, > > > > > > A page may be double buffered in PG's buffer pool and in OS's buffer > > cache. > > Other DBMS like DB2 and Oracle has provided Direct I/O option to > > eliminate > > double buffering. I noticed there were discusses on the list. But > > I can not find similar option in PG. Does PG support direct I/O now? > > > > > > The tuning guide of PG usually recommends a small shared buffer pool > > (compared > > to the size of physical memory). I think it is to avoid swapping. > > If > > there were > > swapping, OS kernel may swap out some pages in PG's buffer pool even > > PG > > want to keep them in memory. i.e. PG would loose full control over > > buffer pool. > > A large buffer pool is not good because it may > > 1. cause more pages double buffered, and thus decrease the > > efficiency of > > buffer > > cache and buffer pool. > > 2. may cause swapping. > > Am I right? > > > > > > If PG's buffer pool is small compared with physical memory, can I > > say > > that the > > hit ratio of PG's buffer pool is not so meaningful because most > > misses > > can be > > satisfied by OS Kernel's buffer cache? > > > > > > Thanks! > > > To the best of my knowledge, Postgres itself does not have a direct IO > option (although it would be a good addition). So, in order to use > direct IO with postgres you'll need to consult your filesystem docs > for how to set the forcedirectio mount option. I believe it can be > set dynamically, but if you want it to be permanent you'll to add it > to your fstab/vfstab file. > > > erik jones > software developer > 615-296-0838 > emma(r) > > > > >