Re: Page replacement algorithm in buffer cache

From: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
To: Ants Aasma <ants(at)cybertec(dot)at>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <stark(at)mit(dot)edu>, Amit Kapila <amit(dot)kapila(at)huawei(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Page replacement algorithm in buffer cache
Date: 2013-03-24 17:03:58
Message-ID: CAOeZVicLQtHUKTU-vFV6qJ0AUi_2nVXY_T+Mx7jHbeTROA3b8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>If we
> use the value calculated locally to decide on eviction, the highly
> used buffers where this is likely will get at least one clock sweep
> cycle of grace time. If they are indeed highly used it's likely that
> someone will manage to bump the usage_count in the meanwhile. If they
> are not hot, a rare speedup or delay in eviction won't matter much.

Yeah, a buffer page getting an extra clock sweep life in lieu of
potential performance improvement isn't much of a cost to pay.

So, essentially, we decide locally which page to evict, then try to
get a lock on the header only when we want to evict the victim page?
Sounds like the contention for the header should go down considerably.

Unlocked incrementing/decrementing of USAGE_COUNT may lead to the
values of USAGE_COUNT differing from the actual value they should be
having by 1 or 2 counts in case of high contention buffer pages, which
shouldn't matter, as they are in high contention. I agree, it is
likely that a process(s) will increase the usage_count anyways.

> Getting rid of memory barriers associated with locking in the clock
> sweep will pipeline the loads and stores and so should bring on a good
> performance increase for scanning large swathes of buffer headers.
>
This does sound interesting. If the Jenkins based performance farm
gets ready, we can do some tests and see the kind of results we get.

Regards,

Atri

--
Regards,

Atri
l'apprenant

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-03-24 17:55:21 Re: pkg-config files for libpq and ecpg
Previous Message Atri Sharma 2013-03-24 16:46:52 Re: Page replacement algorithm in buffer cache