pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Xiaoning Ding <dingxn@cse.ohio-state.edu>
To: Erik Jones <erik@myemma.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: a question about Direct I/O and double buffering
Date: Thu, 05 Apr 2007 14:22:53 -0400
Message-ID: <46153E7D.7030208@cse.ohio-state.edu> (raw)
In-Reply-To: <4C4C834E-9304-4E23-AD15-1756921500B5@myemma.com>
References: <46152D5D.5030602@cse.ohio-state.edu>
	<4C4C834E-9304-4E23-AD15-1756921500B5@myemma.com>

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.

I use Linux.  It supports direct I/O on a per-file basis only.  To 
bypass OS buffer cache,
files should be opened with O_DIRECT option.  I afraid that I have to 
modify PG.

Xiaoning
> 
> erik jones <erik@myemma.com <mailto:erik@myemma.com>>
> software developer
> 615-296-0838
> emma(r)
> 
> 
> 




view thread (16+ messages)  latest in thread

Message-ID: <46153E7D.7030208@cse.ohio-state.edu>
Permalink:  ../46153E7D.7030208@cse.ohio-state.edu/
Also on:    postgresql.org/message-id/46153E7D.7030208@cse.ohio-state.edu

 · 

reply

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: dingxn@cse.ohio-state.edu, erik@myemma.com
  Subject: Re: a question about Direct I/O and double buffering
  In-Reply-To: <46153E7D.7030208@cse.ohio-state.edu>

* 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