Skip to content

[dbsp] Use approximate size for size of in-memory batches.#5998

Merged
blp merged 1 commit intomainfrom
sizeof
Apr 6, 2026
Merged

[dbsp] Use approximate size for size of in-memory batches.#5998
blp merged 1 commit intomainfrom
sizeof

Conversation

@blp
Copy link
Copy Markdown
Member

@blp blp commented Apr 6, 2026

When Feldera takes a profile, it measures the size of all the batches in each spine using SizeOf. This is very expensive for large batches, in some cases taking over a second of CPU time. This commit fixes the problem.

Another way to fix the problem would be to calculate the exact size and save it. This could be done at batch creation time unconditionally, or the first time we measure it and cached. But this would still take the same large amount of CPU time, we'd just be able to avoid taking it more than once. And if we did it lazily and cached it, it would still take a lot of time in profiles, especially the first time a profile runs.

Describe Manual Test Plan

I am running the unit tests.

When Feldera takes a profile, it measures the size of all the batches in
each spine using SizeOf.  This is very expensive for large batches, in
some cases taking over a second of CPU time.  This commit fixes the
problem.

Another way to fix the problem would be to calculate the exact size and
save it.  This could be done at batch creation time unconditionally, or
the first time we measure it and cached.  But this would still take the
same large amount of CPU time, we'd just be able to avoid taking it more
than once.  And if we did it lazily and cached it, it would still take a
lot of time in profiles, especially the first time a profile runs.

Signed-off-by: Ben Pfaff <blp@feldera.com>
@blp blp requested a review from ryzhyk April 6, 2026 18:03
@blp blp self-assigned this Apr 6, 2026
@blp blp added performance rust Pull requests that update Rust code user-reported Reported by a user or customer profiler Issues related to the profiler and it's APIs metrics Metrics about feldera pipelines labels Apr 6, 2026
@blp blp added this pull request to the merge queue Apr 6, 2026
Copy link
Copy Markdown

@mythical-fred mythical-fred left a comment

Choose a reason for hiding this comment

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

LGTM

Merged via the queue into main with commit 007bb8a Apr 6, 2026
1 check passed
@blp blp deleted the sizeof branch April 6, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metrics Metrics about feldera pipelines performance profiler Issues related to the profiler and it's APIs rust Pull requests that update Rust code user-reported Reported by a user or customer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants