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 1oECfj-00041t-72 for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2022 16:35:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oECfh-0007i5-Uh for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2022 16:35:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oECef-0001KD-2b for pgsql-hackers@lists.postgresql.org; Wed, 20 Jul 2022 16:34:33 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oECec-0007iI-IR for pgsql-hackers@lists.postgresql.org; Wed, 20 Jul 2022 16:34:31 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0A0075C012E; Wed, 20 Jul 2022 12:34:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 20 Jul 2022 12:34:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc: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=1658334870; x=1658421270; bh=gDzpof67n5 ZWpwEVaS2H/TiO2r7OXcamOrQ2ZDna4v0=; b=CnEWYQ8oNtgoGMdXVq++Y0rEdr Yi856c4OlMnCoiBMKGgmf/ufMw6eG3+Ny+bYDd5CcB/h+ifAaBWQSTKj5jcDK/t3 5ZlRXmA/SThTFPfO44WVyvi183+IBgOH1xgeZQThcQ+3e172bml8bKOWpwzNOom7 d6EOB+FX3hftYFgl6sI9JKK3xbEteUuQQIxzN42q07v9ANmvl1Rs3WiDgf4U3VDF nvwCFiQggh12vlAWPrpUAJiTUL1n/7BNOLriuUQmUJkG/GP7yEba8JpFyG1XDHLY ljeB0THpZUn4sPRKcZ/Ag+gyjqRXWDA/QEEPQs1/K1dF9a0meSfRB+/oSYuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1658334870; x=1658421270; bh=gDzpof67n5ZWpwEVaS2H/TiO2r7O XcamOrQ2ZDna4v0=; b=cAEBei9KFMZl2TlfM3sgykYQHKJu/BMvCJDzPMWJNpJX WyDMH9lGHTHtA4OJlzKwnKCDbmXDapFfk6GDnk9KRv1ClUFj/k9YfplCP3WnhieT cypGLPnkVkIHoDq1KG0oTpO52UnRiWQ+O2OyStUcQmIPhHWtDBPMBf5Pqn6Z3tZC we/gZxFT+mj6dq6wEUAjOR4EtpdsDuoX5/pCExpuewKDzb9YPOtdr+mDUgL9JGQq DdX4s+/q4P4RGRYX33ycbxk1QY3fk29khMQW1cYGRJJufy8DK/kGnYOn9Ru8ik6m cpB7GSU+srShu62+X14eU5Y3NcC3RzALE3+4qMDrvg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudelvddguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 20 Jul 2022 12:34:29 -0400 (EDT) Date: Wed, 20 Jul 2022 09:34:24 -0700 From: Andres Freund To: Tom Lane Cc: Melanie Plageman , Greg Stark , Kyotaro Horiguchi , Justin Pryzby , Thomas Munro , "David G. Johnston" , PostgreSQL Hackers Subject: Re: shared-memory based stats collector - v70 Message-ID: <20220720163424.ag2cdhruhbwkneym@alap3.anarazel.de> References: <20220325.142256.1649716600998659084.horikyota.ntt@gmail.com> <20220325.172418.1055357550509939415.horikyota.ntt@gmail.com> <20220402082102.ojdd2e6cobsmljvh@alap3.anarazel.de> <20220404041516.cctrvpadhuriawlq@alap3.anarazel.de> <20220405030506.lfdhbu5zf4tzdpux@alap3.anarazel.de> <20220406030008.2qxipjxo776dwnqs@alap3.anarazel.de> <1736122.1658333315@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1736122.1658333315@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-07-20 12:08:35 -0400, Tom Lane wrote: > AFAIR, the previous stats collector implementation had no such provision > either: it'd just keep adding hashtable entries as it received info about > new objects. Yep. > The only thing that's changed is that now those entries are in shared > memory instead of process-local memory. We'd be well advised to be > sure that memory can be swapped out under pressure, but otherwise I'm > not seeing that things have gotten worse. FWIW, I ran a few memory usage benchmarks. Without stats accesses the memory usage with shared memory stats was sometimes below, sometimes above the "old" memory usage, depending on the number of objects. As soon as there's stats access, it's well below (that includes things like autovac workers). I think there's quite a bit of memory usage reduction potential around dsa.c - we occasionally end up with [nearly] unused dsm segments. Greetings, Andres Freund