Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] limit tablet write request size #50302

Merged

Conversation

silverbullet233
Copy link
Contributor

@silverbullet233 silverbullet233 commented Aug 27, 2024

Why I'm doing:

When there are large chunks during the load process, the following error may be returned due to exceeding the size limit of protobuf.
img_v3_02e4_eddde0ab-db20-4044-99a3-d6c6a82baf6g

NodeChannel currently only aggregates batches based on the function of the chunk, but does not take into account the size of the chunk.
img_v3_02e4_9f4f7683-ef85-49db-b315-5a3647cb863g

What I'm doing:

In this PR, I have added chunk mem usage check to avoid generating large pb requests for load tasks

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

luohaha
luohaha previously approved these changes Sep 13, 2024
Signed-off-by: silverbullet233 <[email protected]>
auto req = _rpc_request.mutable_requests(0);
for (size_t i = 0; i < filter_size; ++i) {
req->add_tablet_ids(tablet_ids[filtered_indexes[from + i]]);
}
}

if (_cur_chunk->num_rows() < _runtime_state->chunk_size()) {
if (_cur_chunk->num_rows() < _runtime_state->chunk_size() &&
_cur_chunk_mem_usage < config::max_tablet_write_chunk_bytes) {
Copy link
Contributor

Choose a reason for hiding this comment

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

_cur_chunk->num_rows() <= 0 || (_cur_chunk->num_rows() < _runtime_state->chunk_size() && _cur_chunk_mem_usage < config::max_tablet_write_chunk_bytes) maybe better

Copy link
Contributor

Choose a reason for hiding this comment

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

clone_empty_with_slot maybe reserve some memory, there maybe no one row in chunk, but memory exceed the limit.

Signed-off-by: silverbullet233 <[email protected]>
luohaha
luohaha previously approved these changes Sep 18, 2024
@github-actions github-actions bot added the 3.2 label Sep 18, 2024
trueeyu
trueeyu previously approved these changes Sep 19, 2024
@silverbullet233 silverbullet233 enabled auto-merge (squash) September 19, 2024 02:08
Signed-off-by: silverbullet233 <[email protected]>
// NOTE: If there are a large number of columns when loading,
// a too small max_tablet_write_chunk_bytes may cause more frequent RPCs, which may affect performance.
// In this case, we can try to increase the value to avoid the problem.
CONF_mInt64(max_tablet_write_chunk_bytes, "536870912");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not keep the same size of protobuf limit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not keep the same size of protobuf limit?

Because this is not a hard limit, the chunk may exceed it. If it is set to 2GB, serialization will still fail once it exceeds the limit. 512MB is large enough for most scenarios.

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

fail : 0 / 24 (00.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exec/tablet_sink_index_channel.cpp 0 24 00.00% [418, 419, 420, 421, 422, 423, 425, 426, 427, 428, 429, 430, 440, 453, 462, 470, 471, 481, 502, 514, 523, 524, 534, 589]

@silverbullet233 silverbullet233 merged commit ce25287 into StarRocks:main Sep 19, 2024
55 of 56 checks passed
@silverbullet233 silverbullet233 deleted the limit_tablet_sink_request_size branch September 19, 2024 11:18
Copy link

@Mergifyio backport branch-3.3

Copy link

@Mergifyio backport branch-3.2

Copy link
Contributor

mergify bot commented Sep 19, 2024

backport branch-3.3

✅ Backports have been created

Copy link
Contributor

mergify bot commented Sep 19, 2024

backport branch-3.2

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 19, 2024
Signed-off-by: silverbullet233 <[email protected]>
(cherry picked from commit ce25287)
mergify bot pushed a commit that referenced this pull request Sep 19, 2024
Signed-off-by: silverbullet233 <[email protected]>
(cherry picked from commit ce25287)
wanpengfei-git pushed a commit that referenced this pull request Sep 19, 2024
wanpengfei-git pushed a commit that referenced this pull request Sep 19, 2024
@dengliu
Copy link
Contributor

dengliu commented Sep 19, 2024

Can we backport it to 3.2?
Thank you!

@silverbullet233
Copy link
Contributor Author

Can we backport it to 3.2? Thank you!

I think so, you can cherry-pick #51173 @dengliu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants