-
Couldn't load subscription status.
- Fork 4.6k
resolver_wrapper: early return addChannelzTraceEvent on !channelz.IsOn() #7436
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
Conversation
Large and frequent calls to this method in UpdateState can cause an extremely high usage of CPU time and Memory due to underlying json.Marshal calls that are not used or needed if channelz is not on.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7436 +/- ##
==========================================
+ Coverage 81.33% 81.44% +0.10%
==========================================
Files 352 352
Lines 26919 26921 +2
==========================================
+ Hits 21895 21926 +31
+ Misses 3824 3804 -20
+ Partials 1200 1191 -9
|
|
Note: this is a degradation introduced in this PR: #5192 Which used to wrap calls to |
|
@jsm,
Do you understand why this would be happening? These types of calls are generally expected to be infrequent, and are often expensive as they result in a full state update of the channel. |
We call this every 10 seconds to update the list of addresses, since they change frequently. That seems like a reasonable usage of this, but perhaps I'm missing something? |
I think regardless, my CPU profile shows that most of it's expense is coming from the addChannelZTraceEvent call (99.7% of the UpdateState call's CPU time in this particular example to be exact), rather than from actually updating the state? |
|
Responded in #7437, we can move forward with the other PR. |
That doesn't seem particularly bad.
That is quite bad, but out of curiosity, what is the total effect of this on the binary when you call it every 10s? Are you seeing it causing other problems, or does total CPU usage spike to a visible amount, etc? |
This was a large upgrade jump, from v1.29.0 to v.1.64.0 You can see CPU utilization almost tripled for one of our services. That comes down after about 30 minutes, I think due to the optimizations in #1455 Note: we also double the CPU/Memory of this service to accommodate for the increased memory usage as well. The CPU utilization tripled despite having twice as many vCPUs to use. |
But being 30+ versions apart, these graphs don't help prove that the log you are concerned about is related. |

Note: this is a degradation introduced in this PR: #5192
Which used to wrap calls to
addChannelzTraceEventin aif channelz.IsOn() {Problem
Large and frequent calls to this method in UpdateState can cause an extremely high usage of CPU time and Memory due to underlying json.Marshal calls that are not used or needed if channelz is not on.
See alternative approach here: #7437
Pprofs