Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qDtNN-0005KS-LR for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Jun 2023 21:03:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qDtNM-0005aA-Bw for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Jun 2023 21:03:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qDtNM-0005Wg-1g for pgsql-hackers@lists.postgresql.org; Mon, 26 Jun 2023 21:03:56 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qDtNI-000ecc-OI for pgsql-hackers@postgresql.org; Mon, 26 Jun 2023 21:03:55 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 219295C00E4; Mon, 26 Jun 2023 17:03:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 26 Jun 2023 17:03:50 -0400 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=fm2; t=1687813430; x=1687899830; bh=4N GvpNjnHYhKo3AS3eqXs2g7CH6FIqTV+ZHoHQv/ow8=; b=ZC71AGPDu54by7Vr+c A/Wk2eJynIcVMNwHxYIx9i7DdRam7Trf4Uf9YgwztPDi4kEgsVNntJH31s3suQvB tgso11NixtCxYIXuI2WE3VcrHxDTq4I4btPEgfPZAiF7mHgbazbQwVz0HHgKRaoE 7J2XjkCwYTi/pvwN08rfOzySgi/kNE6sxgwBbKyU0pNjDHzLzSwAlBDUmmWMUFy7 N1r5lI2BqBdUwphfJr6HckgDXhf/JYzAhv544SVbd0NYjJRklk5YjWs+g6qyjwSX 03wOss+xv6QSPSHBEJs7PEjEsPuwyG8miCEyum6ie+LCLC008m46iwTXpC2Epq/J gOOg== 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=fm2; t=1687813430; x=1687899830; bh=4NGvpNjnHYhKo 3AS3eqXs2g7CH6FIqTV+ZHoHQv/ow8=; b=TNc+v++caMqprlHptueP+2SG//XKh d8qRZZxtp1ApLzt/BbEo/jdKY9Ot3MKrn28bztMIj2JUhpL1ZVk8KKy4KMI22nnu V/ghWbuGsoXzV6uD+Nmev//naYWwXBC78HCbiFaJWU0hpnysSA+8pMtX+0HrSm6D bQbA4by5ZlmDUaz2+xKoqRTNevxGkhyJ2YdWDvWfU1qswiU7BvRShcjUD80lPnQP uppn36ByyRu5DMFsgC6UvC3nsvQv8KcRNB3tCmXhPU9A/eiFn3Rfwcah8XPOej1X wiN0s6xA9jJIwB/YlIpZaMENyKiFfE3T5WhCXNmaydUa9sOtlW9oD0dVA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeehfedgudehvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Jun 2023 17:03:49 -0400 (EDT) Date: Mon, 26 Jun 2023 14:03:48 -0700 From: Andres Freund To: Ronan Dunklau Cc: pgsql-hackers@postgresql.org, Peter Eisentraut , tomas.vondra@enterprisedb.com Subject: Re: Add GUC to tune glibc's malloc implementation. Message-ID: <20230626210348.rk4h3bscdtcwbe7o@awork3.anarazel.de> References: <3424675.QJadu78ljV@aivenlaptop> <2285512.ElGaqSPkdT@aivenlaptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2285512.ElGaqSPkdT@aivenlaptop> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-06-26 08:38:35 +0200, Ronan Dunklau wrote: > I hope what I'm trying to achieve is clearer that way. Maybe this patch is not > the best way to go about this, but since the memory allocator behaviour can > have such an impact it's a bit sad we have to leave half the performance on > the table because of it when there are easily accessible knobs to avoid it. I'm *quite* doubtful this patch is the way to go. If we want to more tightly control memory allocation patterns, because we have more information than glibc, we should do that, rather than try to nudge glibc's malloc in random direction. In contrast a generic malloc() implementation we can have much more information about memory lifetimes etc due to memory contexts. We e.g. could keep a larger number of memory blocks reserved ourselves. Possibly by delaying the release of additionally held blocks until we have been idle for a few seconds or such. WRT to the difference in TPS in the benchmark you mention - I suspect that we are doing something bad that needs to be improved regardless of the underlying memory allocator implementation. Due to the lack of detailed instructions I couldn't reproduce the results immediately. Greetings, Andres Freund