Re: CLOG contention

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: CLOG contention
Date: 2012-01-06 19:42:37
Message-ID: CA+TgmoYpQyiZTby5u6NkiYy_gyCrmqM0+6mO0UuKdmsa_61a6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 6, 2012 at 11:05 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> After thinking about this a bit, I think the problem is that the
>> divisor we picked is still too high.  Suppose we set num_clog_buffers
>> = (shared_buffers / 4MB), with a minimum of 4 and maximum of 32.
>
> Works for me.

Done. I tested this on my MacBook Pro and I see no statistically
significant difference from the change on a couple of small pgbench
tests. Hopefully that means this is good on large boxes and at worst
harmless on small ones.

As far as I can see, the trade-off is this: If you increase the number
of CLOG buffers, then your CLOG miss rate will go down. On the other
hand, the cost of looking up a CLOG buffer will go up. At some point,
the reduction in the miss rate will not be enough to pay for a longer
linear search - which also means holding CLogControlLock. I think
it'd probably be worthwhile to think about looking for something
slightly smarter than a linear search at some point, and maybe also
looking for a way to partition the locking better. But, this at least
picks the available load-hanging fruit, which is a good place to
start.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2012-01-06 19:45:45 Re: 16-bit page checksums for 9.2
Previous Message Andres Freund 2012-01-06 19:35:01 Re: 16-bit page checksums for 9.2