Re: [HACKERS] Clock with Adaptive Replacement

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Юрий Соколов <funny(dot)falcon(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, Stephen Frost <sfrost(at)snowman(dot)net>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Clock with Adaptive Replacement
Date: 2018-05-05 06:16:57
Message-ID: 20970C0A-C17A-44D2-8DE4-F17F02EE51EF@yandex-team.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

> 4 мая 2018 г., в 16:05, Юрий Соколов <funny(dot)falcon(at)gmail(dot)com> написал(а):
>
> I didn't suggest log scale of usages, but rather "replacement-period based" increment: usage count could be incremented at most once in NBlocks/32 replaced items. Once it is incremented, its "replacement time" is remembered, and next NBlocks/32 replacements usage count of this buffer doesn't increment.
> This way, increment is synchronized with replacement activity.
But you loose difference between "touched once" and "actively used". Log scale of usage solves this: usage count grows logarithmically, but drains linearly.

>
> Digging further, I suggest as improvement of GClock algorithm:
> - placing new buffer with usage count = 0 (and next NBlock/32 replacements its usage count doesn't increased)
> - increment not by 1, but by 8 (it simulates "hot queue" of popular algorithms) with limit 32.
> - scan at most 25 buffers for eviction. If no buffer with zero usage count found, the least used buffer (among scanned 25) is evicted.
> (new buffers are not evicted during their first NBlock/32 replacements).
>

I do not understand where these numbers come from...

Best regards, Andrey Borodin.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yura Sokolov 2018-05-05 08:25:05 Re: [HACKERS] Clock with Adaptive Replacement
Previous Message Tom Lane 2018-05-05 02:18:40 Re: Draft release notes are up