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 1r0mEa-007mGk-9s for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Nov 2023 17:20:56 +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 1r0mEY-006FJb-8r for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Nov 2023 17:20:54 +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 1r0mEX-006FJS-VZ for pgsql-hackers@lists.postgresql.org; Wed, 08 Nov 2023 17:20:53 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r0mEU-005NzF-HZ for pgsql-hackers@lists.postgresql.org; Wed, 08 Nov 2023 17:20:53 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id DCF4F320090A; Wed, 8 Nov 2023 12:20:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 08 Nov 2023 12:20:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1699464046; x=1699550446; bh=Hj 8uifXpM5JSJuMjwyqWG5CUirxqcIyBfqcd1sXXh3Q=; b=Iu59POBklAdUGlndON 013jjCoUwPTVDNT4bc01zrRKfha0mEMyYbgOHyRktVYnS4ZBDz2l1QZsBsF2V8zu EVRIpkagn44c9WX/YDKUyvAG/9tWf9qjJIzjK/5JLiGVHhSFYSdyoiACxfCLXV9F TMxBFIEygk94uNSFMAGBtVJXWkTwrnwqqIqeZxKYyiCW3qQRRvcq8fHHWvu7Qob7 8pmLtSKdmTjLdASuksbEz0qxwX8kd+WGNfK+/CEdkibsRgCR3uKJ1SPRZxQbp76V +rofhOC75a0cA7Yb2saYIUialsKrVrt3yKx0bp7lFh0US9gijG9brk9WBEWgry9v Cy9w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1699464046; x=1699550446; bh=Hj8uifXpM5JSJ uMjwyqWG5CUirxqcIyBfqcd1sXXh3Q=; b=E/l6Cdd4BmTlVHl5AphQA1ryW0ioX zcV7xj0w43G8Ue1rsw5CjU2/HG5w4+yrJE/dB3Y0qX8C+fkN53+h2cZeDdt8nI1G MiRwbDMRA8KMF327yqlvGjrv4JOuHNHrQIbjjISCrugCa/9mD20XnA2MC6voHq6e gOGFR93crZH+v+SZDRhvUw3V1EoR+4snaGfAVmvOrmHPyeYzgFszjg49xgAC9H0H PigxZdIK22/EYWxQ7ARzK2Ghq3M8iCJlUzDFDMk0AiIVvUBCg4CJvsoTZVusCOZ/ +nCd4HdSDCc4T90gVLZKfdQC4GoRGrLd5PZTrRjjNs0tMbVPtLE+oNhUQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudduledgleekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Nov 2023 12:20:45 -0500 (EST) Date: Wed, 8 Nov 2023 09:20:44 -0800 From: Andres Freund To: Stephen Frost Cc: John Morris , Andrei Lepikhov , "reid.thompson@crunchydata.com" , Arne Roland , "pgsql-hackers@lists.postgresql.org" , vignesh C , Justin Pryzby , Ibrar Ahmed , "stephen.frost" Subject: Re: Add the ability to limit the amount of memory that can be allocated to backends. Message-ID: <20231108172044.u6i5lw5j2euuhsdr@awork3.anarazel.de> References: <20231104041900.27pgqsknb3yl45zy@awork3.anarazel.de> <20231107195506.4i2tk352cvfs44t6@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-11-07 15:55:48 -0500, Stephen Frost wrote: > * Andres Freund (andres@anarazel.de) wrote: > > On 2023-11-06 13:02:50 -0500, Stephen Frost wrote: > > > > > The max_total_memory limit is checked whenever the global counters are > > > > > updated. There is no special error handling if a memory allocation exceeds > > > > > the global limit. That allocation returns a NULL for malloc style > > > > > allocations or an ENOMEM for shared memory allocations. Postgres has > > > > > existing mechanisms for dealing with out of memory conditions. > > > > > > > > I still think it's extremely unwise to do tracking of memory and limiting of > > > > memory in one patch. You should work towards and acceptable patch that just > > > > tracks memory usage in an as simple and low overhead way as possible. Then we > > > > later can build on that. > > > > > > Frankly, while tracking is interesting, the limiting is the feature > > > that's needed more urgently imv. > > > > I agree that we need limiting, but that the tracking needs to be very robust > > for that to be usable. > > Is there an issue with the tracking in the patch that you saw? That's > certainly an area that we've tried hard to get right and to match up to > numbers from the rest of the system, such as the memory context system. There's some details I am pretty sure aren't right - the DSM tracking piece seems bogus to me. But beyond that: I don't know. There's enough other stuff in the patch that it's hard to focus on that aspect. That's why I'd like to merge a patch doing just that, so we actually can collect numbers. If any of the developers of the patch had focused on polishing that part instead of focusing on the limiting, it'd have been ready to be merged a while ago, maybe even in 16. I think the limiting piece is unlikely to be ready for 17. Greetings, Andres Freund