-
Notifications
You must be signed in to change notification settings - Fork 205
headerfs: sync file after writing raw header in appendRaw
function
#296
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
base: master
Are you sure you want to change the base?
headerfs: sync file after writing raw header in appendRaw
function
#296
Conversation
While this implementation is likely correct and probably the thing we should do, I worry about the performance hit this will take. Do we have a benchmark test to see how much of an impact this change has? Perhaps we need to also refactor things a bit to make sure we only call the |
Yes, you're right! It may cause overhead of syncing unless a given benchmark proves otherwise 👍
I will look into this. Thanks for sharing! |
you are right @guggero. I have got an opportunity to go through this PR/Issue and the file sync operation is a significant one increases with the batch size. I have tried batch size from 1 -> 2048 (2^0 -> 2^11). Here are the benchmarking results for reference. Benchmarking Results (formatted using Gemini)Benchmark Analysis: HeaderStoreAppendRawBatches PerformanceThis table summarizes the go test -bench=BenchmarkHeaderStoreAppendRawBatches -benchmem results, focusing on the ns/op (nanoseconds per operation) and memory allocation (B/op, allocs/op) for different batch sizes, comparing NoSync and WithSync modes.
Key Takeaways:
|
Nice benchmark tests! An alternative to syncing on every write would be a time based sync. So every X seconds we'd call I agree that with #313 things probably already look better. But perhaps syncing from time to time might still help a bit. |
Doesn't the truncate logic take care of this? Lines 241 to 248 in 27977e1
|
On second thought, there's a TODO above there that mentions we don't expect the index to be ahead of the file. It's possible to have a distinct loop that'll replace the current index tip with the latest header in the file. |
Just FYI, I'm holding off on review until some form of #296 (comment) is implemented. |
@Roasbeef: review reminder |
This issue seems not urgent. Gonna put it in draft mode for now the bot can stop notifying involved reviewers |
Change Description
Closes #276