Re: Excessive (and slow) fsync() within single transaction

Поиск
Список
Период
Сортировка
От Stephen Tyler
Тема Re: Excessive (and slow) fsync() within single transaction
Дата
Msg-id 51549ea20912090411r7c16932bw671e9f01a5b9855d@mail.gmail.com
обсуждение исходный текст
Ответ на Excessive (and slow) fsync() within single transaction  (Stephen Tyler <stephen@stephen-tyler.com>)
Ответы Re: Excessive (and slow) fsync() within single transaction  (Scott Marlowe <scott.marlowe@gmail.com>)
Re: Excessive (and slow) fsync() within single transaction  (Greg Smith <greg@2ndquadrant.com>)
Список pgsql-general
Some more information on fsync using the test_fsync tool in postgres/src/tools:

System is Snow Leopard 10.6.2 (64 bit).  Volumes are HFS+ formatted.

PASS 1 - DATABASE VOLUME (SSD RAID 0)
===================================
$ sudo ./test_fsync -f /Volumes/SSD/fsync_test.out
Simple write timing:
    write                    0.127178

Compare fsync times on write() and non-write() descriptor:
If the times are similar, fsync() can sync data written
on a different descriptor.
    write, fsync, close      0.254609
    write, close, fsync      0.316973

Compare one o_sync write to two:
    one 16k o_sync write     0.260829
    two 8k o_sync writes     0.259231

Compare file sync methods with one 8k write:
    open o_dsync, write      0.135035
    open o_sync, write       0.128056
    write, fdatasync         0.154622
    write, fsync             0.154496

Compare file sync methods with two 8k writes:
    open o_dsync, write      0.260390
    open o_sync, write       0.426376
    write, fdatasync         0.382204
    write, fsync             0.249774

PASS 2 - SATA HDD (7200 rpm)
=========================
$ sudo ./test_fsync -f /Volumes/Work/fsync_test.out
Simple write timing:
    write                    0.205038

Compare fsync times on write() and non-write() descriptor:
If the times are similar, fsync() can sync data written
on a different descriptor.
    write, fsync, close      0.498885
    write, close, fsync      0.383176

Compare one o_sync write to two:
    one 16k o_sync write     0.237621
    two 8k o_sync writes     0.458676

Compare file sync methods with one 8k write:
    open o_dsync, write      0.171746
    open o_sync, write       0.195227
    write, fdatasync         0.195102
    write, fsync             0.218675

Compare file sync methods with two 8k writes:
    open o_dsync, write      0.345076
    open o_sync, write       0.368541
    write, fdatasync         0.254322
    write, fsync             0.271039

If the tests are repeated, the numbers are not very stable, but generally in the range 0.18 to 0.48.

The times are apparently in milliseconds.  But that doesn't make any sense for the 7200rpm SATA HDD, given it has an 8.3ms rotation time.  And the numbers for the SSD are basically identical to the HDD, apart from the bare write timing.

Do I conclude that the sync timings are all faked by the OS?

Stephen

В списке pgsql-general по дате отправления:

Предыдущее
От: AlexeyChe
Дата:
Сообщение: C functions, dll, server fall down
Следующее
От: Stephen Tyler
Дата:
Сообщение: Re: Excessive (and slow) fsync() within single transaction