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 1gHsUL-0008JO-IW for pgsql-general@arkaria.postgresql.org; Wed, 31 Oct 2018 15:32:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHsUJ-0000Kr-Re for pgsql-general@arkaria.postgresql.org; Wed, 31 Oct 2018 15:32:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHsUJ-0000Kj-JP for pgsql-general@lists.postgresql.org; Wed, 31 Oct 2018 15:32:55 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHsUH-00040l-Lf for pgsql-general@postgresql.org; Wed, 31 Oct 2018 15:32:55 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 1667F5F79C; Wed, 31 Oct 2018 11:32:53 -0400 (EDT) Date: Wed, 31 Oct 2018 11:32:53 -0400 From: Stephen Frost To: Jeff Janes Cc: tfoertsch123@gmail.com, Postgres General Subject: Re: Is there a way to speed up WAL replay? Message-ID: <20181031153252.GY4184@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oDrsTh8Rnzt4ry+/" 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 --oDrsTh8Rnzt4ry+/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Jeff Janes (jeff.janes@gmail.com) wrote: > One way I found to speed up restore_command is to have another program run > a few WAL files ahead of it, copying the WAL from the real archive into a > scratch space which is on the same filesystem as pg_xlog/pg_wal. Then ha= ve > restore_command simply move (not copy) the requested files from the scrat= ch > space onto %p. The intra-filesystem move completes much faster than a co= py. Right, that can definitely be a big help and is more-or-less what pgbackrest does too. > If it spends time waiting for blocks that need to be recovered into to get > read from disk, and you have enough RAM, you could speed it up by > pre-warming the file system cache. Something like: >=20 > tar -cf - $PGDATA | wc -c Yeah, that's also a good idea. We've discussed having something in pgbackrest to basically go pre-load things off disk in advance of WAL replay, and I seem to recall someone had also written an external tool to do that. Thanks! Stephen --oDrsTh8Rnzt4ry+/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJb2cskAAoJEO1sijiDR2RVuCsP/3D8lTCc5a5qZbGZNm1tLj6K vk08aV+bHYuy3rntfj1BUgdKyKC93rEE/d0sTyuotBBj3Y91lhvO8zX+QGFIsWMl 5OaVCxqHYK6CbdMSqs5/phPiX9gTe47teMVUbzHBAbjXVnFv3Wd4UBb6PQSV7SGy xJsTo2y/4wdO9k3wXTbvxmPYwPHJL0SzXb1Xn4pII7Sm69d234PgA4L+7acqWcA5 cYxlm7mQlGRGxHIQ/Rvxh18ziby2M5MY5P364RLWQZfYY2rCx0W8BPO6NjEAZT/l fFHjfLcsu9HXLVYn0DCi3GJ9kUuTAlPXxXwtqkha6ESYcF+q/1H8uZCHeYaGakt0 vZiqOrkd3dU3x5m8nv7ZfWEzGPpCcrOqxgCjjkiiF3U5LDLMXDRHU1sJ8iX4Rg9h 2xe7DU2qIei/WhY1zC2yCz0n6HrN8K7cHmYFkGiWjKvPLlUFkVpDwrdPnAwAy3ba nKuxn3EwGnNaeKRtyNI1QC2IQXdyzuuFXzNL2AoeMUkjusfTBB1anzubFRwu6JiE xtLRZFJzvN15e7pa1BFbFkJG3txpCes332RYgFPRYQSs0kcoCtRjNxqM8DLx833G NqNFtPiOcwgEw239yhXuy3y7XSf2X63862aiYOq2ikQp4D1F9pnlu44uWRtaPk8e bPDxKDX0qRFJn3GUcxoL =Baco -----END PGP SIGNATURE----- --oDrsTh8Rnzt4ry+/--