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 1trQwC-003mAD-AC for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Mar 2025 00:24:08 +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 1trQwA-00GmaA-U8 for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Mar 2025 00:24:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1trQwA-00Gma0-2Q for pgsql-hackers@lists.postgresql.org; Mon, 10 Mar 2025 00:24:06 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1trQw7-001vqf-2i for pgsql-hackers@lists.postgresql.org; Mon, 10 Mar 2025 00:24:05 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id B9F6E1382D1D; Sun, 9 Mar 2025 20:24:02 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Sun, 09 Mar 2025 20:24:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1741566242; x=1741652642; bh=cpIwEtmE8v MLVgbmAVQfdzuq+9zvzY2SsC1FvtRAo5s=; b=6K5ofaKqtr37pEQverdcI2G0yT Arf6O031eI+gNzTFJcpWkig+rqHDlhM1smcRzLUyubsWwDIFbx9Lo9v81XW0jWLB fka/jV8/eg+eoWye5u4nHIZLfcxGDHSluW+ZrrKi1PPhFa2cgCGz3KCm3Q1r2C93 sGDDAMWZedVl5FWKL3luPpgNRDVCZxWG2kknMGY4MqlVUVszQmtj/m3Uq51RZZSS p4dLUPJWiF6ULN3mGyWmfQq5lj+maVYee+Pzw2fuJGHvJnIj2Xmy1B3VcxAl33iH bpd6A1UNjeijPFIhD8E4GtcGmyC8FBWaCgfQ918blvWJviPTO5R8LxnVGg8A== 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:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1741566242; x=1741652642; bh=cpIwEtmE8vMLVgbmAVQfdzuq+9zvzY2SsC1 FvtRAo5s=; b=V5Bpy6coIIxMGZsWdZERjPzkSz52P5LaPwMlpe/o+kmwY5zR0Ny PqOITFZszX35IM6G1CPNNbb4RWc+1s6r0M6cmCOfczqYZDC+Erh9dRWh518v1Kmc cELAAhHA97oZFh3PR7vtdyL0SnxTijLeJs9LBCP6tOoi41jkkKyj7uqbMEm5X/lx m/53SbVuyJ9dixPmXW4olJnh5eq4/N9QgRroBEpW3racOH0yrOeZTvlxVeh0izto kt7KaUZCcrtPFKHbZk71B7BMq2mmhC+AvYF1I1oUdhuNY5TQ6OVtMLmIsssnmh0y XIo1l9FcsVQtMAdi4oTKS+hw4eO7tlGGAMQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduudejkeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffuc dljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhm pefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgi ihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeegfffhkeeuveet iefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidpnhgspghrtghp thhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsggvrhhtrhgrnhguug hrohhuvhhothdrphhgsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgr tghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Mar 2025 20:24:01 -0400 (EDT) Date: Mon, 10 Mar 2025 09:23:50 +0900 From: Michael Paquier To: Bertrand Drouvot Cc: pgsql-hackers@lists.postgresql.org Subject: Re: [BUG]: the walsender does not update its IO statistics until it exits Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TaFAQgBvCPQv0CQe" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --TaFAQgBvCPQv0CQe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 03, 2025 at 11:54:39AM +0000, Bertrand Drouvot wrote: > So it does not look like what we're adding here can be seen as a primary = bottleneck > but that is probably worth implementing the "have_iostats" optimization a= ttached. >=20 > Also, while I did not measure any noticeable extra lag, given the fact th= at=20 > pgstat_flush_io() shows at about 5.5% and pgstat_flush_backend() at about= 2.5%, > that could still make sense to reduce the frequency of the flush calls, t= houghts? Okay. The number of reports really worry me anyway as proposed in the patch. It's not really complicated to see dozens of pgstats calls in a single millisecond in the WAL sender, even with some of the regression tests. That's more present in the logirep scenarios, it seems.. For example, here are some numbers based on some elog() calls planted in walreceiver.c, looking at the logs of the TAP tests. Through a single check-world, I am able to gather the following information: - The location proposed by the patch leads to 680k stats reports, in WalSndLoop() because the "Block if we have unsent data". Some tests show quite some contention. - A different location, in WalSndLoop() just before WalSndWait() leads to 59k calls. And there's some contention in the logirep tests.. - I've spotted a third candidate which looks pretty solid, actually: WalSndWaitForWal() before WalSndWait(). This leads to 2.9k reports in the whole test suite, with much less contention in the reports. These can still be rather frequent, up to ~50 calls per seconds, but that's really less than the two others. Stats data is useful as long as it is possible to get an idea of how the system behaves, particularly with a steady workload. More frequent reports are useful for spikey data detection, showing more noise. Still, too many reports may cause the part gathering the reports to become a bottleneck, while we want it to offer hints about bottlenecks. So I would argue in favor of a more conservative choice in the back branches than what the patch is proposing. Choice 3 i'm quoting above is tempting by design: not too much, still frequent enough to offer enough relevant information in the stats. -- Michael --TaFAQgBvCPQv0CQe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmfOMRYACgkQnvQgOdby QH1U8xAAmi+8sU+0lZyCbi8OX/iAYMZDeG2MM2ID1Jjd1ZcboLCU7lYcO1SAeZ+j qTi7vMB0+CL6m0lQ703m50wF7yLWOk94UNHZ+wYmvLrSKSqiw8acbvdAQ2DXkEbR 0SAdmF1y/xlZTj9br/C2EjxyMelwXmm08k5P9VXiseU+z+RPCGuHZfAhyRx52Lz7 aCvujKLiRuwCTHveP3wR4PrWQq93Er8Ns4V57Vw5wX367jr7twgetF0mHejzULGu ADIVAlRYiJU+CvivluBvcxqKa7HCnHHISgsXCqvIK/Cb+jpWuLLoGMmB7cRIp6RM gws3NVRL2wGp0/GgSKu1VGlJU/OOFtm1TD5hTOts7r2VmdYM1astMxZLTbx4Ijse dmSmlq5IYX+aJLd6SKhe50At8cAXuywLep3aXyhOeDmyinse3PKU2csMH+KJ0Ube PgEtdXdif3jAGmpkhIIziTzUF1w16xOpP3Jrbz+UZg0CeNFlmZ5WF8CYQYqhcr+j PsLHEAAsFZnnzaRpPU/AP2ZXMktS2rG+ZGyM/rQA3JahaukRKvpTRvX3E7YkZEqD a2X8HKM7yEUp464OkCLS76CMhyrzrLkLq2qHR6wwszmBgSIjB8sTbx2F3222QBx0 gv2G4eRLw7AzEsq5zv7GpOnER4o8TjhqLCMDdcqBcFTnJcU4AJg= =MCO5 -----END PGP SIGNATURE----- --TaFAQgBvCPQv0CQe--