Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uYxR1-00E0zo-J5 for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jul 2025 01:47:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uYxQy-005bgf-8m for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jul 2025 01:47:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uYxQx-005bgI-Qr for pgsql-hackers@lists.postgresql.org; Tue, 08 Jul 2025 01:47:48 +0000 Received: from mailfr00.databene.net ([31.170.12.19]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uYxQu-0068eP-39 for pgsql-hackers@lists.postgresql.org; Tue, 08 Jul 2025 01:47:47 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mailfr00.databene.net (Postfix) with ESMTP id 7C7A35F2D0; Tue, 8 Jul 2025 03:47:43 +0200 (CEST) X-Virus-Scanned: by Amavis at mailfr00.databene.net Received: from mailfr00.databene.net ([127.0.0.1]) by localhost (databene-mailfr00.evolix.net [127.0.0.1]) (amavis, port 10024) with LMTP id yHUnTu5B0YR6; Tue, 8 Jul 2025 03:47:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=data-bene.io; s=2024; t=1751939260; bh=AKDejNhrvU3HI3oAugU7wSZuHYR9F1/vPM14vtlllXs=; h=Date:Subject:To:References:From:In-Reply-To:From; b=u70rudmf05MEOM+w1okC8YJDL05yXbIeLewNZkdLTL4zsciz42glskBzilSX9JmmC 2k6SMYWRpyN9D0ieDW2YqyFa5e/4TJq4yHrhMerueBq/LFf8wnOGfXDichwNQGa//L akAxLQh4Bt99+NuI96EE/+OCG1A7+Q/K8ZR5JGzDrJGu0sLUZeFGWIFGfeYtDFX3PG RmqPLAVk6PxAdXUrQsxUf+BZ0/Qk+oe/H4pTpraWkuo2gJuPvP4q6e2wW3cjiMRNP5 fw/acfyT2TeGXZHX0rooyOzi3kKd54VaPxXK5VyGAuuvmOYYOcLA6iO5xbJyBUjMV9 IZp4PP3h9slYZT1Pn5zuc3t8YarjxFkm1x0yT5i0nTj1OeJjMumRSkFNSNquoo1tt7 kFavwuwFdPIrokhArwjvgNw6XVWnvEuhXB+TdY77JGsRoZHQ37PzzOoGCAQaQv0j5A KcKmOd1C5gZSDLq0+69PhqRS7sck7vyXPvkRzfwtDF1cx0Qy0y6ebqjSF7zAKm+PjU JHit58uyo9IFHak3eiYX+Xj0yZvmzJzH7SXHM/QoJfqgXnmy44R4tVYIKdNS2XP41x LviaRBxdJz8jyJBlv6YrkcQE84ZttpuWLKchOPqheKNRaT4i+3KVDviKV4GMgx4Pvp bRshx0ywKrIoz5AKJeiSWabQ= Received: from [127.0.0.1] (257400053.box.freepro.com [95.178.90.96]) by mailfr00.databene.net (Postfix) with ESMTPSA id D678B5F2A1; Tue, 8 Jul 2025 03:47:40 +0200 (CEST) Message-ID: <1cd9d7e0-d1ae-4c74-91b5-fbbf8046ee56@data-bene.io> Date: Tue, 8 Jul 2025 01:47:00 +0000 MIME-Version: 1.0 Subject: Re: Adding basic NUMA awareness - Preliminary feedback and outline for an extensible approach To: Tomas Vondra , PostgreSQL Hackers References: <099b9433-2855-4f1b-b421-d078a5d82017@vondra.me> <1caea3b1-3e0b-4bdb-a630-75671f1f837a@data-bene.io> <8b3341ee-1f8e-4dbb-8046-410f71d4a0cb@vondra.me> <2616b89d-3cd0-4a38-915d-2741da81e0a1@vondra.me> From: =?UTF-8?Q?C=C3=A9dric_Villemain?= Autocrypt: addr=cedric.villemain@data-bene.io; keydata= xsBNBEvW1WwBCAC6CG3zZn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+grsmff8PUGtertKeXBr8NlliYZEFCilqus3PheOetWewysHROQJrqnSkpRP7zJWyFYY5 W6PWKQlUgcItrWsgPlHl5gmoH68zesTlW1rX1Z56V8vLPF7RTAPG6g1J7l29wLxUYTwF5Y64 gy+jXAEUJHKZABEBAAHCwF8EGAECAAkFAkvW1WwCGwwACgkQ2yAfTLNUF5ubKAgAtZdh0QJU Wc7WfZhoGOcAEADZJ9n6GSuhL+oxuhPfym1zsU70241rKYZH1m53CWWo+aNyThCXJx+HSSRV /hLNVW34DErJeNJIYwdxPo5/AjOhIUr4e8gMYuviFESBaMpgl8mSM1B1cHVBMZcsQb43Rc3V VfIMNRc4NB16uc7Sm++fbraQq13rB8HC6uYu7PbEAdX3C0IokR3JGb1NghQKga/OoU22KPEx Y+bFk4h3vq9MjlKLir0UJZHKSQ5xec6RcehoMBy0FHBEuK/72xN36dR/3bVwyeR76S7xf9UQ gXdpciBG95/tLRcpelwx8GaRcivTGc0FCBUzqG/YcCqvcA== In-Reply-To: <2616b89d-3cd0-4a38-915d-2741da81e0a1@vondra.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 7/7/25 16:51, C=C3=A9dric Villemain wrote: >>>> * Others might use it to integrate PostgreSQL's own resources (e.g., >>>> "areas" of shared buffers) into policies. >>>> >>>> Hope this perspective is helpful. >>> >>> Can you explain how you want to manage this by an extension defined a= t >>> the SQL level, when most of this stuff has to be done when setting up >>> shared memory, which is waaaay before we have any access to catalogs? >> >> I should have said module instead, I didn't follow carefully but at so= me >> point there were discussion about shared buffers resized "on-line". >> Anyway, it was just to give some few examples, maybe this one is to be >> considered later (I'm focused on cgroup/psi, and precisely reassigning >> PIDs as needed). >> >=20 > I don't know. I have a hard time imagining what exactly would the > policies / profiles do exactly to respond to changes in the system > utilization. And why should that interfere with this patch ... >=20 > The main thing patch series aims to implement is partitioning different > pieces of shared memory (buffers, freelists, ...) to better work for > NUMA. I don't think there's that many ways to do this, and I doubt it > makes sense to make this easily customizable from external modules of > any kind. I can imagine providing some API allowing to isolate the > instance on selected NUMA nodes, but that's about it. >=20 > Yes, there's some relation to the online resizing of shared buffers, in > which case we need to "refresh" some of the information. But AFAICS it'= s > not very extensive (on top of what already needs to happen after the > resize), and it'd happen within the boundaries of the partitioning > scheme. There's not that much flexibility. >=20 > The last bit (pinning backends to a NUMA node) is experimental, and > mostly intended for easier evaluation of the earlier parts (e.g. to > limit the noise when processes get moved to a CPU from a different NUMA > node, and so on). The backend pinning can be done by replacing your patch on proc.c to=20 call an external profile manager doing exactly the same thing maybe ? Similar to: pmroutine =3D GetPmRoutineForInitProcess(); if (pmroutine !=3D NULL && pmroutine->init_process !=3D NULL) pmroutine->init_process(MyProc); ... pmroutine =3D GetPmRoutineForInitAuxilliary(); if (pmroutine !=3D NULL && pmroutine->init_auxilliary !=3D NULL) pmroutine->init_auxilliary(MyProc); Added on some rare places should cover most if not all the requirement=20 around process placement (process_shared_preload_libraries() is called=20 earlier in the process creation I believe). --=20 C=C3=A9dric Villemain +33 6 20 30 22 52 https://www.Data-Bene.io PostgreSQL Support, Expertise, Training, R&D