From: | Paul Guo <guopa(at)vmware(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Two patches to speed up pg_rewind. |
Date: | 2021-02-02 09:55:43 |
Message-ID: | 63CA322C-9477-4751-A7FE-E8443FF9D23E@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Jan 28, 2021, at 3:31 PM, Michael Paquier <michael(at)paquier(dot)xyz<mailto:michael(at)paquier(dot)xyz>> wrote:
On Wed, Jan 27, 2021 at 09:18:48AM +0000, Paul Guo wrote:
Second one is use copy_file_range() for the local rewind case to replace read()+write().
This introduces copy_file_range() check and HAVE_COPY_FILE_RANGE so other
code could use copy_file_range() if needed. copy_file_range() was introduced
In high-version Linux Kernel, in low-version Linux or other Unix-like OS mmap()
might be better than read()+write() but copy_file_range() is more interesting
given that it could skip the data copying in some file systems - this could benefit more
on Linux fs on network-based block storage.
Have you done some measurements?
I did not test pg_rewind but for patch 2, I tested copy_fiile_range() vs read()+write()
on XFS in Ubuntu 20.04.1 when working on the patches,
Here is the test time of 1G file (fully populated with random data) copy. The test is a simple C program.
copy_file_range() loop (actually it finished after one call) + fsync()
0m0.048s
For read()+write() loop with read/write buffer size 32K + fsync()
0m5.004s
For patch 1, it skips syncing less files so it surely benefits the performance.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2021-02-02 10:00:54 | Re: Single transaction in the tablesync worker? |
Previous Message | japin | 2021-02-02 09:31:23 | Re: memory leak in auto_explain |