Skip to content

[rust][writer] Add DynamicWriteBatchSizeEstimator#532

Merged
fresh-borzoni merged 3 commits intoapache:mainfrom
fresh-borzoni:feat/dynamic-batch-size
May 10, 2026
Merged

[rust][writer] Add DynamicWriteBatchSizeEstimator#532
fresh-borzoni merged 3 commits intoapache:mainfrom
fresh-borzoni:feat/dynamic-batch-size

Conversation

@fresh-borzoni
Copy link
Copy Markdown
Member

@fresh-borzoni fresh-borzoni commented May 7, 2026

Summary

closes #445

Adds DynamicWriteBatchSizeEstimator, mirroring Java Fluss's per-table batch size tuning. When writer.dynamic-batch-size-enabled is on, each table's target grows 10% after a batch fills past 80% and shrinks 5% below 50%, clamped to [writer.batch-size-min, writer.batch-size].

Wired into the writer's allocation path: append reads the per-table target instead of the static writer_batch_size; drain feeds the actual size back. The estimator lives on BucketAndWriteBatches behind a parking_lot::Mutex - both touch points short-circuit on the config flag, so the disabled path locks nothing.

@fresh-borzoni
Copy link
Copy Markdown
Member Author

@leekeiabstraction @charlesdong1991 PTAL 🙏

Copy link
Copy Markdown
Contributor

@charlesdong1991 charlesdong1991 left a comment

Choose a reason for hiding this comment

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

Nice PR!! i left some thoughts! @fresh-borzoni PTAL 🙏

Comment thread crates/fluss/src/client/write/accumulator.rs Outdated
Comment thread crates/fluss/src/client/write/accumulator.rs Outdated
Comment thread website/docs/user-guide/cpp/api-reference.md Outdated
Comment thread crates/fluss/src/client/write/accumulator.rs Outdated
Comment thread crates/fluss/src/client/write/accumulator.rs
@fresh-borzoni fresh-borzoni force-pushed the feat/dynamic-batch-size branch from 540f5f5 to 8e330d7 Compare May 8, 2026 17:26
@fresh-borzoni fresh-borzoni force-pushed the feat/dynamic-batch-size branch from 8e330d7 to 04f5d58 Compare May 8, 2026 17:36
@fresh-borzoni
Copy link
Copy Markdown
Member Author

@charlesdong1991 Ty for the review, addressed, PTAL 🙏

Copy link
Copy Markdown
Contributor

@charlesdong1991 charlesdong1991 left a comment

Choose a reason for hiding this comment

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

Looks great! 👍

Can we create a follow-up issue to consider adding an integration test for this optimization?

@fresh-borzoni
Copy link
Copy Markdown
Member Author

Added an issue for integration tests: #539

@fresh-borzoni fresh-borzoni merged commit 3b9a0f3 into apache:main May 10, 2026
11 checks passed
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.

Implement DynamicWriteBatchSizeEstimator

2 participants