Re: Page replacement algorithm in buffer cache

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Page replacement algorithm in buffer cache
Дата
Msg-id 20130402173510.GI2415@alap2.anarazel.de
обсуждение исходный текст
Ответ на Re: Page replacement algorithm in buffer cache  (Greg Stark <stark@mit.edu>)
Список pgsql-hackers
On 2013-04-02 18:26:23 +0100, Greg Stark wrote:
> I'm confused by this thread. We *used* to maintain an LRU. The whole
> reason for the clock-sweep algorithm is precisely to avoid maintaining
> a linked list of least recently used buffers since the head of that
> list is a point of contention.

I don't think anybody is proposing to put the LRU back into a linked list,
given the frequency of usagecount manipulations that would probably end pretty
badly. What I think Robert, Tom and I are talking are talking about is putting
*some* buffers with usagecount = 0 into a linked list so that when a backend
requires a new page it can take one buffer from the freelist instead of

a) possibly touching quite some (I have seen 4 times *every* existing header)
pages to find one with usagecount = 0
b) having to write the page out itself

If everything is going well that would mean only the bgwritter (or if
bgfreelist or whatever) performs the clock sweep. Others take *new* pages from
the freelist instead of performing part of the sweep themselves.

Makes more sense?

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Page replacement algorithm in buffer cache
Следующее
От: "David E. Wheeler"
Дата:
Сообщение: Re: citext like searches using index