Skip site navigation (1) Skip section navigation (2)

Re: bgwriter statistics

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: bgwriter statistics
Date: 2006-06-05 09:17:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On 2006-06-02 21:26, Jim Nasby wrote:

> Now that we've got a nice amount of tuneability in the bgwriter, it
> would be nice if we had as much insight into how it's actually doing.
> I'd like to propose that the following info be added to the stats
> framework to assist in tuning it:

I'm interested in your idea. You want to know what bgwriter does.
Also, I think there is another perspective; what bgwriter *should* do.
I imagine the information that pages are dirty or not is useful for
the purpose.

- dirty_pages:
        The number of pages with BM_DIRTY in the buffer pool.
- replaced_dirty:
        Total replaced pages with BM_DIRTY.
        Backends should write the pages themselves.
- replaced_clean:
        Same as above, but without BM_DIRTY.
        Backends can replace them freely.

Bgwriter should boost ALL activity if dirty_pages is high,
and boost LRU activity if replaced_dirty is high.
In ideal, the parameters of bgwriter can be tuned almost automatically:

- LRU scans = replaced_dirty + replaced_clean
- LRU writes = replaced_dirty
- ALL scans/writes = the value that can keep dirty_pages low

However, tracking the number of dirty pages is not free. I suppose
the implementation should be well considered to avoid lock contentions.

Comments are welcome.

ITAGAKI Takahiro
NTT OSS Center

In response to

pgsql-hackers by date

Next:From: Hannu KrosingDate: 2006-06-05 09:28:08
Subject: Re: More thoughts about planner's cost estimates
Previous:From: Bruce MomjianDate: 2006-06-05 03:55:29
Subject: Re: Re [HACKERS]: Still not happy with psql's multiline history behavior

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group