Skip to content
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

Remove optimization of not sending small batches #50

Merged
merged 2 commits into from
Jul 1, 2024
Merged

Conversation

vegarsti
Copy link
Member

@vegarsti vegarsti commented Jul 1, 2024

Conduit reported "high latency". It might be due to this.

We're currently not sending batches of <10 blocks (1/10th of the max batch size of 100), to optimize throughput. When the indexer is caught up, this leads to (imo) unnecessarily high latency, as BOB produces blocks every 300ms and we'll thus only send a request every 3 seconds. We should instead be sending as often as possible, or at least the default of every half a second.

One option is to have some sort of "am I backfilling or not" flag. I suggest just removing this optimization for now, and rather revisit this if/when we see that the next time we're backfilling, we're unnecessarily sending many small batches.

I'm fairly convinced that when backfilling, this optimization ~never triggers anyway, since the requests to the node should be filling up the buffer of blocks to send.

@adammilnesmith let's discuss this one.

Copy link
Member Author

vegarsti commented Jul 1, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @vegarsti and the rest of your teammates on Graphite Graphite

@vegarsti vegarsti requested review from msf and adammilnesmith July 1, 2024 08:29
@vegarsti vegarsti changed the title Always send a batch when possible, even if it's small Remove optimization of not sending small batches Jul 1, 2024
@vegarsti vegarsti force-pushed the send-tiny-batches branch from 55e8dae to 8f35579 Compare July 1, 2024 08:44
Copy link
Contributor

@adammilnesmith adammilnesmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100% on the money - LGTM. We will send every 500ms by default if there's at least one block now (as trySendBlockBatch() has a check already to not send when the batch is completely empty). Looking at some of this code raised a couple of other questions for me not related to this change so will follow up with those separately.

@vegarsti vegarsti merged commit 82dfb39 into main Jul 1, 2024
1 check passed
@vegarsti vegarsti deleted the send-tiny-batches branch July 1, 2024 10:22
@@ -70,10 +70,6 @@ func (i *ingester) trySendCompletedBlocks(
nextBlockToSend int64,
) (int64, error) {
for {
if len(collectedBlocks) < maxBatchSize/10 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this impacts throughput on catchup scenarios, but yes, lets remove and validate perf on next large "catchup".
my testing showed we would average ±50% of the maxBatchSize without this, by flip-flopping between very small batches and full batches

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants