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 1trsp6-00Aowu-SP for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Mar 2025 06:10:40 +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 1trsp4-008UoW-RB for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Mar 2025 06:10:38 +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 1trsp4-008UnO-Gr for pgsql-hackers@lists.postgresql.org; Tue, 11 Mar 2025 06:10:38 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1trsp0-002Axy-16 for pgsql-hackers@lists.postgresql.org; Tue, 11 Mar 2025 06:10:37 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-38a25d4b9d4so2694056f8f.0 for ; Mon, 10 Mar 2025 23:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741673434; x=1742278234; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rEPZpwcl7F+aZQushcAQ2nmlbJgzMj/4eh/n9zFbQmY=; b=BM7ogt2tS30tcwm+Srk50W2caeZSWzhXNOPWSjTjQOuTUko2VA6fljAQzSQ7+tV88H xrcUaY6RaUzEhuRLsuio1SF0sX17GmTAJ6/g14Ofivp2di07ddGx8gk1De+nsRxXe0Xq Y/0BjQ6gyXENAcIY0PrL+SldbujoBhsIP13sUd/Oh3D+hxbcWToCXDbL+cFtUdVxk74m +4zmLp4Gonjx1d/vgsXED86eSJat/OwvBt/szNsxvHSHEj2MboiyIkdB5MN7Y6PzD8Ux u2ikh8NCIT+0IDZW+hZoSgixWbm9UG83MEr+olEWx0tXMgQtzGrYP4SyCIW7gXkGDbnf CixQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741673434; x=1742278234; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rEPZpwcl7F+aZQushcAQ2nmlbJgzMj/4eh/n9zFbQmY=; b=k0qF9gVY18VXf8Ut7ErsIOGe60iKjrQ7m663kxB5wfyHTnf1rZkZRGKAaFQJD0RJAv hYFigZU1UGPMgutuAHXOecCpmcbWX/anc3X+RtbWB4h3y0UYV320Vs9t3qRj/pGs7UOd 2ibUviytOGW1sSIwkH0Aypl6qRz9/+2qtnY+PwtsZ0VYlAw8tjEGHvCc87Zx96r9L6hg hdXQCj5dTgZvaYD2B1oj+sCYYKeGPrRKoc0rgl+P26XJA9O9BsEFork0dEuuYNfgYFMy rVtnVYuI91Z2l7YZEY+BFPSmCVzcTJ+fOdpDkq6B0wemSc7J2vseM0xgtCKlDRNFcjna vscA== X-Gm-Message-State: AOJu0Yzymi/Y/zffNV/goIoKBIi1Ig84mBtgm6HWjIyWTgz9+aQjqPNg Ymubwjx9DHH1Jga8iabS572A6ROuTZcwTXUgbOR5s8klWFrcZ8Kp0JgihA== X-Gm-Gg: ASbGncuD4RyC0W8EA7FFPa8I9yXBfLP2cCSyua9Ju3Q/cFuJioQ7aiFISlwgeQQ5/XR 3UsYDbJF093LRfwpYU5A1WzRqTs3HuRyeQQqiVbX3sNCq5uoVBk4fwd2EIb/q6ft8iHGfbSLBj2 8A5y56ZoTwCSN4+SbVQjehf8geLJbDI034GdffcL2px+g2qW5a85Ba4PIL9iZuQE57yx6eRkHk3 j8CEtogVvkiqz9jDsGwJwlOy0mWiq88H3+3TEJ6y/T9XIn56OvjWLGCI1Uk/AbswMxa7J2ZH8GG TmE5QddKGDB9MFzH5SBtRNUSQgydNZUnuZFrKVmEbgX7tGypE/vjuyZQyRkfFm0Vb+VSE6aRNUJ MMCVmNsUtdeqooh3r0KYUTK9qDsNIiUD06rZKM2UlVYad6wa/xLJWmgdSP+7Rikj4LA92Pb3m0D 4m X-Google-Smtp-Source: AGHT+IHTNRB8GnYlN2UoS6YUJe1m7kkHWJc1H78uzxR91OmYetYxjQobi6ZXxCmjdyNu4bi3TFgLRQ== X-Received: by 2002:a5d:64a4:0:b0:391:a74:d7dc with SMTP id ffacd0b85a97d-39132db7543mr12014680f8f.50.1741673434087; Mon, 10 Mar 2025 23:10:34 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-181-182.eu-west-3.compute.amazonaws.com. [15.237.181.182]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3912bee262esm17023855f8f.0.2025.03.10.23.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 23:10:33 -0700 (PDT) Date: Tue, 11 Mar 2025 06:10:32 +0000 From: Bertrand Drouvot To: Michael Paquier 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: 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 Mon, Mar 10, 2025 at 02:52:42PM +0000, Bertrand Drouvot wrote: > Hi, > > On Mon, Mar 10, 2025 at 09:23:50AM +0900, Michael Paquier wrote: > > 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 attached. > > > > > > Also, while I did not measure any noticeable extra lag, given the fact that > > > 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, thoughts? > > > > - 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. > > Yeah, fully agree. Anyway, having so many frequent stats reports makes little sense. > > > Choice 3 i'm > > quoting above is tempting by design: not too much, still frequent > > enough to offer enough relevant information in the stats. > > Yeah, I also agree that we should reduce the number of "reports". I'll look > at the third option. WalSndWaitForWal() is being used only for logical walsender. So we'd need to find another location for the physical walsender case. One option is to keep the WalSndLoop() location and control the reports frequency. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com