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(streaming): adapt backfill rate limit according to barrier latency #16678

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

kwannoel
Copy link
Contributor

@kwannoel kwannoel commented May 10, 2024

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

What's changed and what's your intention?

WIP, I want to properly document the shortcomings first.

We implement the barebones tcp congestion control procedure, as indicated here by @chenzl25:

init_rate_limit = 1k

ssthresh: 50k

if rate_limit < ssthresh:
	rate_limit *= 2
else if rate_limit >= ssthresh:
	rate_limit += 1k


(barrier latency > target barrier latency upper bound) ~= Congestion point of network

if barrier latency > target barrier latency upper bound
	ssthresh = rate_limit / 2
	rate_limit = init_rate_limit
  • Show grafana monitoring results.
  • Add more scenarios: Join with Agg after, UDF high latency.
  • Include more description on the alternative solutions.
  • Add frontend support for setting adaptive rate limit.

We have a few test scenarios:

Amplification is medium x100

Backpressure can handle this case well. Adaptive Rate Limit does not have any discernible effect.

Amplification is high x500

Backpressure cannot handle this case, barrier latency fluctuates stably, but is relatively high.
Adaptive Rate Limit can sort of handle this case. The Rate Limit becomes 1, and barrier latency keeps low.
But ideally it can maintain at a higher rate instead of just 1..

Amplification is extremely high x10000

TODO

High barrier latency outside of the current job, in a different parallelism

TODO

Improvements

Perhaps fetch metrics from meta directly?

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@kwannoel kwannoel marked this pull request as draft May 10, 2024 03:06
@kwannoel kwannoel force-pushed the kwannoel/adaptive-rate-limit branch from a407270 to 07e0d11 Compare May 16, 2024 02:39
@kwannoel
Copy link
Contributor Author

kwannoel commented May 16, 2024

The default adaptive rate limit strategy doesn't work well when I test it with the high amplification case.

  1. The rate limit increases too fast (since it scales rate limit exponentially 2x).
  2. We cannot simply get "current barrier latency". The previous barrier may not have been collected yet.
  3. Even if we have threshold = 0, and we do linear increments, this linear increment of rate limit can also be too large (1000).

Then we end up having too high a rate limit due to 1 and 2. At that point, when adaptive rate limit kicks in, it's too slow as well, since its barrier latency is high (as rate limit is too high).
After we return to normalcy, threshold becomes 0, and the rate limit fluctuates between 1000, and the initial rate limit (1). At 1000, the rate limit is too high as well in amplification cases. Leading to high barrier latency still.

@kwannoel kwannoel force-pushed the kwannoel/adaptive-rate-limit branch from acc0499 to f4b560f Compare May 23, 2024 06:28
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.

None yet

1 participant