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 1oOWJc-0000pB-So for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2022 03:35:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oOWJb-0006FB-Le for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2022 03:35:27 +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 1oOWJb-0006F1-7Q for pgsql-hackers@lists.postgresql.org; Thu, 18 Aug 2022 03:35:27 +0000 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOWJW-0003pu-Mv for pgsql-hackers@postgresql.org; Thu, 18 Aug 2022 03:35:26 +0000 Received: from sas1-c73b4b4f4b95.qloud-c.yandex.net (sas1-c73b4b4f4b95.qloud-c.yandex.net [IPv6:2a02:6b8:c08:12a9:0:640:c73b:4b4f]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 47E952E0977; Thu, 18 Aug 2022 06:35:18 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6b8:b081:8113::1:17]) by sas1-c73b4b4f4b95.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id YfvT0rtIIF-ZGOa7qTw; Thu, 18 Aug 2022 06:35:17 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1660793717; bh=yltGuvfP0nsOdcUi+q8reEPEUsMxEchdZIeRoFDBezw=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=tXM5BI7CBjwZWMKVrWNCt3Elv/jxAFfeQYGBBqDQPcYkSjLwi6ssOswROKAPIjP6v 07aVpg3WHQLKCeZZdAGbBtJxY5f68NXGp4T8hqcda0AeoEIS1JVl3YfIRiZvUpDgnI qYSOGft7ti8FLkQdQXzVD2KNucLp42nkjoVuih7s= Authentication-Results: sas1-c73b4b4f4b95.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Re: MultiXact\SLRU buffers configuration From: Andrey Borodin In-Reply-To: <452d01f7e331458f56ad79bef537c31b@postgrespro.ru> Date: Thu, 18 Aug 2022 08:35:15 +0500 Cc: Yura Sokolov , Andres Freund , Thomas Munro , Gilles Darold , Tomas Vondra , Tomas Vondra , Alexander Korotkov , Anastasia Lubennikova , Daniel Gustafsson , Kyotaro Horiguchi , pgsql-hackers Content-Transfer-Encoding: quoted-printable Message-Id: <6BABE00C-64BD-4F5D-A071-32B42FAAEB76@yandex-team.ru> References: <27D90FFC-B897-4BC5-B4F5-9047B9886AA3@yandex-team.ru> <15CA416B-3446-462D-902B-4883DD3ADEE6@yandex-team.ru> <3130B767-FEB7-4F18-AE90-DD95B4367316@yandex-team.ru> <20220219214223.w4bmhiozeimcqhzb@alap3.anarazel.de> <01FF6FFC-7379-43EA-B04A-673C98ABFAAF@yandex-team.ru> <452d01f7e331458f56ad79bef537c31b@postgrespro.ru> To: i.lazarev@postgrespro.ru X-Mailer: Apple Mail (2.3693.60.0.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 17 Aug 2022, at 00:36, i.lazarev@postgrespro.ru wrote: >=20 >> Andrey Borodin wrote 2022-07-23 11:39: >> Yura, thank you for your benchmarks! >> We already knew that patch can save the day on pathological = workloads, >> now we have a proof of this. >> Also there's the evidence that user can blindly increase size of SLRU >> if they want (with the second patch). So there's no need for hard >> explanations on how to tune the buffers size. >=20 > Hi @Andrey.Borodin, With some considerations and performance checks = from @Yura.Sokolov we simplified your approach by the following: >=20 > 1. Preamble. We feel free to increase any SLRU's, since there's no = performance degradation on large Buffers count using your SLRU buckets = solution. > 2. `slru_buffers_size_scale` is only one config param introduced for = all SLRUs. It scales SLRUs upper cap by power 2. > 3. All SLRU buffers count are capped by both `MBuffers = (shared_buffers)` and `slru_buffers_size_scale`. see > 4. Magic initial constants `NUM_*_BUFFERS << slru_buffers_size_scale` = are applied for every SLRU. > 5. All SLRU buffers are always sized as power of 2, their hash bucket = size is always 8. >=20 > There's attached patch for your consideration. It does gather and = simplify both `v21-0001-Make-all-SLRU-buffer-sizes-configurable.patch` = and `v21-0002-Divide-SLRU-buffers-into-8-associative-banks.patch` to = much simpler approach. I like the idea of one knob instead of one per each SLRU. Maybe we even = could deduce sane value from NBuffers? That would effectively lead to 0 = knobs :) Your patch have a prefix "v22-0006", does it mean there are 5 previous = steps of the patchset? Thank you! Best regards, Andrey Borodin.=