Re: Misaligned BufferDescriptors causing major performance problems on AMD

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Misaligned BufferDescriptors causing major performance problems on AMD
Дата
Msg-id 20150128184715.GD13446@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: Misaligned BufferDescriptors causing major performance problems on AMD  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Misaligned BufferDescriptors causing major performance problems on AMD  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2015-01-28 13:38:51 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> >> I personally still think that a comment above sbufdesc's definition
> >> would be sufficient for now. But whatever. I'll enforce 64byte padding
> >> on 64bit platforms, and do nothing on 32bit platforms.
> 
> > Patch doing that attached.
> 
> Surely the sizeof() in BufferShmemSize needs to be
> sizeof(BufferDescPadded) now?

Good catch. It'd surely fail nastily later, once somebody actually made
the size change away from 64 bytes.

> Also, the macro is unnecessarily unsafe for use in #if tests; why not
> something like

Out of curiosity: What's the danger you're seing?

I'm perfectly fine with using SIZEOF_VOID_P, I actually looked for a
macro like it and didn't find anything.

> #define BUFFERDESC_PADDED_SIZE    (SIZEOF_VOID_P == 8 ? 64 : 32)

Hm, did you intentionally put a 32in there or was that just the logical
continuation of 64? Because there's no way it'll ever fit into 32 bytes
in the near future. That's why I had put the sizeof(BufferDesc)
there. We could just make it 1 as well, to indicate that we don't want
any padding...

> Otherwise it looks reasonably sane to me, just in a quick once-over;
> I didn't test.

I tested it on both 32/64 bit linux and it indeed fixes the issue of
changing performance due to max_connections+-1.

Greetings,

Andres Freund

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



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Misaligned BufferDescriptors causing major performance problems on AMD
Следующее
От: Tom Lane
Дата:
Сообщение: Re: hung backends stuck in spinlock heavy endless loop