Re: double-buffering page writes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: double-buffering page writes
Дата
Msg-id 10674.1224780862@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: double-buffering page writes  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Alvaro Herrera wrote:
>> I thought about that too.  I admit I am not sure if this really works
>> portably; however I don't want to add a palloc() to that routine.

> It should work, AFAIK, but unaligned memcpy()s and write()s can be a 
> significantly slower. There can be only one write() happening at any 
> time, so you could just palloc() a single 8k buffer in TopMemoryContext 
> in backend startup, and always use that.

Some time ago, we arranged for shared buffers to be aligned on *more*
than maxalign boundaries (cf BUFFERALIGN) because on at least some
platforms this makes a very significant difference in the speed of
copying to/from kernel space.  If you are going to double-buffer it
is going to be important to have the intermediate buffer just as well
aligned.  A local char array won't be acceptable, and even for a
palloc'd one you'll need to take some extra steps (like wasting
ALIGNOF_BUFFER extra bytes so you can align the pointer palloc gives).
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unicode escapes in literals
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Hot Standby utility and administrator functions