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

feat: mutable barrier interval #8206

Closed
wants to merge 8 commits into from
Closed

Conversation

Gun9niR
Copy link
Contributor

@Gun9niR Gun9niR commented Feb 27, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

barrier_interval_ms is used in several places

  • Meta node
    • GlobalBarrierManager: schedule barrier
  • Compute
    • GlobalMemoryManager: check eviction every barrier_interval.
    • Executors: pause source
      • SourceExecutor
      • FsSourceExecutor

I have manually tested setting barrier interval to values ranging from 500ms to 30s, which seems to be working fine.

Checklist For Contributors

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • I have demonstrated that backward compatibility is not broken by breaking changes and created issues to track deprecated features to be removed in the future. (Please refer to the issue)
  • All checks passed in ./risedev check (or alias, ./risedev c)

Checklist For Reviewers

  • I have requested macro/micro-benchmarks as this PR can affect performance substantially, and the results are shown.

Documentation

  • My PR DOES NOT contain user-facing changes.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

@Gun9niR Gun9niR marked this pull request as draft February 27, 2023 10:14
@Gun9niR Gun9niR marked this pull request as ready for review February 28, 2023 07:01
@Gun9niR Gun9niR mentioned this pull request Feb 28, 2023
9 tasks
Copy link
Contributor

@xx01cyx xx01cyx left a comment

Choose a reason for hiding this comment

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

Generally LGTM.

Comment on lines +208 to +212
fn get_eviction_check_interval(params: &SystemParamsReaderRef) -> u64 {
// Arbitrarily set a minimal barrier interval in case it is too small,
// especially when it's 0.
std::cmp::max(params.load().barrier_interval_ms() as u64, 10)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

May we print a warning somewhere if the user sets a too-small barrier_interval_ms?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can check the value range on ALTER SYSTEM SET, the question is how small is too-small 🤣.

Comment on lines +120 to +131
select! {
// Barrier interval has changed.
Ok(_) = params_rx.changed() => {
let new_barrier_interval_ms = Self::get_eviction_check_interval(&params_rx.borrow());
if new_barrier_interval_ms != barrier_interval_ms
{
tick_interval = tokio::time::interval(Duration::from_millis(new_barrier_interval_ms));
barrier_interval_ms = new_barrier_interval_ms;
}
}
_ = tick_interval.tick() => {},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't change this. Make barrier interval too large may lead to oom.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shall we have another config for this interval?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that we should read barrier_interval_ms should come from system parameter and unify the access of it. But whether allowing changing it should be discussed, it may affect many components, such as memory management, and maybe storage. So I would prefer to disable changing it at first.

Copy link
Contributor

Choose a reason for hiding this comment

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

The eviction of the LRU cache (i.e. streaming memory control) actually still depends on barriers, so simply having another config for this checking interval may not help. If we do want to make barrier interval configurable, we should make sure our users know what they are doing (including the side effects). cc. @fuyufjh

@Gun9niR
Copy link
Contributor Author

Gun9niR commented Feb 28, 2023

As discussed offline, barrier interval should not be changed 🤣

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.

3 participants