Re: Clock sweep not caching enough B-Tree leaf pages?

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, Ants Aasma <ants(at)cybertec(dot)at>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clock sweep not caching enough B-Tree leaf pages?
Date: 2014-04-17 04:55:21
Message-ID: CAA4eK1JFxCK2aiOq-51+wEt6_200MKwfs9M4qE+-itE+aSSDhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 16, 2014 at 6:25 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Tue, Apr 15, 2014 at 11:27 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> Just to summarize you about the previous discussion and the
>> improvements that we decided to do in this area based on feedback
>> are as follows:
>>
>> 1. Bgwriter needs to be improved so that it can help in reducing
>> usage count and finding next victim buffer (run the clock sweep
>> and add buffers to the free list).
>> 2. SetLatch for bgwriter (wakeup bgwriter) when elements in freelist
>> are less.
>> 3. Split the workdone globallock (Buffreelist) in StrategyGetBuffer
>> (a spinlock for the freelist, and an lwlock for the clock sweep).
>> Here we can try to make it lock free based on atomic ops as
>> well.
>> 4. Bgwriter needs to be more aggressive, logic based on which it
>> calculates how many buffers it needs to process needs to be
>> improved.
>> 5. Contention around buffer mapping locks.
>> 6. Cacheline bouncing around the buffer header spinlocks, is there
>> anything we can do to reduce this?
>> 7. Choose Optimistically used buffer in StrategyGetBuffer().
>> 8. Don't bump the usage count every time buffer is pinned.
>
> What about: 9. Don't wait on locked buffer in the clock sweep.

Right, I remember you have written patch for it, I think we should
consider it along with point-6. In general, I think unless we first
improve the situation for BufFreelistLock and eviction strategy,
it might not show benefit.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-04-17 05:00:25 Re: Patch: iff -> if
Previous Message Bruce Momjian 2014-04-17 03:01:56 Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink