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

[compaction]Add local sample config for sort compaction #3081

Merged

Conversation

wg1026688210
Copy link
Contributor

@wg1026688210 wg1026688210 commented Mar 23, 2024

Purpose

Add local sample config for sort compaction . It' helpful for the sort compaction task with large parallelism,which sampling may lead to a performance bottleneck.

Copy link
Contributor

@leaves12138 leaves12138 left a comment

Choose a reason for hiding this comment

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

Thanks for @wg1026688210, left some comment

options.getLocalSampleSize().orElseGet(() -> sinkParallelism * 1000);
final int globalSampleSize =
options.getGlobalSampleSize().orElseGet(() -> sinkParallelism * 1000);
final int rangeNum = options.getSortRange().orElseGet(() -> sinkParallelism * 10);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is no need to make localSampleSize and globalSampleSize different, if you want a performance improvement when parallelism is large, just add one parameter of sampleSize option. 20 or 2000 times, default 1000. rangeNum still sinkParallelism * 10.

@wg1026688210
Copy link
Contributor Author

@leaves12138 cc

Copy link
Contributor

@leaves12138 leaves12138 left a comment

Choose a reason for hiding this comment

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

Thanks for @wg1026688210 , left one comment.

.intType()
.noDefaultValue()
.withDescription(
"The size of local sample for sort-compaction.By default,the value is the sink parallelism * 1000.");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the parameter could be magnification. int localSampleSize = parallelism * magnification. magnification should be greater than or equal to 20

@@ -1056,6 +1056,12 @@ public class CoreOptions implements Serializable {
+ "If the data size allocated for the sorting task is uneven,which may lead to performance bottlenecks, "
+ "the config can be set to size.");

public static final ConfigOption<Integer> SORT_COMPACTION_LOCAL_SAMPLE_SIZE =
Copy link
Contributor

Choose a reason for hiding this comment

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

SORT_COMPACTION_SAMPLE_MAGNIFICATION

final int rangeNum = sinkParallelism * 10;

if (localSampleSize < 20) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if(localSampleSignification < 20) throws

@@ -99,9 +99,18 @@ public static <KEY> DataStream<RowData> sortStreamByKey(
"The adaptive batch scheduler is not supported. Please set the sink parallelism using the key: "
+ FlinkConnectorOptions.SINK_PARALLELISM.key());
}
final int sampleSize = sinkParallelism * 1000;
final int localSampleSize =
Copy link
Contributor

Choose a reason for hiding this comment

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

localSampleSize = sinkParallelism * sampleSignification

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done~

@wg1026688210 wg1026688210 changed the title [compaction]Add sample size and range config for sort compaction [compaction]Add local sample config for sort compaction Mar 27, 2024
@wg1026688210
Copy link
Contributor Author

@leaves12138 PHAL~

@wg1026688210 wg1026688210 force-pushed the sort_compaction/add_sample_config branch from 17e242f to 032a0e6 Compare March 27, 2024 08:09
Copy link
Contributor

@leaves12138 leaves12138 left a comment

Choose a reason for hiding this comment

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

+1

@leaves12138 leaves12138 merged commit 6921d41 into apache:master Apr 2, 2024
10 checks passed
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.

2 participants