Jim Nasby <[EMAIL PROTECTED]> writes:
> On Mar 8, 2007, at 11:51 PM, Greg Smith wrote:
>> almost everything that's dirty is also pinned during pgbench, and
>> the LRU is lucky to find anything it can write as a result
> I'm wondering if pg_bench is a good test of this stuff.
On reflection I think that Greg's result is probably unsurprising, and
furthermore does not indicate that anything is wrong.
What it shows (now that we got past the terminology) is that only about
half of the buffer pool is subject to replacement during any given clock
sweep. For low-usage pages that's about what you'd expect: a page is
sucked in on demand (using a buffer returned by the clock sweep), and
when we're done with it it'll have usage_count = 1. If it's not touched
again then when the clock sweep returns to it it'll be decremented to
usage_count 0, and on the next visit it'll be recycled for use as
something else. Thus for low-usage pages you'd fully expect that about
half of the buffer population has usage_count 1 and the rest has usage
count 0; which is strikingly close to Greg's measurement that 48.8%
of the population has usage_count 0.
What this seems to tell us is that pgbench's footprint of heavily used
pages (those able to achieve usage_counts above 1) is very small. Which
is probably right unless you've used a very large scale factor. I'd be
interested to know what scale factor and shared_buffers setting led to
the above measurement.
It strikes me that the patch would be more useful if it produced a
histogram of the observed usage_counts, rather than merely the count
for usage_count = 0.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?