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 1kY8JF-0005eF-Ib for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Oct 2020 13:49:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kY8JD-00049G-5t for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Oct 2020 13:49:43 +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 1kY8JC-000499-Qg for pgsql-hackers@lists.postgresql.org; Thu, 29 Oct 2020 13:49:42 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kY8JA-0007MY-7j for pgsql-hackers@postgresql.org; Thu, 29 Oct 2020 13:49:41 +0000 Received: by mail-ed1-x532.google.com with SMTP id o18so3119852edq.4 for ; Thu, 29 Oct 2020 06:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=MlsoVWqMM3QsceRQyvaM3IUVeXEMPJRuWYg96a/pX8c=; b=aAQRzp7MIkNn5fV400ke447KPHmLr+qovK+l3sjWI45ajv9VUM0CtBb7+0zazy/Rpn LyoE/4L+rOB9Imz29r/BXfLK1f6Z/m3OwYq+9aXhJbGIXeTyPmRsyuZs4ivwE4MQkAfL OejsWvSsopO5livg8T04XqKxG5RYvA0EhtYOeqqYpsOEYBZpZeCmhUNDsFFRJzLYOQTe Feifm1lOzPezJASMSDaMtnFU6bKqB4dkM/EzMvIFdCOwlHLhVkblDuwmDurS2sSmTef/ 4hNr+fYVR4uFB5ySMPl+kVEEGLPXwVzagbpvOGA4QJVbcCnJcQDUZzlWquI8ydNnkd34 VLfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=MlsoVWqMM3QsceRQyvaM3IUVeXEMPJRuWYg96a/pX8c=; b=A85tTrH+nw8x71Pw/SJLDCpGy84IoEEG40Rr6Z2hz2mmDHultAj7yX552nQn1BKE5R IMorP1li8OEwhc+fd5BIJPAsvTgb8zqHj2UohkFv39etQQWoccjVxoVCgVBYfHecb+2/ aYIM5speCxpk1+olGPMKzEkmsIvqjoo0SKjiHl3kcWmWIRZttrJELMWi9LFPRnMgvbJi 18DwDqZUAPJ0zrno95IW4DZQDfkSZosSRElqwKK/K8Ibe20yaH02gdgTR+hgOfVd1/NE V3vz29l0aQqybiciB9xYgnNb4EEt7u+I1qjKzq+Cr50ke0TF5DU2vtD6rRmDa0jkLjdJ Bw9Q== X-Gm-Message-State: AOAM533HmvYc0RaSEEBBmDBgBhFfFliWeqmKnkTzezB9pY4ATkfjA1zE 15fxCPd0l9eSAHQqFyy2kIhw0g== X-Google-Smtp-Source: ABdhPJy9SvMMDE7eDNlAO8itZr3D+PiGtGKNtBYTlNsbA3YKJ+H3gyGk6a60TbMY2SF/Fq9VQ2ffYA== X-Received: by 2002:a05:6402:744:: with SMTP id p4mr4000368edy.190.1603979376968; Thu, 29 Oct 2020 06:49:36 -0700 (PDT) Received: from localhost (ip-86-49-245-76.net.upcbroadband.cz. [86.49.245.76]) by smtp.gmail.com with ESMTPSA id v12sm1552478ejg.11.2020.10.29.06.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 06:49:36 -0700 (PDT) Date: Thu, 29 Oct 2020 14:49:33 +0100 From: Tomas Vondra To: Andrey Borodin Cc: Alexander Korotkov , Anastasia Lubennikova , Daniel Gustafsson , Kyotaro Horiguchi , pgsql-hackers Subject: Re: MultiXact\SLRU buffers configuration Message-ID: <20201029134933.xd4mh2cofuf6tdfz@development> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <43F3DE92-F236-4EA5-B4D6-39BEF6BD849D@yandex-team.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Oct 29, 2020 at 12:08:21PM +0500, Andrey Borodin wrote: > > >> 29 окт. 2020 г., в 04:32, Tomas Vondra написал(а): >> >> 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 ... >> >> 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: >> >> (a) it actually will help with the issue you're observing on production >> >> and >> (b) it's actually worth the extra complexity (e.g. the lwlock changes) >> >> >> 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. > >Thanks, Tomas! This totally makes sense. > >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 > > >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. 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? >Backtraces on standbys during the problem show that most of backends are sleeping in pg_sleep(1000L) and are not included into wait stats on these charts. > >Currently I'm considering writing test that directly calls MultiXactIdExpand(), MultiXactIdCreate(), and GetMultiXactIdMembers() from an extension. How do you think, would benchmarks in such tests be meaningful? > I don't know. I'd much rather have a SQL-level benchmark than an extension doing this kind of stuff. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services