Skip to content

feat(indexer): Consumer builder using routing strategy#42024

Merged
nikhars merged 21 commits intomasterfrom
feat/indexer-builder-for-routing
Jan 3, 2023
Merged

feat(indexer): Consumer builder using routing strategy#42024
nikhars merged 21 commits intomasterfrom
feat/indexer-builder-for-routing

Conversation

@nikhars
Copy link
Copy Markdown
Contributor

@nikhars nikhars commented Dec 5, 2022

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_message in 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
Screen Shot 2022-12-09 at 10 51 35 PM

With slicing enabled - 15k msgs/second
Screen Shot 2022-12-09 at 10 51 26 PM

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

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 5, 2022
@vercel
Copy link
Copy Markdown

vercel bot commented Dec 6, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
sentry ✅ Ready (Inspect) Visit Preview Dec 6, 2022 at 8:11AM (UTC)
storybook ✅ Ready (Inspect) Visit Preview Dec 6, 2022 at 8:11AM (UTC)

Copy link
Copy Markdown
Contributor

@onewland onewland left a comment

Choose a reason for hiding this comment

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

looks good to me

@nikhars nikhars merged commit 3949d25 into master Jan 3, 2023
@nikhars nikhars deleted the feat/indexer-builder-for-routing branch January 3, 2023 20:31
@JonasBa JonasBa mentioned this pull request Jan 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants