-
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
kvserver: instrument RaftTransport workers with pprof labels #85909
Conversation
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.
I think these parameters are there on purpose, because they allow us to identify which node/class the goroutine belongs to in goroutine dumps. This is very useful during debugging, if something has stalled somewhere, since there can be lots of these goroutines running and we need to know which is which.
Might be worth a comment about this.
@erikgrinaker Good to know that, I'll add a comment. |
That said, I believe the recent changes to Go function call conventions in 1.17 may have broken this. I forget what the current state is, maybe you remember @tbg? We should really be using pprof labels instead, if possible. |
Yeah, there's something about it here: cockroach/pkg/kv/kvserver/replica_send.go Lines 117 to 136 in c7396ee
FWIW, we often call these cockroach/pkg/kv/kvserver/replica_rangefeed.go Lines 142 to 144 in 566dff2
|
The unused As Erik pointed out, the "correct" way to do this now is pprof annotations, which were added to the goroutine profile output recently! If you don't mind, @pavelkalinnikov, add that here. Basically, we want to wrap this call cockroach/pkg/kv/kvserver/raft_transport.go Lines 713 to 715 in 0b73408
in a pprof.Do(ctx, pprof.Labels("remote_node_id", toNodeID.String()), func(ctx context.Context) {
if err := t.processQueue(toNodeID, ch, stats, stream, class); err != nil {
log.Warningf(ctx, "while processing outgoing Raft queue to node %d: %s:", toNodeID, err)
}
}) You can then For |
@tbg @erikgrinaker Done, PTAL. |
@tbg I wrapped it a bit higher up the stack, in the place where the |
The unused arguments in the method signature were used to identify goroutines in traces. This no longer works after Go 1.17 started passing arguments via registers. This commit adds pprof labels when starting these goroutines, to have a cleaner code, more readable traces, and to work around the new Go convention. Release note: None
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.
LGTM, thanks!
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.
Very nice, thanks!
bors r=tbg,erikgrinaker |
Build succeeded: |
The unused arguments in the method signature were used to identify goroutines
in traces. This no longer works after Go 1.17 started passing arguments via
registers.
This commit adds pprof labels when starting these goroutines, to have a cleaner
code, more readable traces, and to work around the new Go convention.
Release note: None