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(dashboard): add backpressure to the relation dependency graph #18280

Merged
merged 44 commits into from
Sep 20, 2024

Conversation

kwannoel
Copy link
Contributor

@kwannoel kwannoel commented Aug 27, 2024

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

What's changed and what's your intention?

Much of the code is borrowed from FragmentGraph and DependencyGraph components. Thanks for @xxchan and @BugenZhao who worked on that previously.

This PR adds a ddl level backpressure graph, to identify bottleneck MVs and Sinks in the stream graph.

Screenshot 2024-09-19 at 5 44 52 PM

From here, we can observe the specific fragment's backpressure graph by using the search box in the fragment graph page.

Screenshot 2024-09-19 at 5 10 07 PM Screenshot 2024-09-19 at 5 45 03 PM

We also add a resetBackPressure button. This is for resetting embedded backpressures. Otherwise if there's a long idle period, followed by a sudden surge, the backpressure graph will be shown to be uncongested, since the average backpressure will include the idle period. By resetting the backpressure graph, we can restart the computation of average backpressure from the current point in time, and get a more accurate visualization.

Screenshot 2024-09-19 at 5 10 23 PM

Implementation details

The graph has relations, identified by relationId as its vertices.
And the edges are backpressures between the relations.

To render the vertices, we fetch all relation metadata from the meta-node.
The relation metadata includes the relation_id, schema_name, relation_name, as well as the parentIds.
relation_id and parentIds will be used to render the relation DAG, since they form the vertices of the graph.

Next, to render the edges, we have to remap our fragment level backpressure edges to relation level backpressure edges.

First, we obtain a mapping of input fragmentId and output fragmentId to their relation's ids.
An input fragmentId corresponds to a fragment which contains stream scan for instance.
An output fragmentId corresponds to a materialize fragment.

Next, our backpressure info contains a mapping of fragmentId-fragmentId to backpressure values.
We can map output fragment id to its corresponding relation, and likewise for input fragment id.
If it doesn't exist, we know that the edge can be removed, since it doesn't correspond to a relation-relation edge, and is internal to the relation itself.
From this we obtain a new mapping of relationId-relationId to backpressure values. Then we can use this to construct our backpressure edges for the ddl backpressure graph.

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 changed the title Kwannoel/dag mv feat(dashboard): add ddl backpressure graph Sep 18, 2024
kwannoel and others added 7 commits September 19, 2024 18:07
Co-authored-by: Eric Fu <eric@singularity-data.com>
Co-authored-by: Eric Fu <eric@singularity-data.com>
@kwannoel kwannoel changed the title feat(dashboard): add ddl backpressure graph feat(dashboard): add relation backpressure graph Sep 19, 2024
@kwannoel
Copy link
Contributor Author

Screenshot 2024-09-19 at 9 45 51 PM

Merged both backpressure graph and dependency graph in the end.

Because there's certain design like:

  • Labelling what is the ddl type, so we know what kind of output to expect (or to even expect any output)
  • Accessing the fragments graph via the pop up.
  • Accessing the mv catalog.

Which is helpful in getting more info about the backpressure stream job.

@xxchan xxchan changed the title feat(dashboard): add relation backpressure graph feat(dashboard): add backpressure to the relation dependency graph Sep 19, 2024
Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

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

Thank you. The UI looks good! (Didn't check backpressure computation logic.

@kwannoel kwannoel added this pull request to the merge queue Sep 20, 2024
Merged via the queue into main with commit 8b0c5a3 Sep 20, 2024
32 of 33 checks passed
@kwannoel kwannoel deleted the kwannoel/dag-mv branch September 20, 2024 03:33
github-actions bot pushed a commit that referenced this pull request Sep 20, 2024
github-merge-queue bot pushed a commit that referenced this pull request Sep 20, 2024
…18280) (#18611)

Co-authored-by: Noel Kwan <47273164+kwannoel@users.noreply.github.com>
Co-authored-by: Eric Fu <eric@singularity-data.com>
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.

4 participants