Re: W-TinyLfu for cache eviction

Поиск
Список
Период
Сортировка
От Ants Aasma
Тема Re: W-TinyLfu for cache eviction
Дата
Msg-id CA+CSw_uTDK5yUEkYvTVtK9EUZ2-mYqFUXkBKnqi-pnCdwGK9Mg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: W-TinyLfu for cache eviction  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
Ответы Re: W-TinyLfu for cache eviction  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Список pgsql-hackers
On Wed, Dec 9, 2015 at 11:31 AM, Konstantin Knizhnik
<k.knizhnik@postgrespro.ru> wrote:
> I expect synchronization issues with implementation of this algorithm. It
> seems to be hard to avoid some global critical section which can cause
> significant performance degradation at MPP systems (see topic "Move
> PinBuffer and UnpinBuffer to atomics").

The sketch updates don't really need to be globally consistent,
anything that is faster than cycling of buffers through the LRU tier
would be enough. In principle atomic increments could be used, but
funneling all buffer hits onto a small amount of cachelines and then
doing 4x the amount of writes would result in extremely nasty cache
line ping-ponging. Caffeine implementation appears to solve this by
batching the frequency sketch updates using a striped set of circular
buffers. Re-implementing this is not exactly trivial and some prior
experience with lock free programming seems well advised.

Based on the paper it looks like this algorithm can work with a low
quality primary eviction algorithm. Swapping our GCLOCK out for
something simpler like plain CLOCK could simplify an atomics based
PinBuffer approach. Another interesting avenue for research would be
to use ideas in TinyLFU to implement a tier of "nailed" buffers that
have backend local or striped pin-unpin accounting.

But for checking if the replacement policy implemented by W-TinyLFU is
good it isn't necessary to have a performant locking solution. I think
a global lock would be good enough for a proof of concept that only
evaluates cache hit ratios.

Regards,
Ants Aasma



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: exposing pg_controldata and pg_config as functions
Следующее
От: Aleksander Alekseev
Дата:
Сообщение: Re: Patch: ResourceOwner optimization for tables with many partitions