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 1kZZDT-0000Yz-4e for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Nov 2020 12:45:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kZZDS-0008Jd-25 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Nov 2020 12:45:42 +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 1kZZDR-0008JW-Ns for pgsql-hackers@lists.postgresql.org; Mon, 02 Nov 2020 12:45:41 +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 1kZZDO-0002NM-2S for pgsql-hackers@postgresql.org; Mon, 02 Nov 2020 12:45:40 +0000 Received: from myt5-23f0be3aa648.qloud-c.yandex.net (myt5-23f0be3aa648.qloud-c.yandex.net [IPv6:2a02:6b8:c12:3e29:0:640:23f0:be3a]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 6FB062E1507; Mon, 2 Nov 2020 15:45:34 +0300 (MSK) Received: from myt5-70c90f7d6d7d.qloud-c.yandex.net (myt5-70c90f7d6d7d.qloud-c.yandex.net [2a02:6b8:c12:3e2c:0:640:70c9:f7d]) by myt5-23f0be3aa648.qloud-c.yandex.net (mxbackcorp/Yandex) with ESMTP id 2cp0AJhTw3-jX0K78qP; Mon, 02 Nov 2020 15:45:34 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1604321134; bh=T8PLXTjHrwxP0Kp1g6W+ePsQMfIiZ0dnKTqoyBfVA24=; h=To:Message-Id:References:Date:Subject:Cc:From:In-Reply-To; b=W8oxWcOFnZ2F7Isg42h+M3Pc12TyK83ccpS2stnZC288iUBnfB3p/LCq6OicrQadO YovFEui+f68891CoFqYx52xwr4KoSQ+OIu0FUkNpGtxFMmXXq7J7CiGXXA1/pbv7/G uPQ6tCyIuxwGYNhYNFChDPWEVN/70+1tf3c3LRPY= Authentication-Results: myt5-23f0be3aa648.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-ekb.dhcp.yndx.net (dynamic-ekb.dhcp.yndx.net [2a02:6b8:0:2807:2997:96ce:17d4:a30b]) by myt5-70c90f7d6d7d.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id AaM1AtGr7H-jXneteVM; Mon, 02 Nov 2020 15:45:33 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: MultiXact\SLRU buffers configuration From: Andrey Borodin In-Reply-To: <20201029134933.xd4mh2cofuf6tdfz@development> Date: Mon, 2 Nov 2020 17:45:33 +0500 Cc: Alexander Korotkov , Anastasia Lubennikova , Daniel Gustafsson , Kyotaro Horiguchi , pgsql-hackers Content-Transfer-Encoding: quoted-printable Message-Id: <65C1B4BA-D16F-4939-978B-AC8F370F5A5E@yandex-team.ru> References: <2087E87D-44CA-4443-8E6A-5087F07443F4@yandex-team.ru> <8A94938B-054C-4439-9866-2C220B4D0DD7@yandex-team.ru> <20201028013651.de5cj2xadgmba5nf@development> <13D8FD63-559A-4737-B7FD-05288D1CEF8B@yandex-team.ru> <20201028233243.ygm6yqlynkqpzekr@development> <43F3DE92-F236-4EA5-B4D6-39BEF6BD849D@yandex-team.ru> <20201029134933.xd4mh2cofuf6tdfz@development> To: Tomas Vondra X-Mailer: Apple Mail (2.3608.120.23.2.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > 29 =D0=BE=D0=BA=D1=82. 2020 =D0=B3., =D0=B2 18:49, Tomas Vondra = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(= =D0=B0): >=20 > On Thu, Oct 29, 2020 at 12:08:21PM +0500, Andrey Borodin wrote: >>=20 >>=20 >>> 29 =D0=BE=D0=BA=D1=82. 2020 =D0=B3., =D0=B2 04:32, Tomas Vondra = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(= =D0=B0): >>>=20 >>> It's not my intention to be mean or anything like that, but to me = this >>> means we don't really understand the problem we're trying to solve. = Had >>> we understood it, we should be able to construct a workload = reproducing >>> the issue ... >>>=20 >>> I understand what the individual patches are doing, and maybe those >>> changes are desirable in general. But without any benchmarks from a >>> plausible workload I find it hard to convince myself that: >>>=20 >>> (a) it actually will help with the issue you're observing on = production >>>=20 >>> and >>> (b) it's actually worth the extra complexity (e.g. the lwlock = changes) >>>=20 >>>=20 >>> I'm willing to invest some of my time into reviewing/testing this, = but I >>> think we badly need better insight into the issue, so that we can = build >>> a workload reproducing it. Perhaps collecting some perf profiles and = a >>> sample of the queries might help, but I assume you already tried = that. >>=20 >> Thanks, Tomas! This totally makes sense. >>=20 >> Indeed, collecting queries did not help yet. We have loadtest = environment equivalent to production (but with 10x less shards), copy of = production workload queries. But the problem does not manifest there. >> Why do I think the problem is in MultiXacts? >> Here is a chart with number of wait events on each host >>=20 >>=20 >> During the problem MultiXactOffsetControlLock and SLRURead dominate = all other lock types. After primary switchover to another node SLRURead = continued for a bit there, then disappeared. >=20 > OK, so most of this seems to be due to SLRURead and > MultiXactOffsetControlLock. Could it be that there were too many > multixact members, triggering autovacuum to prevent multixact > wraparound? That might generate a lot of IO on the SLRU. Are you > monitoring the size of the pg_multixact directory? Yes, we had some problems with 'multixact "members" limit exceeded' long = time ago. We tuned autovacuum_multixact_freeze_max_age =3D 200000000 and = vacuum_multixact_freeze_table_age =3D 75000000 (half of defaults) and = since then did not ever encounter this problem (~5 months). But the MultiXactOffsetControlLock problem persists. Partially the = problem was solved by adding more shards. But when one of shards = encounters a problem it's either MultiXacts or vacuum causing relation = truncation (unrelated to this thread). Thanks! Best regards, Andrey Borodin.=