-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
vtorc
: cleanup discover queue, add concurrency flag
#17825
base: main
Are you sure you want to change the base?
vtorc
: cleanup discover queue, add concurrency flag
#17825
Conversation
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Tim Vaillancourt <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17825 +/- ##
==========================================
+ Coverage 67.44% 67.52% +0.08%
==========================================
Files 1592 1595 +3
Lines 258076 259641 +1565
==========================================
+ Hits 174051 175325 +1274
- Misses 84025 84316 +291 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
vtorc
: lockless discover queue, add concurrency flagvtorc
: cleanup discover queue, add concurrency flag
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
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.
Rest I think its pretty good. I don't see why we had both queuedKeys and consumedKeys in the structure. This is fine.
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
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.
The naming of the flag is debatable. Rest LGTM.
go/flags/endtoend/vtorc.txt
Outdated
@@ -32,6 +32,7 @@ Flags: | |||
--config-persistence-min-interval duration minimum interval between persisting dynamic config changes back to disk (if no change has occurred, nothing is done). (default 1s) | |||
--config-type string Config file type (omit to infer config type from file extension). | |||
--consul_auth_static_file string JSON File to read the topos/tokens from. | |||
--discovery-max-concurrency int Number of workers used for tablet discovery (default 300) |
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.
This is somewhat of a nit, but this isn't really a "max" is it? It's the actual concurrency. We are creating as many goroutines as this number tells us to.
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.
@deepthi good catch! I think "concurrency" is also misleading because all workers aren't guaranteed to be doing any work
I've renamed this to --discovery-workers
which I think tells the story better. Please merge if you agree
Signed-off-by: Tim Vaillancourt <[email protected]>
Description
This PR cleans up the VTOrc discover queue code, mainly by removing all locking from
.Consume()
; this was achieved by addingtype queueItem struct
and pushing this to the channel instead, with the key andtime.Time
included. Previously thistime.Time
was stored in amap
with mutex locksThe
.QueueLen()
now returns just thelen()
of the queue channel. Before this metric would include the length of the channel plus all that are "in processing" (between.Consume()
and.Release()
), which I'm unsure is necessary. Simplifying this removed the need for a lock in.QueueLen()
Finally, the
--discovery-workers
flag was added to control how many workers consume the discovery queueBenchmark:
tvaillancourt@tvailla-ltmawfe vitess % go test -v -bench=. ./go/vt/vtorc/discovery/... === RUN TestQueue --- PASS: TestQueue (0.00s) goos: darwin goarch: arm64 pkg: vitess.io/vitess/go/vt/vtorc/discovery cpu: Apple M3 Max BenchmarkQueues BenchmarkQueues/New BenchmarkQueues/New-14 4726 244573 ns/op BenchmarkQueues/Legacy BenchmarkQueues/Legacy-14 3610 338468 ns/op PASS ok vitess.io/vitess/go/vt/vtorc/discovery 3.923s
NOTE:
New
== this PR,Legacy
== current queueRelated Issue(s)
#17330
Checklist
Deployment Notes