-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[exporter][batcher] Multi-batch support - Version 2 #12760
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12760 +/- ##
==========================================
+ Coverage 91.55% 91.57% +0.02%
==========================================
Files 499 500 +1
Lines 27102 27169 +67
==========================================
+ Hits 24814 24881 +67
Misses 1809 1809
Partials 479 479 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2834e5c
to
e501416
Compare
46eca7f
to
182507f
Compare
} | ||
|
||
func newMultiBatcher(bCfg BatchConfig, bSet batcherSettings[request.Request]) *multiBatcher { | ||
// TODO: Determine what is the right behavior for this in combination with async queue. |
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.
What question(s) are there? I'm not sure I'm following.
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 comment is duplicated from newDefaultBatcher()
. IIUC, this is related to how goroutines are allocated when async queue and the batcher are used together. Right now:
AsyncQueue
owns a goroutine pool of size n that is in charge of reading from the queue and callingBatcher::consume()
.Batcher::consume()
is in charge of appending the new item to the batch and invoking the flushing goroutine if neededBatcher
can allocate up to m goroutines for dispatching the active batch.
Both n
and m
come from the same config field sending_queue::num_consumers
, but it does not necessarily make sense use the same number of goroutines for "reading from queue" and "dispatching the request'
2e966a1
to
04c0b89
Compare
04c0b89
to
4db99d2
Compare
0c09d43
to
57c510d
Compare
} | ||
} | ||
|
||
func (qb *multiBatcher) getShard(ctx context.Context, req request.Request) *defaultBatcher { |
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.
Do we need to have another batcher at all (multiBatcher
)? I see significant amount code duplication. Maybe we just update defaultBacher
instead where the getShard
just returns a singleton if partitioner == nil
?
Description
This PR introduces two new components
Partitioner
- an interface for fetching batch key. A partitioner type should implement the functionGetKey()
which returns the batching key.Partitioner
should be provided to thequeue_bacher
along withsizer
inqueue_batch::Settings
.multi_batcher
. It supports key-based batching by routing the requests to a correspondingdefault_batcher
. Eachdefault_batcher
corresponds to a shard described in Exporter batcher dynamic sharding of the partitions #12473.Link to tracking issue
#12795
Testing
Documentation