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 1t7uX4-0011ud-DN for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2024 10:42:01 +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 1t7uW3-0008YF-OA for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2024 10:41:00 +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 1t7uVJ-0000a6-VZ for pgsql-hackers@lists.postgresql.org; Mon, 04 Nov 2024 10:40:14 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t7tuE-0006Yb-JP for pgsql-hackers@lists.postgresql.org; Mon, 04 Nov 2024 10:01:55 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-37d49a7207cso2479943f8f.0 for ; Mon, 04 Nov 2024 02:01:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730714512; x=1731319312; 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=UvPV6rCJJBRQaAjjk8mPI5TecveClvbvFYsxE4KWgGM=; b=nEkbBFUgczMbliVBl/Kcssaa+hIU03sApaboatSr/FJpFoN/KmydqSWlFBJuu5/g36 8KF4yHhB4s0xWVC87Dt30NP0Mh3S9zrewxi2Ou6FeA5kwiGkzx8F05XWGr6M6v4ujnW/ lqCtlQNmlHf8bRRH4pXsPHbkTM6lyLvRiBioRf0XSgDGTs4TqxLJLcIcR1dt1FezMr41 RkQQxocr8xGnmYPyvESDmf+tX+ZHNqMn6rJF/8DE5N7YkdsJGHBluFdeTwuBYMYuGJh4 heqrbXHD62UDFEdYAp7UPdU6K62dasfU2jhS7OD2UQuznYEB2gUgFPiGBm8hRlH5V2or HNAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730714512; x=1731319312; 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=UvPV6rCJJBRQaAjjk8mPI5TecveClvbvFYsxE4KWgGM=; b=H+E90GDufIY9GcOAw3+rMzna3i8qdHVsZ39ct7ieL9b8zLzkEHC1blH6q32KHHo+Eo oxeuw8RQgM6Mwcfot9B1Mf66tGQCLP9OjUZp8qC2Supoxf5ToA7Ke5ORQdW216oXPaoy xDTSFazI5UVloRX/EQ+hJjNAy84o+XtxgpdvAyoT9rC2FXpqoE0sWLHar8gBbEgsIWUz G3QNwzr2lPyHE3rakGdvJy8VQ2/wCXn0jh1OEqOZEpNAEEg1AStsSTYdpMqLszILm6qb NcKLjXOCPct+H2a5carJ2aPfjMxJMXq3ZrPc+t3oq7VEBu7tRMTsfX2991ubADtIBNOF sXVA== X-Forwarded-Encrypted: i=1; AJvYcCUMWo33d4P2agPn7sWnh6z4BJenmWT2H2K+YB9xKPfWV/ZsFLKf/447VCaZzGS+4yCHN4Wb4QzbU1a7sgC1@lists.postgresql.org X-Gm-Message-State: AOJu0YxovzgOWGxSzRc2NBU6XdPvuLLO2bPsXcpCaPKWZFw+NkIgwQ2G 7noppkmeNc7nDhSpuy95lEfWth4kEKjdKU7Bw3J5e+eEPgebcdFE X-Google-Smtp-Source: AGHT+IHpOGJVPPwwAJFE+rZdxEEmBzuMpPP1a87sNFl/3quEbTYTVcRePIRagvnaoC97ywC6wrYM9Q== X-Received: by 2002:a5d:64cc:0:b0:374:bd48:fae9 with SMTP id ffacd0b85a97d-381c7a4c99bmr8989483f8f.20.1730714511918; Mon, 04 Nov 2024 02:01:51 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10d437bsm12716181f8f.30.2024.11.04.02.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 02:01:51 -0800 (PST) Date: Mon, 4 Nov 2024 10:01:50 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Nazir Bilal Yavuz , Alvaro Herrera , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Subject: Re: per backend I/O statistics 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 Thu, Oct 31, 2024 at 05:09:56AM +0000, Bertrand Drouvot wrote: > === OPTIONS === > > So, based on this, I think that we could: > > Option 1: "move" the existing PGSTAT_KIND_IO to variable-numbered and let this > KIND take care of the aggregated view (pg_stat_io) and the per-backend stats. > > Option 2: let PGSTAT_KIND_IO as it is and introduce a new PGSTAT_KIND_BACKEND_IO > that would be variable-numbered. > > Option 3: Remove PGSTAT_KIND_IO, introduce a new PGSTAT_KIND_BACKEND_IO that > would be variable-numbered and store the "aggregated stats aka pg_stat_io" in > shared memory (not part of the variable-numbered hash). Per-backend stats > could be aggregated into "pg_stat_io" during the flush_pending_cb call for example. > > === BEST OPTION? === > > I would opt for Option 2 as: > > - The stats system is currently not designed for Option 1 and our goals (for > example the shared_data_len is used to serialize but also to fetch the entries, > see pgstat_fetch_entry()) so that would need some hack to serialize only a part > of them and still be able to fetch them all). > > - Mixing "fixed" and "variable" in the same KIND does not sound like a good idea > (though that might be possible with some hacks, I don't think that would be > easy to maintain). > > - Having the per-backend as "variable" in its dedicated kind looks more reasonable > and less error-prone. > > - I don't think there is a stats design similar to option 3 currently, so I'm > not sure there is a need to develop something new while Option 2 could be done. > > - Option 3 would need some hack for (at least) the "pg_stat_io" [de]serialization > part. > > - Option 2 seems to offer more flexibility (as compare to Option 1 and 3). > > Thoughts? And why not add more per-backend stats in the future? (once the I/O part is done). I think that's one more reason to go with option 2 (and implementing a brand new PGSTAT_KIND_BACKEND kind). Thoughts? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com