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 1kC97h-0006w5-TT for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Aug 2020 22:14:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kC97g-0000DO-Qn for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Aug 2020 22:14:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kC97g-0000D8-JQ for pgsql-hackers@lists.postgresql.org; Sat, 29 Aug 2020 22:14:56 +0000 Received: from mail-ej1-x644.google.com ([2a00:1450:4864:20::644]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kC97d-0004Ms-Fv for pgsql-hackers@postgresql.org; Sat, 29 Aug 2020 22:14:55 +0000 Received: by mail-ej1-x644.google.com with SMTP id q13so241532ejo.9 for ; Sat, 29 Aug 2020 15:14:53 -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:in-reply-to; bh=h4yMbS8qb0kA9HdTxVLhUdpglyzA/n1tM/gqvT8QPyU=; b=ZnTTN/85BHoH7l2v2nZTqeoCszz+S0rno0KTwQPwtpOC/8XX3SQUM0Z5Y88FasR6Lu /ox3LG7eV9xVyGTMsEIgW4LGy/rwqp0ttQRrbJ/ezTxXhrL14n7rXHuOFp9/626vbN0o nAHitXZCB3gq/rnCeIYDaYCYDxi1jEtB0lYQL0aKBTNg4ek82ptBsOofHXYnt5AQbC0I vJvxh5HPI21m37rVAUvD9D75LT43g/W4QP0PrAZOZuTkmZ9MoVQPNQ084wE9aeWm4+eJ q76t8ke2yJYaJWNJoZRbrC/oZKBIxvPcPO8m/pj+T/hqunvHSgrFKQRt/vY+LHcNTYny f1Og== 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:in-reply-to; bh=h4yMbS8qb0kA9HdTxVLhUdpglyzA/n1tM/gqvT8QPyU=; b=jl94vr20kpUjR47xeW/z3NYs4DqdrgfGiqvCBdHD3tuDUyrmdCIuHb3sBihJ0TSG97 8o+HGN2AEbIk/WQ6/Q8Dwf5amqyFQwm9n7JfMjTyW9YdsWMnkHQUE3DhI28aKOq7hRzD +c8lqM28/lUqp9pBbW/m7IYymNdMdr8e/bUfg8S5UQXcuGsBJ+4sCUJrKn1yA7X7ZDrK pFxErNeXRWqPup/tRi4iUgFerNlZ3jNZOxv1wOm2R/LKa329pjnu5eHdJ6K/g2Erig7b EsHkqEqr4/aDWDOeNkryGcgvysTdgdCp+Fx98qEmW9g0kMyerhXYjeWNDn1oxOVJKqNP IZfA== X-Gm-Message-State: AOAM533ITxypmwo6u/KMXD+kJ/2REqUfB+EBoY5DYlRjOeSNiGX2zreB jzNBh4O0z9ERh1LIOrCTWzZX2Q== X-Google-Smtp-Source: ABdhPJzR802uyDmZc7Psrt++8Cf7ravgTI1SPK2Qezv8GvbOI1Xwy0B8kJe6/G1nHAzJIILXJR7HBw== X-Received: by 2002:a17:906:c7cd:: with SMTP id dc13mr5148243ejb.446.1598739292511; Sat, 29 Aug 2020 15:14:52 -0700 (PDT) Received: from localhost (ip-86-49-253-216.net.upcbroadband.cz. [86.49.253.216]) by smtp.gmail.com with ESMTPSA id u4sm3191806edt.11.2020.08.29.15.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Aug 2020 15:14:51 -0700 (PDT) Date: Sun, 30 Aug 2020 00:14:50 +0200 From: Tomas Vondra To: Stephen Frost Cc: Robert Haas , Andres Freund , Sait Talha Nisanci , Thomas Munro , Dmitry Dolgov <9erthalion6@gmail.com>, David Steele , Alvaro Herrera , pgsql-hackers Subject: Re: [EXTERNAL] Re: WIP: WAL prefetch (another approach) Message-ID: <20200829221450.t7omssadp2i6bbcx@development> References: <20200827182642.GO29590@tamriel.snowman.net> <6B918AFB-88D6-4687-8B4A-34C472E48BF4@anarazel.de> <20200827185116.GQ29590@tamriel.snowman.net> <20200827202853.GT29590@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200827202853.GT29590@tamriel.snowman.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Aug 27, 2020 at 04:28:54PM -0400, Stephen Frost wrote: >Greetings, > >* Robert Haas (robertmhaas@gmail.com) wrote: >> On Thu, Aug 27, 2020 at 2:51 PM Stephen Frost wrote: >> > > Hm? At least earlier versions didn't do prefetching for records with an fpw, and only for subsequent records affecting the same or if not in s_b anymore. >> > >> > We don't actually read the page when we're replaying an FPW though..? >> > If we don't read it, and we entirely write the page from the FPW, how is >> > pre-fetching helping..? >> >> Suppose there is a checkpoint. Then we replay a record with an FPW, >> pre-fetching nothing. Then the buffer gets evicted from >> shared_buffers, and maybe the OS cache too. Then, before the next >> checkpoint, we again replay a record for the same page. At this point, >> pre-fetching should be helpful. > >Sure- but if we're talking about 25GB of WAL, on a server that's got >32GB, then why would those pages end up getting evicted from memory >entirely? Particularly, enough of them to end up with such a huge >difference in replay time.. > >I do agree that if we've got more outstanding WAL between checkpoints >than the system's got memory then that certainly changes things, but >that wasn't what I understood the case to be here. > I don't think it's very clear how much WAL there actually was in each case - the message only said there was more than 25GB, but who knows how many checkpoints that covers? In the cases with FPW=on this may easily be much less than one checkpoint (because with scale 45GB an update to every page will log 45GB of full-page images). It'd be interesting to see some stats from pg_waldump etc. >> Admittedly, I don't quite understand whether that is what is happening >> in this test case, or why SDD vs. HDD should make any difference. But >> there doesn't seem to be any reason why it doesn't make sense in >> theory. > >I agree that this could be a reason, but it doesn't seem to quite fit in >this particular case given the amount of memory and WAL. I'm suspecting >that it's something else and I'd very much like to know if it's a >general "this applies to all (most? a lot of?) SSDs because the >hardware has a larger than 8KB page size and therefore the kernel has to >read it", or if it's something odd about this particular system and >doesn't apply generally. > Not sure. I doubt it has anything to do with the hardware page size, that's mostly transparent to the kernel anyway. But it might be that the prefetching on a particular SSD has more overhead than what it saves. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services