kvserver: do lazy map allocations in replicaFlowControl#113150
kvserver: do lazy map allocations in replicaFlowControl#113150craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
|
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
pav-kv
left a comment
There was a problem hiding this comment.
Nice simple fix, thanks.
Could also store the maps in replicaFlowControl, and reuse them across the runs. Or, to avoid the sticky overhead, draw them from a sync.Pool and release after use. These strategies are less simple and possibly unnecessary. Feel free to leave a TODO though.
These methods will typically return empty maps, so we can avoid the allocations. Informs cockroachdb#111561 Epic: none Release note: None
56b5c2f to
270fad1
Compare
sumeerbhola
left a comment
There was a problem hiding this comment.
TFTR!
Could also store the maps in
replicaFlowControl, and reuse them across the runs. Or, to avoid the sticky overhead, draw them from async.Pooland release after use. These strategies are less simple and possibly unnecessary. Feel free to leave a TODO though.
I've left a comment in replicaFlowControlIntegrationImpl.notActivelyReplicatingTo for one of these possible optimizations. I didn't frame it as a TODO since I suspect we may never need to do it.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @pavelkalinnikov)
pkg/kv/kvserver/flow_control_replica.go line 63 at r1 (raw file):
Previously, pavelkalinnikov (Pavel Kalinnikov) wrote…
Could do with a comment why initialization is lazy here. Same below.
Done
|
test failure is unrelated #113112 |
aadityasondhi
left a comment
There was a problem hiding this comment.
thanks for the quick fix!
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @pavelkalinnikov)
|
bors r=pavelkalinnikov,aadityasondhi |
|
Build succeeded: |
These methods will typically return empty maps, so we can avoid the allocations.
Informs #111561
Epic: none
Release note: None