-
Notifications
You must be signed in to change notification settings - Fork 273
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
disk write and leader timeout #75
Comments
I suggest that the library need to provide asynchronous interfaces to write operations. typedef struct
} raft_batch_t; int log_append_entry(log_t* me_, raft_batch_t* bat)
} |
I'm not entirely sure @skypexu and @vgfree intended it as well, but it'd be nice to also have the leader not wait for its own log to be written and synced to disk, effectively performing its own local AppendEntries in parallel with the network AppendEntries RPCs. The matchedIndex array should include the leader itself, and the leader should update it when it's done with its local disk write. This eliminates a disk write from raft's critical path. Note that an entry can be then considered committed even before the leader finishes writing it to its own local disk, if a majority of followers respond that they have appended it. See "10.2.1 Writing to the leader’s disk in parallel" in Ongaro's |
Yes, I agree it should write to leader's disk in parallel. |
synchronously writing log to disk can blocks leader's main loop, and causes it to timeout, then the cluster has to reelect a new leader, this impacts cluster availability, I think in leader, there should have a thread to flush log to disk, an index field indicating at which point the log is flushed, the the committed index should be based on this, for follower, log is synchronously written.
--
update:
also it could be better to apply log in asynchronous manner to not block main loop.
The text was updated successfully, but these errors were encountered: