Re: Small miscellaneous fixes - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: Small miscellaneous fixes
Date
Msg-id CAEudQAoq6Fai1GrbE4m7UmH3Gr5JCdJB0c=Wz2wxeV8CiuOBmQ@mail.gmail.com
Whole thread Raw
In response to Re: Small miscellaneous fixes  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Em qua., 16 de nov. de 2022 às 03:59, Michael Paquier <michael@paquier.xyz> escreveu:
On Tue, Oct 04, 2022 at 08:23:16AM -0300, Ranier Vilela wrote:
> Both are correct, I missed the pqsignal calls.
>
> Attached patch to change this.

The change for pgbench is missing and this is only changing
pg_test_fsync.  Switching to sig_atomic_t would be fine on non-WIN32
as these are used in signal handlers, but are we sure that this is
fine on WIN32 for pg_test_fsync where we rely on a separate thread to
control the timing of the alarm?
Well I tested here in Windows 10 64 bits with sig_atomic_t alarm_triggered and works fine.
ctrl + c breaks the exe.

Windows 10 64bits
SSD 256GB

For curiosity, this is the test results:
5 seconds per test
O_DIRECT supported on this platform for open_datasync and open_sync.

Compare file sync methods using one 8kB write:
(in wal_sync_method preference order, except fdatasync is Linux's default)
        open_datasync

ctrl + c

C:\postgres_debug\bin>pg_test_fsync
5 seconds per test
O_DIRECT supported on this platform for open_datasync and open_sync.

Compare file sync methods using one 8kB write:
(in wal_sync_method preference order, except fdatasync is Linux's default)
        open_datasync

ctrl + c 

C:\postgres_debug\bin>pg_test_fsync
5 seconds per test
O_DIRECT supported on this platform for open_datasync and open_sync.

Compare file sync methods using one 8kB write:
(in wal_sync_method preference order, except fdatasync is Linux's default)
        open_datasync                      9495,720 ops/sec     105 usecs/op
        fdatasync                           444,174 ops/sec    2251 usecs/op
        fsync                               398,487 ops/sec    2509 usecs/op
        fsync_writethrough                  342,018 ops/sec    2924 usecs/op
        open_sync                                       n/a

Compare file sync methods using two 8kB writes:
(in wal_sync_method preference order, except fdatasync is Linux's default)
        open_datasync                      4719,825 ops/sec     212 usecs/op
        fdatasync                           442,138 ops/sec    2262 usecs/op
        fsync                               401,163 ops/sec    2493 usecs/op
        fsync_writethrough                  397,198 ops/sec    2518 usecs/op
        open_sync                                       n/a

Compare open_sync with different write sizes:
(This is designed to compare the cost of writing 16kB in different write
open_sync sizes.)
         1 * 16kB open_sync write                       n/a
         2 *  8kB open_sync writes                      n/a
         4 *  4kB open_sync writes                      n/a
         8 *  2kB open_sync writes                      n/a
        16 *  1kB open_sync writes                      n/a

Test if fsync on non-write file descriptor is honored:
(If the times are similar, fsync() can sync data written on a different
descriptor.)
        write, fsync, close                  77,808 ops/sec   12852 usecs/op
        write, close, fsync                  77,469 ops/sec   12908 usecs/op

Non-sync'ed 8kB writes:
        write                            139789,685 ops/sec       7 usecs/op

regards,
Ranier Vilela

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: HOT chain validation in verify_heapam()
Next
From: Robert Haas
Date:
Subject: Re: Add sub-transaction overflow status in pg_stat_activity