-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql/schema: re-organize the UnleasableSystemDescriptors set #74353
Merged
craig
merged 1 commit into
cockroachdb:master
from
nvanbenschoten:nvanbenschoten/assortedPerf16
Jan 3, 2022
Merged
sql/schema: re-organize the UnleasableSystemDescriptors set #74353
craig
merged 1 commit into
cockroachdb:master
from
nvanbenschoten:nvanbenschoten/assortedPerf16
Jan 3, 2022
Conversation
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 commit re-organizes the static maps we use to perform lookups into the `UnleasableSystemDescriptors`. It splits the `UnleasableSystemDescriptors` map into two, one optimized for `leasedDescriptors.getByName` and one optimized for `leasedDescriptors.getByID`. In a 100% read workload, `leasedDescriptors` accesses (`getByName` and `getByID`) were responsible for **4.39** of total CPU utilization. Within this, about **0.33%** of total CPU utilization was spent directly in these functions. This change shouldn't make a large difference (less than **0.2%**), but it should improve things slightly. Since it also improves readability, it seems worthwhile. ``` File: cockroach Type: cpu Time: Dec 30, 2021 at 10:57pm (UTC) Duration: 30.15s, Total samples = 74.99s (248.72%) Active filters: focus=leasedDescriptors\).getBy Showing nodes accounting for 3.29s, 4.39% of 74.99s total ----------------------------------------------------------+------------- flat flat% sum% cum cum% calls calls% + context ----------------------------------------------------------+------------- 0.14s 100% | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).getByName /go/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:199 0.10s 0.13% 0.13% 0.14s 0.19% | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*leasedDescriptors).getByName /go/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/leased_descriptors.go:102 0.03s 21.43% | github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.(*TableDescriptor).GetParentID /go/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb/structured.pb.go:2347 0.01s 7.14% | github.com/cockroachdb/cockroach/pkg/sql/catalog/dbdesc.(*immutable).GetParentID /go/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/dbdesc/database_desc.go:93 ----------------------------------------------------------+------------- 0.14s 100% | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).getByName /go/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:199 0.04s 0.053% 0.19% 0.14s 0.19% | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*leasedDescriptors).getByName /go/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/leased_descriptors.go:101 0.03s 21.43% | runtime.mapiternext /usr/local/go/src/runtime/map.go:851 0.02s 14.29% | runtime.mapiterinit /usr/local/go/src/runtime/map.go:821 0.01s 7.14% | runtime.duffzero /usr/local/go/src/runtime/duff_amd64.s:95 0.01s 7.14% | runtime.mapiterinit /usr/local/go/src/runtime/map.go:832 0.01s 7.14% | runtime.mapiterinit /usr/local/go/src/runtime/map.go:848 0.01s 7.14% | runtime.mapiternext /usr/local/go/src/runtime/map.go:898 0.01s 7.14% | runtime.mapiternext /usr/local/go/src/runtime/map.go:972 ----------------------------------------------------------+------------- ```
ajwerner
approved these changes
Jan 3, 2022
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @postamar)
TFTR! bors r=ajwerner |
Build succeeded: |
Very nice! Thanks for doing this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit re-organizes the static maps we use to perform lookups into the
UnleasableSystemDescriptors
. It splits theUnleasableSystemDescriptors
mapinto two, one optimized for
leasedDescriptors.getByName
and one optimized forleasedDescriptors.getByID
.In a 100% read workload,
leasedDescriptors
accesses (getByName
andgetByID
) were responsible for 4.39 of total CPU utilization.Within this, about 0.33% of total CPU utilization was spent directly in
these functions. This change shouldn't make a large difference (less than
0.2%), but it should improve things slightly. Since it also improves
readability, it seems worthwhile.