-
Notifications
You must be signed in to change notification settings - Fork 4.8k
[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
base: dev
Are you sure you want to change the base?
[Improvement-17157][Master] Support setting max.concurrent.workflow.instances #17159
Conversation
|
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
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.
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.
4fdac71
to
3f0ec17
Compare
Purpose of the pull request
This Pull Request implements a new configuration option
max.concurrent.workflow.instances
in 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
master.server-load-protection.max-concurrent-workflow-instances
inapplication.yaml
under the server-load-protection section. This property is optional and defaults to2147483647
(no limit) if not set. To set specific limit, Eg:master.server-load-protection.max-concurrent-workflow-instances=100 #Set your desired limit here
Replace 100 with any integer value you want as the limit.
MasterServerLoadProtection.java
to read and utilize the new configuration property.WorkflowCacheRepository
toIWorkflowRepository
for better abstraction and testability.MasterServerLoadProtection
to check the current count of running workflow instances against the configured limit.isOverload
method inMasterServerLoadProtection
to return true if the concurrent workflow instance count exceeds the configured maximum, marking the master as busy.MasterServerLoadProtectionConfig.java
to properly injectIWorkflowRepository
into theMasterServerLoadProtection
instance.MasterServerLoadProtectionTest.java
to include a test case verifying the new functionality where the master is marked as overloaded when the concurrent workflow instance count exceeds the configured limit.Verify this pull request
This change added tests and can be verified as follows:
MasterServerLoadProtectionTest.java
with a new test method (isOverloadWithMaxConcurrentWorkflowInstances
) to specifically test the behavior when the number of running workflow instances reaches or exceeds the configuredmax.concurrent.workflow.instances
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