Re: Time to up bgwriter_lru_maxpages?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Time to up bgwriter_lru_maxpages?
Date: 2017-02-04 00:20:30
Message-ID: 20170204002030.jhe3nyslrxb4kefe@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-02-03 18:12:48 -0600, Jim Nasby wrote:
> Interesting. Probably kills a couple birds with one stone:
>
> - This should be a lot cheaper for backends then the clock sweep

Right, that's one of the motivations - the current method is pretty much
guaranteed to create the worst cacheline bouncing possible.

> - The ringbuffers in shared buffers can be problematic. One possible way of
> solving that is to get rid of ringbuffers entirely and rely on different
> initial values for usage_count instead, but that's not desirable if it just
> means more clock sweep work for backends.

I'm not quite sure which ringbuffer you're referring to here? If to the
new one, why is it problematic?

> FWIW, I started looking into this stuff because of a customer system where
> shared buffers is currently ~4x larger than the cluster, yet there's a
> non-trivial amount of buffers being written by backends.

That's probably not related to bgwriter then. If there's free pages
available (which there have to be if s_b is bigger than the cluster)
there'll be no clock sweep / victim buffers. I strongly suspect that
you're seeing backend writes due to the write ringbuffers, e.g. by
seqscans, copy, vacuum - those won't be affected in either case.

I'd suggest installing pg_stat_statements and enabling track_io_timings
- that'll tell you which statements triggered backend writes and how
long they took.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-02-04 00:24:40 Re: Parallel Index Scans
Previous Message Thomas Munro 2017-02-04 00:15:13 Re: Parallel tuplesort (for parallel B-Tree index creation)