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(meta): add get back pressure RPC for UI dashboard #14790

Merged
merged 7 commits into from
Jan 25, 2024
Merged

Conversation

yufansong
Copy link
Member

@yufansong yufansong commented Jan 25, 2024

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

What's changed and what's your intention?

In #13830, we want to embedded a back pressure rate metrics for dashbaord UI. In this PR, I add a API to get the back pressure from all compute node to meta node.

But I still need to implement the calculation steps. The way to calculate the rate:

  1. Get the (previous) back pressure metrics 1 in time 1.
  2. Get the (current) back pressure metrics 2 in time 2. Do (metrics 2 - metrics 1)/(time2 - time1).
  3. Then make the current back pressure as the previous metrics and repeat step 1 and step 2 every 15 seconds.

In meta node, I didn't find a good way to do this crobjob, also not find a good place to storage the previous metrics in memory. May try to implement the logic in ui frontend or some place in meta in following PR.

Result:
If you deploy and request the http://127.0.0.1:5691/api/metrics/back_pressures, will get result:

{
    "backPressureInfos": [
        {
            "actorId": "8",
            "fragmentId": "2",
            "downstreamFragmentId": "1",
            "value": 483665.0
        },
        {
            "actorId": "15",
            "fragmentId": "4",
            "downstreamFragmentId": "3",
            "value": 239666.0
        },
        {
            "actorId": "7",
            "fragmentId": "2",
            "downstreamFragmentId": "1",
            "value": 317250.0
        },
        .....
    ]
}

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.

@yufansong yufansong changed the title feature(meta): add get back pressure RPC for UI dashboard feat(meta): add get back pressure RPC for UI dashboard Jan 25, 2024
Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

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

The rest LGTM

Comment on lines 111 to 113
string actor_id = 1;
string fragment_id = 2;
string downstream_fragment_id = 3;
Copy link
Member

Choose a reason for hiding this comment

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

The data types can be integers.

We use string in Prometheus because Prometheus require all labels to be string. But sicne this interface is particularly designed for back-pressire (as it's named BackPressureInfo), it's not that case.

@yufansong yufansong enabled auto-merge January 25, 2024 19:32
@yufansong yufansong added this pull request to the merge queue Jan 25, 2024
Merged via the queue into main with commit 57d0b0e Jan 25, 2024
28 of 29 checks passed
@yufansong yufansong deleted the yufan/dashboard branch January 25, 2024 20:40
Copy link
Member

@yezizp2012 yezizp2012 left a comment

Choose a reason for hiding this comment

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

Sorry for my late response.

src/meta/src/manager/cluster.rs Show resolved Hide resolved
src/meta/src/controller/cluster.rs Show resolved Hide resolved
Extension(srv): Extension<Service>,
) -> Result<Json<GetBackPressureResponse>> {
let back_pressure_infos = match &srv.metadata_manager {
MetadataManager::V1(mgr) => {
Copy link
Member

Choose a reason for hiding this comment

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

We can list all streaming worker nodes directly here by metadata manager, then we can call the RPC here and avoid to add interface for worker manager and controller.

.unwrap();
let mut back_pressure_infos: Vec<BackPressureInfo> = Vec::new();
for node in nodes {
let client = self.env.stream_client_pool().get(&node).await.unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

We can perform RPC calls concurrently.

src/meta/src/controller/cluster.rs Show resolved Hide resolved
@@ -112,6 +126,7 @@ service StreamService {
rpc InjectBarrier(InjectBarrierRequest) returns (InjectBarrierResponse);
rpc BarrierComplete(BarrierCompleteRequest) returns (BarrierCompleteResponse);
rpc WaitEpochCommit(WaitEpochCommitRequest) returns (WaitEpochCommitResponse);
rpc GetBackPressure(GetBackPressureRequest) returns (GetBackPressureResponse);
Copy link
Member

Choose a reason for hiding this comment

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

I believe it's better to put it in MonitorService.

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