Re: Adding basic NUMA awareness

From: Greg Burd <greg(at)burd(dot)me>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Subject: Re: Adding basic NUMA awareness
Date: 2025-07-09 16:55:51
Message-ID: DC1A4B14-70B7-4B44-AD0B-E05D3292D833@getmailspring.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jul 9 2025, at 12:35 pm, Andres Freund <andres(at)anarazel(dot)de> wrote:

> FWIW, I've started to wonder if we shouldn't just get rid of the freelist
> entirely. While clocksweep is perhaps minutely slower in a single
> thread than
> the freelist, clock sweep scales *considerably* better [1]. As it's rather
> rare to be bottlenecked on clock sweep speed for a single thread
> (rather then
> IO or memory copy overhead), I think it's worth favoring clock sweep.

Hey Andres, thanks for spending time on this. I've worked before on
freelist implementations (last one in LMDB) and I think you're onto
something. I think it's an innovative idea and that the speed
difference will either be lost in the noise or potentially entirely
mitigated by avoiding duplicate work.

> Also needing to switch between getting buffers from the freelist and
> the sweep
> makes the code more expensive. I think just having the buffer in the sweep,
> with a refcount / usagecount of zero would suffice.

If you're not already coding this, I'll jump in. :)

> That seems particularly advantageous if we invest energy in making the clock
> sweep deal well with NUMA systems, because we don't need have both a NUMA
> aware freelist and a NUMA aware clock sweep.

100% agree here, very clever approach adapting clock sweep to a NUMA world.

best.

-greg

>
> Greetings,
>
> Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2025-07-09 16:58:27 Re: Buildfarm setup for AIX
Previous Message Mircea Cadariu 2025-07-09 16:37:20 Re: analyze-in-stages post upgrade questions