Skip to content
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

release-2.1: storage: avoid per-kv allocations during consistency checks #30053

Merged

Conversation

nvanbenschoten
Copy link
Member

Backport 1/1 commits from #29419.

/cc @cockroachdb/release


I noticed in an alloc_objects heap profile on a 3-node cluster restoring tpcc that more than 46% of all allocations were made in computeChecksumPostApply. Specifically, these allocations were all made in Replica.sha512. 28% of allocations were due to protobuf marshaling of hlc.LegacyTimestamp.
The other 18% was in encoding/binary.Write.

This removes both of these sources of per-key allocations. The first allocation was avoided by sharing a byte buffer across protobuf marshals. The second was avoided by removing the call to binary.Write (see golang/go#27403). I confirmed that this is no longer an issue by looking at heap profiles from before and after in a test that performed a consistency check.

I plan to follow up on golang/go#27403 and search for any other offenders in our codebase. I already see a few.

Release note: None

I noticed in an `alloc_objects` heap profile on a 3-node cluster
restoring tpcc that more than 46% of all allocations were made in
`computeChecksumPostApply`. Specifically, these allocations were all
made in `Replica.sha512`. 28% of allocations were due to protobuf
marshaling of `hlc.LegacyTimestamp`. The other 18% was in `encoding/binary.Write`.

This removes both of these sources of per-key allocations. The first
allocation was avoided by sharing a byte buffer across protobuf marshals.
The second was avoided by removing the call to `binary.Write` (see
golang/go#27403). I confirmed that this is no
longer an issue by looking at heap profiles from before and after in a test
that performed a consistency check.

I plan to follow up on golang/go#27403 and
search for any other offenders in our codebase. I already see a few.

Release note: None
@nvanbenschoten nvanbenschoten requested review from jordanlewis and a team September 11, 2018 05:23
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten nvanbenschoten merged commit d803f9e into cockroachdb:release-2.1 Sep 17, 2018
@nvanbenschoten nvanbenschoten deleted the backport2.1-29419 branch September 18, 2018 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants