Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHsSN-0008H9-PH for pgsql-general@arkaria.postgresql.org; Wed, 31 Oct 2018 15:30:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHsSL-0005s2-C3 for pgsql-general@arkaria.postgresql.org; Wed, 31 Oct 2018 15:30:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHsSL-0005rG-07 for pgsql-general@lists.postgresql.org; Wed, 31 Oct 2018 15:30:53 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHsSI-00028S-3Z for pgsql-general@postgresql.org; Wed, 31 Oct 2018 15:30:51 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 568855F79C; Wed, 31 Oct 2018 11:30:49 -0400 (EDT) Date: Wed, 31 Oct 2018 11:30:49 -0400 From: Stephen Frost To: Torsten =?iso-8859-1?Q?F=F6rtsch?= Cc: PostgreSQL mailing lists Subject: Re: Is there a way to speed up WAL replay? Message-ID: <20181031153049.GX4184@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JsD+VvMqYhWk1ZVS" 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 --JsD+VvMqYhWk1ZVS Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Torsten F=F6rtsch (tfoertsch123@gmail.com) wrote: > I am working on restoring a database from a base backup + WAL. With the > default settings the database replays about 3-4 WAL files per second. The > startup process takes about 65% of a CPU and writes data with something > between 50 and 100 MB/sec. What are you using for a restore_command..? You can typically get some improvement by using a restore_command that's faster or pre-stages files locally to minimize the time required to run, or dumping all the WAL into the xlog, but that's not something I typically recommend. > Is there a way to speed that up? The disk can easily sustain 400-500 MB/s= ec. Kind of depends what you're ultimately going for.. If you've made everything else faster and you're still only seeing 65% CPU utilization on the one CPU, then maybe there's just enough latency to the disks to be an issue, in which case you could possibly restore on to a ramdisk if you've got enough memory/space and don't mind that. There's other things that can be done too, like adjusting the amount of shared buffers; depending on what you're doing that can also make a difference in replay speed (we've been working to improve that though). I tend to find that it's better to just reduce the amount of WAL that needs to be replayed by taking incremental backups more frequently and using things like pgbackrest's delta restore ability for doing repeated restores to the same location. Of course, that's not likely to help you out much here. Thanks! Stephen --JsD+VvMqYhWk1ZVS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJb2cqoAAoJEO1sijiDR2RVPDAQAMW9Dc8dz4wDiN4sDi3vTV+Y 5iexehVayXvtcxMNI2rGeCoAcyWlVhwqHSm1ztZffoPNz00Scf+CsiOBvXP0bZU0 J+kjb6A5aWQ/JYa5ento3zAwBb9ShRnP8rNWtoTw/ny3bEvgfklO4VmIoKCoYMP1 xBQs1jn3t6Cfis6+H7hlp3UXjJ7bFmWxytPa2sRJVczrR5hSOHmv74zbuPvFQ5QH uhSOHsoXQ58LUqUDiQlir84k4g4IUdpVu6ethegiZbT7i2aX1J40LUJmdiBP46yg Hd8yuwBFRco2oOmwaPHBtZl39wsWy5aajyDylPTvxEYI7s4xe4d8IkKHMx37oHbm Vmte5vwDq2VVHp24kdBpkhLIgt2oAbKyrFw/5RsEOEN34ffd0fkYiTMW7nUJ2pGZ ygBaeJl9pTCAMq8MJUtlRU8BF6dgeOc5zC5Gem2Sk4k/klog6oGMXQHc5Kl0jNsC JRoXfBjGtDYhzE/D5z1mnvbUS8Og6E+Dw6Lxzmzh1nfZOblJByF9vo4n5TeH9EZc H9QgRVjjS4AkA7OF0+soMhulipGRgcQXZsN6fSxjATQhDMs8DEK+hV2eWAcgtoDD j43CEPGU8qdAcO9b3XQ6H8xJygAEyc9A9MMxFR6sppACBgyYPvMEgxlYcWidnAqK 4H2oxqbe5FtNc9jMfWqP =dvvS -----END PGP SIGNATURE----- --JsD+VvMqYhWk1ZVS--