Skip to content

feat(streams): Add a fake Kafka-less source for profiling pipelines - #360

Open
fpacifici wants to merge 5 commits into
mainfrom
fpacifici/profile-script
Open

feat(streams): Add a fake Kafka-less source for profiling pipelines#360
fpacifici wants to merge 5 commits into
mainfrom
fpacifici/profile-script

Conversation

@fpacifici

@fpacifici fpacifici commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Adds a profiling mode that runs a pipeline end to end without a Kafka broker. A new FakeSource primitive synthesises messages of random bytes at a configurable rate and terminates after a fixed count, so the cost of the pipeline machinery itself (Python/Rust step execution) can be measured in isolation.

pipeline = fake_streaming_source(
    name="fake_source",
    message_size_bytes=1024,
    messages_per_second=1000.0,
    num_messages=10000,
)

The idea is to instantiate the Arroyo processor with a fake consumer class instead of making the processor create its own consumer.
This can be extended into other types of sources including mock consumers for unit tests without kafka.

The fake source, right now, is pretty bare bone, it does not do anything regarding assignment, partitioning and rebalancing. This is ok as this is meant to profile the pipelines under steady load.

Dependency note for review

We were picking up the latest version of arroyo, though a breaking change was introduced in getsentry/arroyo#540, so we need to limit the version and adapt to the change in another PR.

@fpacifici
fpacifici marked this pull request as ready for review July 31, 2026 22:07
@fpacifici
fpacifici requested a review from a team as a code owner July 31, 2026 22:07

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 302a613. Configure here.


fn paused(&self) -> Result<HashSet<Partition>, ConsumerError> {
Ok(HashSet::new())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fake consumer ignores pause

Medium Severity

FakeConsumer treats pause, resume, and paused as no-ops, so it can still return new messages after Arroyo applies backpressure via MessageRejected. Arroyo expects a paused consumer’s poll to return None; violating that can break or crash the processor under load, which is exactly when profiling pipelines tend to hit backpressure.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 302a613. Configure here.

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.

1 participant