Re: WAL prefetch - Mailing list pgsql-hackers

From Konstantin Knizhnik
Subject Re: WAL prefetch
Date
Msg-id d730e71b-fcb0-2cbd-04c9-1a341b172102@postgrespro.ru
Whole thread Raw
In response to Re: WAL prefetch  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: WAL prefetch
List pgsql-hackers

On 14.06.2018 15:44, Robert Haas wrote:
> On Wed, Jun 13, 2018 at 11:45 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
>>> I have tested wal_prefetch at two powerful servers with 24 cores, 3Tb NVME
>>> RAID 10 storage device and 256Gb of RAM connected using InfiniBand.
>>> The speed of synchronous replication between two nodes is increased from 56k
>>> TPS to 60k TPS (on pgbench with scale 1000).
>> That's a reasonable improvement.
> Somehow I would have expected more.  That's only a 7% speedup.
>
> I am also surprised that HDD didn't show any improvement.

My be pgbench is not the best use case for prefetch. It is updating more 
or less random pages and if database is large enough and 
full_page_writes is true (default value)
then most pages will be updated only once since last checkpoint and most 
of updates will be represented in WAL by full page records.
And such records do not require reading any data from disk.

>   Since HDD's
> are bad at random I/O, I would have expected prefetching to help more
> in that case.
>
Speed of random HDD access is limited by speed of disk head movement.
By running several IO requests in parallel we just increase probability 
of head movement, so actually parallel access to HDD may even decrease 
IO speed rather than increase it.
In theory, given several concurrent IO requests, driver can execute them 
in optimal order, trying to minimize head movement. But if there are 
really access to random pages,
then probability that we can win something by such optimization is very 
small.


-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Remove mention in docs that foreign keys on partitioned tablesare not supported
Next
From: Robert Haas
Date:
Subject: Re: WAL prefetch