feat(indexer): Consumer builder using routing strategy#42024
Merged
feat(indexer): Consumer builder using routing strategy#42024
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
evanh
reviewed
Dec 9, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
In a world where a specific dataset of Snuba is sliced, the Snuba consumers work on sliced topics. That means Snuba consumers belonging to separate slices consume from separate topics. In order to support that, the input to the Snuba consumers i.e. metrics indexer needs to have the capability to write to different topics. This can be achieved by using the RoutingProducer introduced in #40776
Implementation
Since the strategies can get opened/closed whenever Kafka rebalance happens, the producer resources need to be created before the consumer builder factory and gets passed into it. The
reconstruct_messagein IndexerBatch is modified to either return normal kafka payload or routing payload based on whether it needs to send output specifically for routing or not.Tests
Added a unit test for the Indexer changes to correctly reconstruct messages for the sliced output.
Ran the consumer locally with the settings override to confirm that messages get sent to the new sliced topic
Performance test results
Baseline test - 18k msgs/second

With slicing enabled - 15k msgs/second

There is a degradation of 3k msgs/second which I am not too concerned about right now since slicing isn't needed right now