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

orca: use atomic pointer instead of mutex in server metrics recorder to improve performance #6799

Merged
merged 2 commits into from
Dec 16, 2023

Conversation

danielzhaotongliu
Copy link
Contributor

@danielzhaotongliu danielzhaotongliu commented Nov 15, 2023

PR included:

  • Use atomic pointers instead of mutex to improve performance.
  • When the server metrics recorder is modified/written (e.g. SetCPUUtilization) create a new snapshot and atomically store it. When the server metrics recorder is read, return the reference to the latest snapshot. Similar in implementation to C++.

Motivation:

  • See internal email thread and benchmarks regarding performance

Tested:

  • go test -cpu 1,4 -timeout 7m ./...
  • go test -race -cpu 1,4 -timeout 7m ./...
  • Verified new implementation improved internal benchmark performance

RELEASE NOTES:

  • orca: use atomic pointer to improve performance in server metrics recorder

Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Merging #6799 (ba06b28) into master (8645f95) will decrease coverage by 0.12%.
Report is 19 commits behind head on master.
The diff coverage is 87.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6799      +/-   ##
==========================================
- Coverage   83.57%   83.45%   -0.12%     
==========================================
  Files         285      285              
  Lines       30950    30879      -71     
==========================================
- Hits        25865    25771      -94     
- Misses       4021     4036      +15     
- Partials     1064     1072       +8     
Files Coverage Δ
orca/server_metrics.go 80.92% <87.50%> (ø)

... and 32 files with indirect coverage changes

@danielzhaotongliu
Copy link
Contributor Author

FYI: @yousukseung

orca/call_metrics.go Outdated Show resolved Hide resolved
@easwars easwars added the Type: Performance Performance improvements (CPU, network, memory, etc) label Dec 6, 2023
@easwars easwars added this to the 1.61 Release milestone Dec 6, 2023
@dfawley dfawley assigned danielzhaotongliu and unassigned dfawley Dec 15, 2023
@dfawley dfawley merged commit 02a4e93 into grpc:master Dec 16, 2023
14 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Performance Performance improvements (CPU, network, memory, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants