forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: avoid copying marshalled RaftCommand when encoding
Informs cockroachdb#36347. This change avoids the unnecessary allocation and memory copy present in Raft command encoding. This extra work is expensive for large commands like `AddSSTable` requests. Even for smaller requests, this work was still a serious problem because it took place under heavily contended locks. For instance, the encoding in `defaultSubmitProposalLocked` took place under the Replica mutex, which serializes all Raft proposals for a Range. The other two locations fixed took place under the Raft mutex. While less heavily contended, this was still slowing down the Raft processing goroutine. This is a less dramatic version of a change I've been working on. The full change lifts the slice allocation and most of the RaftCommand proto marshalling all the way out of `defaultSubmitProposalLocked` and out of the `Replica.mu` critical section. This commit gets us part of the way there sets the stage for the rest of the change. Release note: None
- Loading branch information
1 parent
422635c
commit b38c984
Showing
3 changed files
with
47 additions
and
31 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