-
Notifications
You must be signed in to change notification settings - Fork 5k
[Improvement-17157][Master] Support setting max.concurrent.workflow.instances #17159
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
[Improvement-17157][Master] Support setting max.concurrent.workflow.instances #17159
Conversation
|
ruanwenjun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and it's better to expose the activeWorkflowInstanceCount in MasterHeartBeat.
...c/main/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtection.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtection.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtection.java
Outdated
Show resolved
Hide resolved
|
Can anyone review the changes again |
...c/main/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtection.java
Outdated
Show resolved
Hide resolved
| @PostConstruct | ||
| public void init() { | ||
| MasterServerLoadProtection serverLoadProtection = masterConfig.getServerLoadProtection(); | ||
| serverLoadProtection.setWorkflowRepository(workflowRepository); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to inject at the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this resolved? Why mark this as resolved?
...c/main/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtection.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new configuration option "max.concurrent.workflow.instances" to limit the number of concurrently running workflow instances on a single master. Key changes include adding a new property in the YAML configuration, updating MasterServerLoadProtection to use IWorkflowRepository for counting workflow instances, and incorporating tests to verify overload behavior.
- Added test cases in MasterServerLoadProtectionTest.java to validate overload conditions.
- Updated MasterServerLoadProtection.java to enforce the new concurrent workflow limit.
- Modified MasterServerLoadProtectionConfig.java to inject the IWorkflowRepository dependency.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtectionTest.java | Added test cases for the overload behavior with the new configuration option. |
| dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtectionConfig.java | Updated to inject IWorkflowRepository into the load protection component. |
| dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtection.java | Integrated the new "max.concurrent.workflow.instances" property checking and logging for overload conditions. |
Comments suppressed due to low confidence (1)
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/config/MasterServerLoadProtection.java:52
- [nitpick] The log message contains a minor typo with 'over then' which could be corrected to 'exceeds' for better clarity.
log.info("OverLoad: the workflow instance count: {} is over then the maxConcurrentWorkflowInstances {}", currentWorkflowInstanceCount, maxConcurrentWorkflowInstances);
|
Please solve the code check style by |
|
I wanted to let you know that I'm currently traveling. Because of this, I might be a bit delayed in addressing the feedback on this pull request. I will definitely get to it as soon as things settle down for me. |
Code style issues have been fixed by running mvn spotless:apply. Please let me know if there's anything else I can do! |
0e05e2b to
8b5361f
Compare
ruanwenjun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bd4d946 to
4fdac71
Compare
| @Bean | ||
| public MasterServerLoadProtection masterServerLoadProtection( | ||
| IWorkflowRepository workflowRepository, | ||
| @Value("${master.server-load-protection.max-concurrent-workflow-instances:2147483647}") int maxConcurrentWorkflowInstances) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add this config in doc, and you need to set other fields in MasterServerLoadProtection, e.g. maxSystemCpuUsagePercentageThresholds, maxJvmCpuUsagePercentageThresholds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add this config in doc, and you need to set other fields in MasterServerLoadProtection, e.g.
maxSystemCpuUsagePercentageThresholds,maxJvmCpuUsagePercentageThresholds.
Thanks for the feedback! I’ll get to it as soon as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. I will update it within 1-2 days.
4fdac71 to
3f0ec17
Compare
Okay, I'll check it out. |
5fa60cd
|
I've reviewed the logs, and the "Backend-Build" error appears unrelated to my changes. Could someone please help me with this? |
apply mvn spotless:apply
- Refactored MasterServerLoadProtection to require IWorkflowRepository and maxConcurrentWorkflowInstances via constructor injection. - Updated MasterServerLoadProtectionConfig to provide these dependencies using Spring @bean and @value with a default of 2147483647. - Removed direct instantiation of MasterServerLoadProtection in MasterConfig to avoid missing constructor arguments.
…onTest Stub IWorkflowRepository mock in tests to prevent NullPointerException when checking server load.
…terServerLoadProtection - Updated Spring test configuration in MasterConfigTest to properly autowire MasterServerLoadProtection and its dependencies. - Added mock bean for IWorkflowRepository in tests. - Provided test property overrides for load protection thresholds.
2ebd911 to
2aedb46
Compare
|
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
ruanwenjun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
SbloodyS
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1



Purpose of the pull request
This Pull Request implements a new configuration option
max.concurrent.workflow.instancesin the master server, allowing administrators to set a limit on the number of concurrently running workflow instances on a single master. This addresses the issue of potential overload when multiple workflows failover to a single master, as described in #17157.close #17157
Brief change log
Feature: Implemented a new configuration property,
master.server-load-protection.max-concurrent-workflow-instances, to limit concurrent workflows. The master is marked as busy if the number of running workflows is greater than or equal to this value.Enhancement: Refactored
MasterServerLoadProtectionto incorporate system resource thresholds based on community feedback. The following configuration properties are now utilized to provide a more robust server protection mechanism:maxSystemCpuUsagePercentageThresholdsmaxJvmCpuUsagePercentageThresholdsmaxSystemMemoryUsagePercentageThresholdsmaxDiskUsagePercentageThresholdsBug Fix: Resolved a
NullPointerExceptionthat occurred during MasterServer startup by correctly using@Autowiredto inject theMasterServerLoadProtectionbean intoMasterConfig.Refactor:
MasterServerLoadProtectionConfigto manage the bean's lifecycle and properties via Spring.WorkflowCacheRepositorywith theIWorkflowRepositoryinterface for better abstraction and testability.Documentation: Updated the
application.ymlfile and theconfiguration.mdcontributor documentation to include all new load protection options with clear descriptions. Example:Replace 100 with any integer value you want as the limit.
Verify this pull request
This change is covered by updated unit tests in
MasterServerLoadProtectionTest.javato include comprehensive test cases verifying the new functionality for both the workflow instance limit and the system resource thresholds:isOverloadWithMaxConcurrentWorkflowInstances) verifies the new limit:fix issue: [Improvement][Master] Support set max.concurrent.workflow.instances in master #17157
Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md