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 1uYuRE-00DMNi-Fi for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Jul 2025 22:35:52 +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 1uYuRC-004qfI-GG for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Jul 2025 22:35:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uYuRC-004qf6-2C for pgsql-hackers@lists.postgresql.org; Mon, 07 Jul 2025 22:35:50 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uYuR9-006LOQ-2L for pgsql-hackers@lists.postgresql.org; Mon, 07 Jul 2025 22:35:50 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 8242F432D1; Mon, 7 Jul 2025 22:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1751927746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QWZaUq2Qb6ymwvyt32Hu4FSIBFckfhBm/SnkNCZYLTI=; b=pUo0wNnZePO4qN1zbPVaSdi0e1sTI9l91OAQJN5175hTg6/YDchIGOV+S0FPfE9mzpaj4f RzAaQZot1UpHVqXEI67Xe21e5dV6Q2H1EnJkjTvelsDqK5egp/gFkoUS8wlsyh2TTSKcVC PIENUdmV6q6T//5KC9vWU+3zK8xKsKwspeDc1OxAKzgnDregMQYs0WMnfUEEU8ZygK11CN rpJzyqW3gl8+vBBnd+LymZ22mcEG+Zuy88kG9Sx2YKrR1wbC+pM0tPYT1DTN/l8+6NXaYg Wcn2mEea/tQ1QULWzMG5xztM3buRwhcZDwFgYrQjs8GkTl49qmmKLZoumZr9DA== Message-ID: <2616b89d-3cd0-4a38-915d-2741da81e0a1@vondra.me> Date: Tue, 8 Jul 2025 00:35:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Adding basic NUMA awareness - Preliminary feedback and outline for an extensible approach To: =?UTF-8?Q?C=C3=A9dric_Villemain?= , 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> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdeffedtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomhepvfhomhgrshcugghonhgurhgruceothhomhgrshesvhhonhgurhgrrdhmvgeqnecuggftrfgrthhtvghrnhepkeffvddugeetfeeileffteekleffgefghfeuffefhfelkeeltefhfeeigefgffeknecukfhppeekiedrgeelrddvfedtrddvtdeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeeirdegledrvdeftddrvddtiedphhgvlhhopegluddtrddufeejrddtrddvngdpmhgrihhlfhhrohhmpehtohhmrghssehvohhnughrrgdrmhgvpdhnsggprhgtphhtthhopedvpdhrtghpthhtoheptggvughrihgtrdhvihhllhgvmhgrihhnsegurghtrgdqsggvnhgvrdhiohdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-GND-Sasl: tomas@vondra.me List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/7/25 16:51, Cédric 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 at >> 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 some > 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). > 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 ... 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. 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. 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). regards -- Tomas Vondra