-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
(2.12) Filestore async flush #7018
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
Conversation
Going to try if this can be simplified a bit more, in draft for now. |
How is this related to the |
That means when fsync is called on the file. Either |
3096a0c
to
87bd91e
Compare
87bd91e
to
279101d
Compare
e94193a
to
22d5cf0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do a call tomorrow to discuss - mostly interested in the ceIndex new arg and whether or not we can avoid introducing a new arg to public functions.
@@ -778,7 +782,8 @@ func (a *Account) addStreamWithAssignment(config *StreamConfig, fsConfig *FileSt | |||
} | |||
} | |||
fsCfg.StoreDir = storeDir | |||
fsCfg.AsyncFlush = false | |||
// Async flushing is only allowed if the stream has a sync log backing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we allow for R1s with caveat data loss might be possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to discuss that, but (if we agree) allow that in a separate PR.
I'm thinking people would likely jump to opt-in to incredible throughput at the cost of consistency for R1, to then ask why writes are lost during hard kills, etc. So, I'm honestly not sure yet if we should be allowing this at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling for replicated is fine, because we have a log where our writes are safely stored. Async applying on JetStream then is just a "free" speedup.
22d5cf0
to
60c3895
Compare
During the call we discussed a simpler method to force flushing just before doing a Have updated the PR to contain this simpler approach, without the need for passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
c3e7532
to
bc4655b
Compare
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
…loop resources Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
bc4655b
to
ec98ff4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The filestore's
AsyncFlush
setting can now be enabled for a JetStream stream using theAllowAsyncFlush
field. Some initial benchmarks showed a 10-15% performance increase when using a R3 stream (3-node cluster with each node in a different availability zone).Only enabling the filestore's
AsyncFlush
setting without additional code would be unsafe. That's why this PR introduces some new mechanisms to make it safe. This makes the performance improvement essentially "free", with no negative consequences for data safety/consistency.n.InstallSnapshot(..)
we now do amset.flushAllPending()
to ensure all state represented in the snapshot, actually all made it to disk.fs.lmb
would only be sometimes be flushed, for example infs.checkLastBlock
but not when creating a newfs.lmb
infs.newMsgBlockForWrite
. Instead, always flush and closefs.lmb
when creating a new block infs.newMsgBlockForWrite
. This resolves non-monotonic sequence issues that could be reproduced by Antithesis.AllowAsyncFlush
stream setting can be freely/safely enabled and disabled. It will only be effective when using file storage, and only when the stream is backed by a Raft log, i.e. it's replicated.Relates to #6784
Signed-off-by: Maurice van Veen github@mauricevanveen.com