-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: Do not copy replication metrics over and over
Replication metrics were cloned for each leader metrics update. This is not necessary. Instead, keep a hashmap of replication metrics with *atomic* indices of matching log on individual replicas. Only if anything else changes clone the map. The change improves the performance of the empty Raft benchmark by about 5% by reducing reallocations of the replication metrics. Further improvement could be made by reducing the number of atomic operations on the `Arc` backing the `LeaderMetrics`, but that's likely not worth it as of now. NOTE: This change slightly changes the API of `ReplicationMetrics`. Previously, public access was given to the member `matched`. Now, the member access was replaced with a method `matched()` and a constructor to construct the object. I.e., any user of the `ReplicationMetrics` interested in exact log position on the replica needs to be adjusted to call the method `matched()` instead of just using `matched` member. To prevent such issues in the future, the APIs should not expose members, only accessor functions. This should be taken into consideration in the upcoming API refactoring.
- Loading branch information
Showing
5 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters