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

utils: remove unnecessary fsync in durable_rename() #9686

Merged
merged 3 commits into from
Nov 12, 2024

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Nov 8, 2024

Problem

WAL segment fsyncs significantly affect WAL ingestion throughput. durable_rename() is used when initializing every 16 MB segment, and issues 3 fsyncs of which 1 was unnecessary.

Touches #9664.

Summary of changes

Remove an fsync in durable_rename which is unnecessary with Linux and ext4 (which we currently use). This improves WAL ingestion throughput by up to 23% with large appends on my MacBook.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

@erikgrinaker erikgrinaker requested a review from arssher November 8, 2024 09:49
@erikgrinaker
Copy link
Contributor Author

Benchmarks on my MacBook, ingesting 1 GB of WAL with varying AppendRequest sizes via WAL acceptor with fsync enabled.

wal_acceptor_throughput/fsync=true/commit=false/size=1024
                        time:   [13.191 s 13.238 s 13.289 s]
                        thrpt:  [77.054 MiB/s 77.352 MiB/s 77.627 MiB/s]
                 change:
                        time:   [-3.5965% -2.9042% -2.3172%] (p = 0.00 < 0.05)
                        thrpt:  [+2.3721% +2.9911% +3.7306%]
wal_acceptor_throughput/fsync=true/commit=false/size=8192
                        time:   [2.8743 s 2.8978 s 2.9210 s]
                        thrpt:  [350.57 MiB/s 353.38 MiB/s 356.26 MiB/s]
                 change:
                        time:   [-10.334% -9.1313% -7.9787%] (p = 0.00 < 0.05)
                        thrpt:  [+8.6704% +10.049% +11.526%]
wal_acceptor_throughput/fsync=true/commit=false/size=131072
                        time:   [1.4600 s 1.4773 s 1.4943 s]
                        thrpt:  [685.29 MiB/s 693.14 MiB/s 701.36 MiB/s]
                 change:
                        time:   [-20.188% -18.542% -16.896%] (p = 0.00 < 0.05)
                        thrpt:  [+20.331% +22.762% +25.294%]
wal_acceptor_throughput/fsync=true/commit=false/size=1048576
                        time:   [1.6651 s 1.6824 s 1.7033 s]
                        thrpt:  [601.18 MiB/s 608.66 MiB/s 614.97 MiB/s]
                 change:
                        time:   [-19.657% -17.659% -15.607%] (p = 0.00 < 0.05)
                        thrpt:  [+18.493% +21.447% +24.467%]

Copy link

github-actions bot commented Nov 8, 2024

5382 tests run: 5162 passed, 0 failed, 220 skipped (full report)


Code coverage* (full report)

  • functions: 31.8% (7882 of 24824 functions)
  • lines: 49.4% (62416 of 126224 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
bf2bb60 at 2024-11-12T15:11:08.124Z :recycle:

libs/utils/src/crashsafe.rs Outdated Show resolved Hide resolved
@erikgrinaker erikgrinaker enabled auto-merge (squash) November 12, 2024 14:08
@erikgrinaker erikgrinaker merged commit 05381a4 into main Nov 12, 2024
80 checks passed
@erikgrinaker erikgrinaker deleted the erik/durable-rename-fsyncs branch November 12, 2024 17:57
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