Re: Page replacement algorithm in buffer cache

Поиск
Список
Период
Сортировка
От Ants Aasma
Тема Re: Page replacement algorithm in buffer cache
Дата
Msg-id CA+CSw_sZnh4jGSN-3WrewkgPqS7tU8zsXjtdpd66bX3-_Mkayw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Page replacement algorithm in buffer cache  (Atri Sharma <atri.jiit@gmail.com>)
Ответы Re: Page replacement algorithm in buffer cache  (Atri Sharma <atri.jiit@gmail.com>)
Список pgsql-hackers
On Sun, Mar 24, 2013 at 9:29 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
>> I'll have to take a look.  Removing *all spinning* from from page
>> allocation though feels like it might be worthwhile to test (got to
>> give some bonus points for being a very local change and simple to
>> implement).  I wonder if with more shared buffers you tend to sweep
>> more buffers per allocation.  (IIRC Jeff J was skeptical of that).
>
> Replacing the spinning with TAS for buffer header sounds like a good idea.

Well, TAS is exactly what spinlocks are spinning on. Plain old
unlocked read-modify-write should be good enough for clock sweep usage
count update with the header lock taken only when we decide to try and
evict something. The data raciness will mean a higher or lower than
normal usage count when two an increment and decrement race each
other. The race is only likely for buffers with high contention. 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.

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.

Regards,
Ants Aasma
--
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Jaskiewicz
Дата:
Сообщение: [proof of concept] Evolving postgresql.conf using genetic algorithm
Следующее
От: Greg Smith
Дата:
Сообщение: Re: Page replacement algorithm in buffer cache