Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: use fdatasync instead of fsync where possible #263

Merged
merged 1 commit into from
Aug 7, 2017

Conversation

jnpkrn
Copy link
Contributor

@jnpkrn jnpkrn commented Jul 27, 2017

Using years-old benchmark attached to PostreSQL ML[1], I've observed
tiny bit more than double boost in speed when using fdatasync instead of
traditional fsync, on two Linux machines, each equipped with an SSD.
While the observation may be disputable (there are various
interpretations to what "synchronized I/O" actually means), by logical
extension of what the two are supposed to do, one can expect fdatasync
will perform no worse than fsync. Having the timestamps correct is
really not a priority, compared to timely processing of the message
stream. So let's use it whenever possible with QB_LOG_CONF_FILE_SYNC
requested.

[1] https://www.postgresql.org/message-id/[email protected]
https://www.postgresql.org/message-id/attachment/20659/syncbench.c

configure.ac Outdated
break
fi
file_sync=fsync;;
fsync)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to add comment like "FALLTHROUGH is intentional"

Copy link
Contributor Author

@jnpkrn jnpkrn Jul 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were other issues (fixed now) but I'd say the iterated fallback
scheme is quite recognizable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it's not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll add a brief explanation prior to start of the show.

@jnpkrn jnpkrn force-pushed the log-fdatasync branch 3 times, most recently from ca83aec to 55efe05 Compare July 31, 2017 16:39
Using years-old benchmark attached to PostreSQL ML[1], I've observed
tiny bit more than double boost in speed when using fdatasync instead of
traditional fsync, on two Linux machines, each equipped with an SSD.
While the observation may be disputable (there are various
interpretations to what "synchronized I/O" actually means), by logical
extension of what the two are supposed to do, one can expect fdatasync
will perform no worse than fsync.  Having the timestamps correct is
really not a priority, compared to timely processing of the message
stream.  So let's use it whenever possible with QB_LOG_CONF_FILE_SYNC
requested.

As an aside, PostreSQL seems to be be using "fdatasync" method of
updating out to disk by default on Linux till today[2].

[1] https://www.postgresql.org/message-id/[email protected]
    https://www.postgresql.org/message-id/attachment/20659/syncbench.c
[2] https://www.postgresql.org/docs/current/static/runtime-config-wal.html#GUC-WAL-SYNC-METHOD

Signed-off-by: Jan Pokorný <[email protected]>
@chrissie-c chrissie-c merged commit 333fc80 into ClusterLabs:master Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants