Re: Reducing System Allocator Thrashing of ExecutorState to Alleviate FDW-related Performance Degradations

From: Andres Freund <andres(at)anarazel(dot)de>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Reducing System Allocator Thrashing of ExecutorState to Alleviate FDW-related Performance Degradations
Date: 2023-02-20 18:30:10
Message-ID: 20230220183010.kwasdlkgug6veacd@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-02-17 09:52:01 -0800, Andres Freund wrote:
> On 2023-02-17 17:26:20 +1300, David Rowley wrote:
> Random note:
>
> I wonder if we should having a bitmap (in an int) in front of aset's
> freelist. In a lot of cases we incur plenty cache misses, just to find the
> freelist bucket empty.

Two somewhat related thoughts:

1) We should move AllocBlockData->freeptr into AllocSetContext. It's only ever
used for the block at the head of ->blocks.

We completely unnecessarily incur more cache line misses due to this (and
waste a tiny bit of space).

2) We should introduce an API mcxt.c API to perform allocations that the
caller promises not to individually free. We've talked a bunch about
introducing a bump allocator memory context, but that requires using
dedicated memory contexts, which incurs noticable space overhead, whereas
just having a separate function call for the existing memory contexts
doesn't have that issue.

For aset.c we should just allocate from set->freeptr, without going through
the freelist. Obviously we'd not round up to a power of 2. And likely, at
least outside of assert builds, we should not have a chunk header.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-02-20 18:43:56 Re: meson: Optionally disable installation of test modules
Previous Message David Geier 2023-02-20 18:18:22 Re: Performance issues with parallelism and LIMIT