-
Notifications
You must be signed in to change notification settings - Fork 242
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
Improve re connection to data endpoints based on configurable values. #817
Open
shilmyhasan
wants to merge
15
commits into
wso2:5.2.x
Choose a base branch
from
shilmyhasan:5.2.x-logginginterval
base: 5.2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit b35518ff55a021f36655e9e3c27a531055705994.
This reverts commit ec0af70719bb54c50e8af261924d83983d6856aa.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
resolves wso2/api-manager#407
Currently the re connection to a failed data endpoints run as a scheduled service with a configurable fixed time gap. This creates lot of logs when a data endpoint goes down in regular interval and create performance impacts while trying to re connect to a endpoint on same fixed intervals. This behavior has been improved to increase the delay between each failed connection attempt exponentially through configurable value to reduce the re connection overhead of a failed endpoint.
Implementation
This is implemented with three configurable properties namely ReConnectionInterval, ExpFacto, MaxReConnectionInterval. The delay between each failed attempt will be increased by ReConnectionInterval * ExpFactor till it reaches the MaxReconnectionInterval. Once it reaches the MaxReconnectionInterval , then every other failed re connection attempts will be executed after the MaxReconnectionInterval. If a connection attempt is succesfull when the data endpoint is running again, then the re connection interval will be re set to its old configured value.
Sample Configurations
[transport.binary.agent]
reconnection_interval = 30
exp_factor=2
max_reconnection_interval = 3600
Sample Behavior with the above configurations
Request attempts
1st failed connection attempt - Adds delay of (30*2) 60 seconds for the next attempt from the current time.
2nd failed connection attempt - Adds delay of (60*2) 120 seconds for the next attempt from the current time.
3rd failed connection attempt - Adds delay of (120*2) 240 secods for the next attempt from the current time.
4th succesffull connection attempt - Resets the delay to its old value and no connection attempt will be made unless the endpoints state changes to UNAVAIABLE.
Note : If someone needs to keep the old behavior to keep retrying in the fixed intervals , then exp_factor factor should be set to 1.