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 1oLu75-0003UJ-1C for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Aug 2022 22:23:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oLu72-0007lX-UT for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Aug 2022 22:23:40 +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 1oLu71-0007im-6R for pgsql-hackers@lists.postgresql.org; Wed, 10 Aug 2022 22:23:40 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLu6v-0005pB-6H for pgsql-hackers@lists.postgresql.org; Wed, 10 Aug 2022 22:23:37 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 12EE33200065; Wed, 10 Aug 2022 18:23:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 10 Aug 2022 18:23: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=fm1; t=1660170209; x=1660256609; bh=RevspvtXBQ LBfMr8ZuYBz0zTXP1pvbLdtk0Iu2aqMDc=; b=R3RvFaMOgOTtZB/lkOfeAGDdUQ /subSWoDJLeGGwdhAI9TYq/DKfy5darIe/CwXCxLJFsoJX2ksgiK1+EcwHThC9sz e35Cgwd8l0ULyphownE9+c/Kase8Ao30SD+av8H/cPPS0fUqQoQ7PVeBvxKCqayM 7OsbOBI/0sGiiQ+reiUNG9319a6l96p1oeg6BSpk9st40dZNQbLOcEWo/gTDEdGD 1aTUO0A4+eAzQ4HTe3lHYzKqIJbUKk5442xfI1B/ZYlOtNPmnxtqpUNeNMTYKr3N z6SRRe+K3EDoaHCZfOuCBMBLrKPmtqr9UMSCAB/s41Oc+iVxvTq1fCB/NG4A== 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= fm1; t=1660170209; x=1660256609; bh=RevspvtXBQLBfMr8ZuYBz0zTXP1p vbLdtk0Iu2aqMDc=; b=05NqZUQGFDAogO+qR/1KlsCAlBcEWeB29M2WXl5cWTVW omCQ8WuFWsGEGQWRMfciodYznhkkt1Ppv3BKaK6g3SHr/1PzALSTLcdDeBiSV8Y5 d8HKX1o6qQEs7Muh7OajDHHL2fWal5aXnHfN8iUDN2kuGGGdxDNetSVuXznSmOYJ JD+8BZTrJaCzVoNFJgjrXhygFCAeOsa2xIIZDgIRSZblixLPI0Ame1J9QzoGQVcC 9guiDDSYAXW/PqT8QeCsN/IMSzHpzZUvOQZJe51ikDSDhPbzBN68id67lMIFDg97 hKq2aNwqyTGpis3Dgux2Fa2uSd+wLUVmj71hmNJybA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdegfedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Aug 2022 18:23:28 -0400 (EDT) Date: Wed, 10 Aug 2022 15:23:27 -0700 From: Andres Freund To: Greg Stark Cc: "Drouvot, Bertrand" , Tom Lane , Melanie Plageman , Kyotaro Horiguchi , Justin Pryzby , Thomas Munro , "David G. Johnston" , PostgreSQL Hackers Subject: Re: shared-memory based stats collector - v70 Message-ID: <20220810222327.5tjgq7hmiipeeuo2@awork3.anarazel.de> References: <1736122.1658333315@sss.pgh.pa.us> <83D73EC0-E3ED-4C98-A528-5E122278D553@anarazel.de> <20220809164748.6omys6j64yf2a2lr@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 2022-08-10 14:18:25 -0400, Greg Stark wrote: > > I don't think that's a large enough issue to worry about unless you're > > polling at a very high rate, which'd be a bad idea in itself. If a backend > > can't get the lock for some stats change it'll defer flushing the stats a bit, > > so it'll not cause a lot of other problems. > > Hm. I wonder if we're on the same page about what constitutes a "high rate". > > I've seen people try push prometheus or other similar systems to 5s > poll intervals. That would be challenging for Postgres due to the > volume of statistics. The default is 30s and people often struggle to > even have that function for large fleets. But if you had a small > fleet, perhaps an iot style system with a "one large table" type of > schema you might well want stats every 5s or even every 1s. That's probably fine. Although I think you might run into trouble not from the stats subystem side, but from the "amount of data" side. On a system with a lot of objects that can be a fair amount. If you really want to do very low latency stats reporting, I suspect you'd have to build an incremental system. > > I'm *dead* set against including catalog names in shared memory stats. That'll > > add a good amount of memory usage and complexity, without any sort of > > comensurate gain. > > Well it's pushing the complexity there from elsewhere. If the labels > aren't in the stats structures then the exporter needs to connect to > each database, gather all the names into some local cache and then it > needs to worry about keeping it up to date. And if there are any > database problems such as disk errors or catalog objects being locked > then your monitoring breaks though perhaps it can be limited to just > missing some object names or having out of date names. Shrug. If the stats system state desynchronizes from an alter table rename you'll also have a problem in monitoring. And even if you can benefit from having all that information, it'd still be an overhead born by everybody for a very small share of users. > > > I also think it would be nice to have a change counter for every stat > > > object, or perhaps a change time. Prometheus wouldn't be able to make > > > use of it but other monitoring software might be able to receive only > > > metrics that have changed since the last update which would really > > > help on databases with large numbers of mostly static objects. > > > > I think you're proposing adding overhead that doesn't even have a real user. > > I guess I'm just brainstorming here. I don't need to currently no. It > doesn't seem like significant overhead though compared to the locking > and copying though? Yes, timestamps aren't cheap to determine (nor free too store, but that's a lesser issue). Greetings, Andres Freund