Skip to content

[#333] feat: expose metrics of TOP10 app bytes in one shuffle server - #1400

Merged
zuston merged 39 commits into
apache:masterfrom
lifeSo:feature_333_expose_app_metrics
Jan 12, 2024
Merged

[#333] feat: expose metrics of TOP10 app bytes in one shuffle server#1400
zuston merged 39 commits into
apache:masterfrom
lifeSo:feature_333_expose_app_metrics

Conversation

@lifeSo

@lifeSo lifeSo commented Dec 27, 2023

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

expose metrics of TOP10 app bytes in one shuffle server #333

Why are the changes needed?

Fix:
#333
#681

Does this PR introduce any user-facing change?

No.

How was this patch tested?

unit test

@lifeSo
lifeSo requested a review from zuston December 28, 2023 04:48
@codecov-commenter

codecov-commenter commented Dec 28, 2023

Copy link
Copy Markdown

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (0630dc5) 53.39% compared to head (84ab744) 55.16%.

Files Patch % Lines
...org/apache/uniffle/server/ShuffleFlushManager.java 72.72% 2 Missing and 1 partial ⚠️
.../java/org/apache/uniffle/server/ShuffleServer.java 50.00% 0 Missing and 1 partial ⚠️
...ava/org/apache/uniffle/server/ShuffleTaskInfo.java 92.30% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1400      +/-   ##
============================================
+ Coverage     53.39%   55.16%   +1.77%     
- Complexity     2730     2773      +43     
============================================
  Files           422      403      -19     
  Lines         24052    21817    -2235     
  Branches       2051     2057       +6     
============================================
- Hits          12842    12035     -807     
+ Misses        10410     9044    -1366     
+ Partials        800      738      -62     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lifeSo
lifeSo marked this pull request as ready for review December 29, 2023 00:36
@roryqi roryqi changed the title [#333 ] feat: expose metrics of TOP10 app bytes in one shuffle server #333 [#333 ] feat: expose metrics of TOP10 app bytes in one shuffle server Dec 29, 2023
@lifeSo lifeSo changed the title [#333 ] feat: expose metrics of TOP10 app bytes in one shuffle server [#333] feat: expose metrics of TOP10 app bytes in one shuffle server Dec 29, 2023
@zuston

zuston commented Dec 29, 2023

Copy link
Copy Markdown
Member

I think I will review this in the next monday

if (executorService != null) {
executorService.shutdownNow();
}
shuffleTaskManager.stop();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if the shuffleTaskManager is not identified as final, you should check null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

shuffleTaskManager is assigned in constructor and initialization() method.
I added the null check to make code more robustness

private StorageManager storageManager;
private HealthCheck healthCheck;
private Set<String> tags = Sets.newHashSet();
private final Set<String> tags = Sets.newHashSet();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why changing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is IDEA tips and want to make code better, so I changed it.
image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Finally, I reverted the changes.

+ "Default is 0, OS will dynamically adjust the buf size.");

public static final ConfigOption<Integer> SERVER_SHUFFLE_DATA_METRIC_TOP_NUMBER =
ConfigOptions.key("rss.server.shuffle.data.metric.top.number")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The name is not accurate, what's the shuffle data metric? I think here you want to expose the topN of app level total shuffle size.

@lifeSo lifeSo Jan 4, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I changed the code like this:

  public static final ConfigOption<Integer> SERVER_SHUFFLE_DATA_METRIC_TOP_NUMBER =
      ConfigOptions.key("rss.server.shuffle.data.metric.top.number")
          .intType()
          .defaultValue(10)
          .withDescription(
              "size of topN when calc max shuffle data in memory、on disk、remote HDFS or total.");

  public static final ConfigOption<Integer> SERVER_SHUFFLE_DATA_METRIC_REFRESH_INTERVAL =
      ConfigOptions.key("rss.server.shuffle.data.metric.refresh.interval")
          .intType()
          .defaultValue(1000)
          .withDescription("Shuffle data metric refresh interval in ms");

"size of topN when calc max shuffle data in memory、on disk、remote HDFS or total.");

public static final ConfigOption<Integer> SERVER_SHUFFLE_DATA_METRIC_REFRESH_INTERVAL =
ConfigOptions.key("rss.server.shuffle.data.metric.refresh.interval")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I changed it.

private static final String TOTAL_REMOVE_RESOURCE_BY_SHUFFLE_IDS_TIME =
"total_remove_resource_by_shuffle_ids_time";

private static final String TOP_N_TOTAL_SHUFFLE_DATA = "top_N_total_shuffle_data";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this all metrics newly introduced are not consistent with their names.

I think the

topN_of_total_data_size_for_app
topN_of_on_memory_data_size_for_app
topN_of_on_localfile_data_size_for_app
topN_of_on_hadoop_data_size_for_app

How about this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure these metrics are about app?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this metric is from ShuffleTaskManager.shuffleTaskInfos, it maintain the app level shuffle data size info.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this all metrics newly introduced are not consistent with their names.

I think the

topN_of_total_data_size_for_app topN_of_on_memory_data_size_for_app topN_of_on_localfile_data_size_for_app topN_of_on_hadoop_data_size_for_app

How about this?

Ok, I change to it. it is more clear

@lifeSo lifeSo Jan 7, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How about change 'on memory' to 'in memory', for there is no 'on memory'.

image
image

private final AtomicLong totalDataSize = new AtomicLong(0);
private final AtomicLong totalDataSizeInMemory = new AtomicLong(0);
private final AtomicLong totalDataSizeOnDisk = new AtomicLong(0);
private final AtomicLong totalDataSizeRemote = new AtomicLong(0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remote is not accurate. I hope the naming should be careful, hadoop is more accurate

@lifeSo lifeSo Jan 2, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

change to hadoop is ok and I changed, but if use obs file system.

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ShuffleDataExporterTask {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The class name is not accurate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I changed to TopNShuffleDataSizeOfAppCalcTask

@lifeSo
lifeSo requested a review from zuston January 3, 2024 08:26

@zuston zuston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please attach the metrics shown in the prometheus. And the tests cases are needed.

.withDescription("size of TopN total shuffle data size of app level.");

public static final ConfigOption<Integer> TOP_N_SHUFFLE_DATA_SIZE_OF_APP_LEVEL_REFRESH_INTERVAL =
ConfigOptions.key("rss.server.topN.shuffle.data.size.of.app-level.refresh.interval")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about rss.server.topN.appShuffleDataSize.refresh.interval ?

@lifeSo lifeSo Jan 5, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How about this refer to: #1363 (comment)

rss.server.topN.appShuffleDataSize.refreshIntervalMs

And it depends on you.

+ "Default is 0, OS will dynamically adjust the buf size.");

public static final ConfigOption<Integer> TOP_N_SHUFFLE_DATA_SIZE_OF_APP_LEVEL =
ConfigOptions.key("rss.server.topN.shuffle.data.size.of.app-level")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about rss.server.topN.appShuffleDataSize.number ?

@lifeSo lifeSo Jan 5, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok, it is better.

.build();

startClearResourceThread();
memoryExporter =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

memoryExporter is not accurate. Please rename this.

@lifeSo lifeSo Jan 5, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok, I rename it to: topNShuffleDataSizeOfAppCalcTask, I think it should be ok.

Gauge.build()
.name(TOPN_OF_TOTAL_DATA_SIZE_FOR_APP)
.help("top N of total shuffle data size for app level")
.labelNames("topn_of_total_data_size_for_app")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the label name is wrong. If we hope this could be shown to find out the app and sorted number, these labels should be taken.

@lifeSo lifeSo Jan 5, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@zuston

This is the first initialization in setUpMetrics() in ShuffleServerMetrics.java, and to make gaugeDataSizeTotalUsage not be null.

The real metric cals is in incStorageSuccessCounter() in TopNShuffleDataSizeOfAppCalcTask.java.
eg:

List<Map.Entry<String, ShuffleTaskInfo>> topNTaskInfo = calcTopNTotalDataSizeTaskInfo();
    gaugeTotalDataSize.clear();
    for (Map.Entry<String, ShuffleTaskInfo> taskInfo : topNTaskInfo) {
      gaugeTotalDataSize.labels(taskInfo.getKey()).set(taskInfo.getValue().getTotalDataSize());
    }

In order to no make misunderstand, how about I delete the init and add null check ?

@lifeSo lifeSo Jan 5, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Or How about code:

  Gauge.build()
            .name(TOPN_OF_TOTAL_DATA_SIZE_FOR_APP)
            .help("top N of total shuffle data size for app level")
            .labelNames("")

labelNames is set to "".

Sorry, I tried this, and get error when run the code.

}
}

public List<Map.Entry<String, ShuffleTaskInfo>> calcTopNTotalDataSizeTaskInfo() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about putting these calcTopN methods into TopNShuffleDataSizeOfAppCalcTask

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I original want to encapsulate shuffleTaskInfos in ShuffleTaskManager.
If do as what you say, shuffleTaskInfos will be public through get method().

I will modify the code to your idea.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • When RSS is started and there is no app:
    img_v3_026r_2dfd70b4-c09c-4a4b-984a-c0d611ba3efg

  • when run some app:
    bf8a4289-fd09-4652-9d6d-029073e02e0f

451f24d8-b46d-4623-9778-7319e0288a53

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@lifeSo
lifeSo force-pushed the feature_333_expose_app_metrics branch 10 times, most recently from e38e518 to 39a2fc8 Compare January 7, 2024 14:58
@lifeSo
lifeSo force-pushed the feature_333_expose_app_metrics branch from 39a2fc8 to b039800 Compare January 7, 2024 15:03

@zuston zuston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall LGTM. Sorry for the later review @lifeSo

I only left the minor comment about the metrics label. Please help correct it. Thanks

Gauge.build()
.name(TOPN_OF_TOTAL_DATA_SIZE_FOR_APP)
.help("top N of total shuffle data size for app level")
.labelNames("TOPN_OF_TOTAL_DATA_SIZE_FOR_APP")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

rename to app_id

Gauge.build()
.name(TOPN_OF_IN_MEMORY_DATA_SIZE_FOR_APP)
.help("top N of in memory shuffle data size for app level")
.labelNames("TOPN_OF_IN_MEMORY_DATA_SIZE_FOR_APP")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

Gauge.build()
.name(TOPN_OF_ON_LOCALFILE_DATA_SIZE_FOR_APP)
.help("top N of on disk shuffle data size for app level")
.labelNames("TOPN_OF_ON_LOCALFILE_DATA_SIZE_FOR_APP")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

Gauge.build()
.name(TOPN_OF_ON_HADOOP_DATA_SIZE_FOR_APP)
.help("top N of on hadoop shuffle data size for app level")
.labelNames("TOPN_OF_ON_HADOOP_DATA_SIZE_FOR_APP")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

@lifeSo
lifeSo force-pushed the feature_333_expose_app_metrics branch from a998b80 to d17d1a4 Compare January 12, 2024 04:32

@zuston zuston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks @lifeSo

@zuston
zuston merged commit b43bbd8 into apache:master Jan 12, 2024
zuston pushed a commit to zuston/incubator-uniffle that referenced this pull request Jan 18, 2024
…uffle server (apache#1400)

expose metrics of TOP10 app bytes in one shuffle server apache#333

Fix:
apache#333
apache#681

No.

unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants