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

Add basic thorttler/exponential backoff policy for retry/Defination o… #3527

Merged
merged 12 commits into from
Jul 11, 2022

Conversation

dhwanilpatel
Copy link
Contributor

Add basic thorttler/exponential backoff policy for retry/Defination of throttling exception

Signed-off-by: Dhwanil Patel dhwanip@amazon.com

Description

This is one of multiple PR planned for master task throttling. In this PR we are introducing couple of new classes required for upcoming PRs.

New class/Method introduced in this PR:
Throttler : Base class for Throttling logic. It provides throttling functionality over multiple keys.
ExponentialBackOffPolicy : It provides exponential backoff between retries until it reaches maxDelay. It uses equal jitter scheme as it is being used for throttled exceptions. It will make random distribution and also guarantees a minimum delay.
AdjustableSemaphore: AdjustableSemaphore is Extended Semphore where we can change maxPermits.
MasterTaskThrottlingException : new Throttling Exception which will be thrown from master node whenever it throttles any tasks.

Issues Resolved

Relates to : #479

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…f throttling exception

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
@dhwanilpatel dhwanilpatel requested review from a team and reta as code owners June 7, 2022 10:05
@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 95e55e5
Log 5817

Reports 5817

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success bc32248
Log 6106

Reports 6106

Comment on lines 102 to 105
for (T key : semaphores.keySet()) {
semaphores.put(key, new AdjustableSemaphore(semaphores.get(key).getMaxPermits(), true));
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should have the constructor intialize the semaphore with the desired permits

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you please elaborate more on it? We are passing the desired permits in constructor of Semaphore itslef.

Comment on lines 243 to 246
private ExponentialEqualJitterBackoffIterator(int baseDelay, int maxDelay) {
this.baseDelay = baseDelay;
this.maxDelay = maxDelay;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we have max retry in the constructor?

Copy link
Contributor Author

@dhwanilpatel dhwanilpatel Jun 22, 2022

Choose a reason for hiding this comment

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

No we dont want max retry for this policy. This policy will eventually perform infinite retries with exponential backoff.

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2022

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2022

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2022

Gradle Check (Jenkins) Run Completed with:

…' into throttling-pr-1

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
@dhwanilpatel
Copy link
Contributor Author

@dblock / @reta My latest build(https://build.ci.opensearch.org/job/gradle-check/372/) was failing due to this bug. (#3838).

Since the fix is merged in main branch, I am rebasing my PR against latest main branch.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@dhwanilpatel
Copy link
Contributor Author

@dblock / @reta Since build has passed, can you please help rebase the feature branch (https://github.com/opensearch-project/OpenSearch/tree/feature/master-task-throttling) with latest fix (since it is behind couple commit from main), and then merge this PR into feature branch.

Thanks in Advance!!

@reta
Copy link
Collaborator

reta commented Jul 11, 2022

@dblock / @reta Since build has passed, can you please help rebase the feature branch (https://github.com/opensearch-project/OpenSearch/tree/feature/master-task-throttling) with latest fix (since it is behind couple commit from main), and then merge this PR into feature branch.

@dhwanilpatel Sadly I cannot push to origin branches, we could open the pull request against it to bring latest changes from main, for example.

@dhwanilpatel
Copy link
Contributor Author

Sure @reta, I have created PR for rebasing feature branch with main to pull the latest changes. Please check it and merge.

#3843

@dblock dblock merged commit b8db5bf into opensearch-project:main Jul 11, 2022
@dblock
Copy link
Member

dblock commented Jul 11, 2022

Did I hit merge on the wrong PR? I was supposed to merge #3843?

dblock added a commit that referenced this pull request Jul 11, 2022
…nation o… (#3527)"

This reverts commit b8db5bf.

Signed-off-by: Daniel (dB.) Doubrovkine <dblock@amazon.com>
dblock added a commit that referenced this pull request Jul 11, 2022
…nation o… (#3527)" (#3852)

This reverts commit b8db5bf.

Signed-off-by: Daniel (dB.) Doubrovkine <dblock@amazon.com>
@dblock
Copy link
Member

dblock commented Jul 11, 2022

@dhwanilpatel Please reopen a PR onto feature/master-task-throttling. In general I think we don't need to rebase feature branches, you can just make merge commits as you see fit.

@dhwanilpatel
Copy link
Contributor Author

@reta / @dblock Created the PR against feature/master-task-throttling.

New PR: #3856.

Bukhtawar pushed a commit that referenced this pull request Nov 4, 2022
Basic Throttler Framework / Exponential Basic back off policy. 
Add basic thorttler/exponential backoff policy for retry/Defination o… #3527
Changes required in Master node to perform throttling.
Master node changes for master task throttling #3882
Changes required in Data node to perform retry on throttling.
Data node changes for master task throttling #4204
Provide support for all task type in throttling framework.
Onboarding of few task types to throttling #4542
Integration Tests (Fix timeout exception and Add Integ test for Master task throttling #4588

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
dhwanilpatel added a commit to dhwanilpatel/OpenSearch-1 that referenced this pull request Nov 4, 2022
…t#4986)

Basic Throttler Framework / Exponential Basic back off policy.
Add basic thorttler/exponential backoff policy for retry/Defination o… opensearch-project#3527
Changes required in Master node to perform throttling.
Master node changes for master task throttling opensearch-project#3882
Changes required in Data node to perform retry on throttling.
Data node changes for master task throttling opensearch-project#4204
Provide support for all task type in throttling framework.
Onboarding of few task types to throttling opensearch-project#4542
Integration Tests (Fix timeout exception and Add Integ test for Master task throttling opensearch-project#4588

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
dhwanilpatel added a commit to dhwanilpatel/OpenSearch-1 that referenced this pull request Nov 4, 2022
…t#4986)

Basic Throttler Framework / Exponential Basic back off policy.
Add basic thorttler/exponential backoff policy for retry/Defination o… opensearch-project#3527
Changes required in Master node to perform throttling.
Master node changes for master task throttling opensearch-project#3882
Changes required in Data node to perform retry on throttling.
Data node changes for master task throttling opensearch-project#4204
Provide support for all task type in throttling framework.
Onboarding of few task types to throttling opensearch-project#4542
Integration Tests (Fix timeout exception and Add Integ test for Master task throttling opensearch-project#4588

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
dhwanilpatel added a commit to dhwanilpatel/OpenSearch-1 that referenced this pull request Nov 4, 2022
…t#4986)

Basic Throttler Framework / Exponential Basic back off policy.
Add basic thorttler/exponential backoff policy for retry/Defination o… opensearch-project#3527
Changes required in Master node to perform throttling.
Master node changes for master task throttling opensearch-project#3882
Changes required in Data node to perform retry on throttling.
Data node changes for master task throttling opensearch-project#4204
Provide support for all task type in throttling framework.
Onboarding of few task types to throttling opensearch-project#4542
Integration Tests (Fix timeout exception and Add Integ test for Master task throttling opensearch-project#4588

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
dhwanilpatel added a commit to dhwanilpatel/OpenSearch-1 that referenced this pull request Nov 4, 2022
…t#4986)

Basic Throttler Framework / Exponential Basic back off policy.
Add basic thorttler/exponential backoff policy for retry/Defination o… opensearch-project#3527
Changes required in Master node to perform throttling.
Master node changes for master task throttling opensearch-project#3882
Changes required in Data node to perform retry on throttling.
Data node changes for master task throttling opensearch-project#4204
Provide support for all task type in throttling framework.
Onboarding of few task types to throttling opensearch-project#4542
Integration Tests (Fix timeout exception and Add Integ test for Master task throttling opensearch-project#4588

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
dhwanilpatel added a commit to dhwanilpatel/OpenSearch-1 that referenced this pull request Nov 4, 2022
…t#4986)

Basic Throttler Framework / Exponential Basic back off policy.
Add basic thorttler/exponential backoff policy for retry/Defination o… opensearch-project#3527
Changes required in Master node to perform throttling.
Master node changes for master task throttling opensearch-project#3882
Changes required in Data node to perform retry on throttling.
Data node changes for master task throttling opensearch-project#4204
Provide support for all task type in throttling framework.
Onboarding of few task types to throttling opensearch-project#4542
Integration Tests (Fix timeout exception and Add Integ test for Master task throttling opensearch-project#4588

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
dhwanilpatel added a commit to dhwanilpatel/OpenSearch-1 that referenced this pull request Nov 4, 2022
…t#4986)

Basic Throttler Framework / Exponential Basic back off policy.
Add basic thorttler/exponential backoff policy for retry/Defination o… opensearch-project#3527
Changes required in Master node to perform throttling.
Master node changes for master task throttling opensearch-project#3882
Changes required in Data node to perform retry on throttling.
Data node changes for master task throttling opensearch-project#4204
Provide support for all task type in throttling framework.
Onboarding of few task types to throttling opensearch-project#4542
Integration Tests (Fix timeout exception and Add Integ test for Master task throttling opensearch-project#4588

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
Bukhtawar pushed a commit that referenced this pull request Nov 4, 2022
Basic Throttler Framework / Exponential Basic back off policy.
Add basic thorttler/exponential backoff policy for retry/Defination o… #3527
Changes required in Master node to perform throttling.
Master node changes for master task throttling #3882
Changes required in Data node to perform retry on throttling.
Data node changes for master task throttling #4204
Provide support for all task type in throttling framework.
Onboarding of few task types to throttling #4542
Integration Tests (Fix timeout exception and Add Integ test for Master task throttling #4588

Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
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.

9 participants