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

Pipe filesystem writes in lightning-persister through BufWriter #1404

Merged
merged 1 commit into from Apr 15, 2022

Conversation

TheBlueMatt
Copy link
Collaborator

We generally make no effort to ensure all writes are buffered in
lower-level objects, so wrapping write calls in BufWriter may
substantially improve performance in some cases. This is especially
important now that we block the sample node exit until the
NetworkGraph has been written out, which includes many small-ish
writes.

With this change, shutdown of the sample node on a relatively
underpowered device went from 15-30 seconds of CPU time to a second
or two, plus IO sync time.

We generally make no effort to ensure all writes are buffered in
lower-level objects, so wrapping write calls in `BufWriter` may
substantially improve performance in some cases. This is especially
important now that we block the sample node exit until the
`NetworkGraph` has been written out, which includes many small-ish
writes.

With this change, shutdown of the sample node on a relatively
underpowered device went from 15-30 seconds of CPU time to a second
or two, plus IO sync time.
@codecov-commenter
Copy link

codecov-commenter commented Apr 3, 2022

Codecov Report

Merging #1404 (7e93fdb) into main (af31831) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1404      +/-   ##
==========================================
- Coverage   90.83%   90.82%   -0.01%     
==========================================
  Files          73       73              
  Lines       41266    41266              
  Branches    41266    41266              
==========================================
- Hits        37485    37481       -4     
- Misses       3781     3785       +4     
Impacted Files Coverage Δ
lightning-persister/src/lib.rs 93.93% <100.00%> (ø)
lightning-persister/src/util.rs 95.77% <100.00%> (ø)
lightning/src/ln/functional_tests.rs 97.06% <0.00%> (-0.08%) ⬇️
lightning-invoice/src/de.rs 81.27% <0.00%> (+0.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af31831...7e93fdb. Read the comment docs.

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

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

Wow, that's a huge upgrade in shutdown time

@jkczyz jkczyz merged commit 83595db into lightningdevkit:main Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants