Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcYzG-0007AA-2R for pgsql-general@arkaria.postgresql.org; Sun, 16 Jun 2019 17:30:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hcYzE-0003mp-5Z for pgsql-general@arkaria.postgresql.org; Sun, 16 Jun 2019 17:30:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcYzD-0003mi-Oo for pgsql-general@lists.postgresql.org; Sun, 16 Jun 2019 17:30:35 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hcYz7-00087t-4S for pgsql-general@postgresql.org; Sun, 16 Jun 2019 17:30:34 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 44B9D5F7AD; Sun, 16 Jun 2019 13:30:28 -0400 (EDT) Date: Sun, 16 Jun 2019 13:30:28 -0400 From: Stephen Frost To: Tiemen Ruiten Cc: pgsql-general@postgresql.org Subject: Re: checkpoints taking much longer than expected Message-ID: <20190616173028.GP2480@tamriel.snowman.net> References: <20190614154350.GE2480@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LvG3mvTpA2cBjRlj" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --LvG3mvTpA2cBjRlj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Tiemen Ruiten (t.ruiten@tech-lab.io) wrote: > On Fri, Jun 14, 2019 at 5:43 PM Stephen Frost wrote: > > * Tiemen Ruiten (t.ruiten@tech-lab.io) wrote: > > > checkpoint_timeout =3D 60min > > > > That seems like a pretty long timeout. >=20 > My reasoning was that a longer recovery time to avoid writes would be > acceptable because there are two more nodes in the cluster to fall back on > in case of emergency. Ok, so you want fewer checkpoints because you expect to failover to a replica rather than recover the primary on a failure. If you're doing synchronous replication, then that certainly makes sense. If you aren't, then you're deciding that you're alright with losing some number of writes by failing over rather than recovering the primary, which can also be acceptable but it's certainly much more questionable. > > > My problem is that checkpoints are taking a long time. Even when I ru= n a > > > few manual checkpoints one after the other, they keep taking very lon= g, > > up > > > to 10 minutes: > > > > You haven't said *why* this is an issue... Why are you concerned with > > how long it takes to do a checkpoint? >=20 > During normal operation I don't mind that it takes a long time, but when > performing maintenance I want to be able to gracefully bring down the > master without long delays to promote one of the standby's. I'm getting the feeling that your replicas are async, but it sounds like you'd be better off with having at least one sync replica, so that you can flip to it quickly. Alternatively, having a way to more easily make the primary to accepting new writes, flush everything to the replicas, report that it's completed doing so, to allow you to promote a replica without losing anything, and *then* go through the process on the primary of doing a checkpoint, would be kind of nice. Then again, you run into the issue that if your async replicas are very far behind then you're still going to have a long period of time between the "stop accepting new writes" and "finished flushing everything to the replicas". > > The time information is all there and it tells you what it's doing and > > how much had to be done... If you're unhappy with how long it takes to > > write out gigabytes of data and fsync hundreds of files, talk to your > > storage people... >=20 > I am the storage people too :) Great! Make it go faster. :) Thanks, Stephen --LvG3mvTpA2cBjRlj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJdBnyzAAoJEO1sijiDR2RVswkP/RKSU1P+QArWLFd72YfIBEx8 d102WZ3C2tGMX9S0xH1ZCXev1bEH8N2aKg1fe5HLs67bHOIi2CeaZUaHoqkWMiZw qoYQU6E3XH2RPS0YY+EOkwHlLmRSEDxHQNRwWbwwvb5tLLwcXaYHO/oBdCJ4x8nZ gYsJHcUbLRO5uEhbDKR7BaVBKjjbd0k/toA90uxYbok6zKqkRTBvqh4uriEMk4yh T8bFz64ZGgF9utKrCA5HQ/zLEEBEggX4ZnGXi2TSbovN09614+zfwwVk8uLA+NrG xuKA9T0AhXJfFaBSoD7tjEApjx4WlLT2SeO4tjUHWTRGpZ2GWsV5kKNS737bUwZN ZMhyX+1dascE+RdwprCJTBl7h8AybhuOJMQTyJf1vB4ocTEjBMvoyhPtyDB25xHd EcSpMlnrrmq7Ig5hdjR9Pgnd9LcfsqA7IpHJcdp9Q1857hRsQWgGLbbvGkbq5//S AsXJu5PX8BvW9F6JsM55mdMfGCet59ao+BiwAYcbq9AmP550lCfssdwh+O6+EeGd SszmXV3W9iVEeYqFWfO2mGTGxkVYT/aCDXkhT7syNEfow1xEXvQgvXaqIsptt88R vXL1oWTPeQPjM4H6OnPjGM0CJyzK/bingBqrAC9sHF8hbseyAtHwldShauJ7/Jhv Pj82/gG03ZnzyhjgsQHe =qpR0 -----END PGP SIGNATURE----- --LvG3mvTpA2cBjRlj--