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

[EventHubs] Provide an linear(fixed) backoff option for retry #8670

Closed
annatisch opened this issue Nov 15, 2019 · 5 comments · Fixed by #21884
Closed

[EventHubs] Provide an linear(fixed) backoff option for retry #8670

annatisch opened this issue Nov 15, 2019 · 5 comments · Fixed by #21884
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs help wanted This issue is tracking work for which community contributions would be welcomed and appreciated Messaging Messaging crew MQ This issue is part of a "milestone of quality" initiative. P0

Comments

@annatisch
Copy link
Member

annatisch commented Nov 15, 2019

Feature Wanted:

We need to add support for Fixed(Linear) retry backoff in EventHubs. EventHub needs to implement its own retry as it's based on amqp protocol so we can't simply reuse the azure-core which is http-based. However, the design of retry is almost the same.

Currently EH only supports exponential back off mode, and it takes three retry related key-word arguments when constructing the EventHubProducerClient/EventHubConsumerClient -- retry_backoff_factor, retry_backoff_max, retry_total.

As per azure-core:

class RetryPolicy(HTTPPolicy):
"""A retry policy.
The retry policy in the pipeline can be configured directly, or tweaked on a per-call basis.
:keyword int retry_total: Total number of retries to allow. Takes precedence over other counts.
Default value is 10.
:keyword int retry_connect: How many connection-related errors to retry on.
These are errors raised before the request is sent to the remote server,
which we assume has not triggered the server to process the request. Default value is 3.
:keyword int retry_read: How many times to retry on read errors.
These errors are raised after the request was sent to the server, so the
request may have side-effects. Default value is 3.
:keyword int retry_status: How many times to retry on bad status codes. Default value is 3.
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
(most errors are resolved immediately by a second try without a delay).
In fixed mode, retry policy will alwasy sleep for {backoff factor}.
In 'exponential' mode, retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))`
seconds. If the backoff_factor is 0.1, then the retry will sleep
for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8.
:keyword int retry_backoff_max: The maximum back off time. Default value is 120 seconds (2 minutes).
:keyword RetryMode retry_mode: Fixed or exponential delay between attemps, default is exponential.
:keyword int timeout: Timeout setting for the operation in seconds, default is 604800s (7 days).

Action items:

  1. Need to define the enum type RetryMode under azure.eventhub namespace -- azure.eventhub.RetryMode
    https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/azure/core/pipeline/policies/_retry.py#L52-L54
class RetryMode(str, Enum):
    Exponential = 'exponential'
    Fixed = 'fixed'
  1. EventHubProducerClient/EventHubConsumerClient (and async) constructors and the helper method from_connection_string should take "retry_mode" as a key-word argument and the default value shall be Exponential (non-breaking change), see configuration and how the configuration could be used internally.

  2. Update the def _backoff and the async version to backoff according to the given retry mode.

  3. Test and docstring

@annatisch annatisch added Event Hubs Client This issue points to a problem in the data-plane of the library. labels Nov 15, 2019
@annatisch annatisch mentioned this issue Nov 15, 2019
2 tasks
@yunhaoling yunhaoling added the help wanted This issue is tracking work for which community contributions would be welcomed and appreciated label Jan 16, 2020
openapi-sdkautomation bot referenced this issue in AzureSDKAutomation/azure-sdk-for-python Mar 11, 2020
#0 FQDN support for LocalNetworkGateway and VpnSiteLinks (#8670)

Co-authored-by: Amit Kumar Nanda <[email protected]>
openapi-sdkautomation bot referenced this issue in AzureSDKAutomation/azure-sdk-for-python Mar 11, 2020
#0 FQDN support for LocalNetworkGateway and VpnSiteLinks (#8670)

Co-authored-by: Amit Kumar Nanda <[email protected]>
openapi-sdkautomation bot referenced this issue in AzureSDKAutomation/azure-sdk-for-python Mar 11, 2020
#0 FQDN support for LocalNetworkGateway and VpnSiteLinks (#8670)

Co-authored-by: Amit Kumar Nanda <[email protected]>
@Hanse00
Copy link

Hanse00 commented May 15, 2020

Can we get some more detail on this? I understand the concept of a backoff option, but if you intend for this to be a good first issue, the contributor will need a bit of background.

@jmonty42
Copy link
Contributor

jmonty42 commented Oct 2, 2020

I see that there is a fixed option and an exponential option for retries. Would a linear option simply be adding the back_off value each time?

jmonty42 pushed a commit to jmonty42/azure-sdk-for-python that referenced this issue Oct 2, 2020
@yunhaoling yunhaoling changed the title [EventHubs] Provide an linear backoff option for retry [EventHubs] Provide an linear(fixed) backoff option for retry Oct 6, 2020
@yunhaoling
Copy link
Contributor

hey @jmonty42 , thanks for your help. Fixed retry is equal to liner retry.

sorry about not mentioning any background knowledge before, and I just added more description in the context. Hope it would be clear to you know and feel free to ping me if you need more input.

and apologize to @Hanse00 as well, I truthfully forget the issue here, I wish you were still interested in getting it resolved😊

@Hanse00
Copy link

Hanse00 commented Oct 7, 2020

@yunhaoling Not a problem, I'm happy to have been able to highlight an issue that needed some help. The first step to allowing people to help us in open source, is making sure we give them the tools and information they need to help 😄

I might be interested in taking a stab at this myself if nobody else does, I'll need to get around to it when I'm a little less busy at work.

@jmonty42
Copy link
Contributor

jmonty42 commented Oct 7, 2020

@yunhaoling, alright, thanks for the clarification, I will close my PR since it doesn't address the issue now. I'll take a closer look at the updated requirements to see if I could take a crack at that.

@lmazuel lmazuel added the Messaging Messaging crew label Apr 12, 2021
@yunhaoling yunhaoling added MQ This issue is part of a "milestone of quality" initiative. and removed MQ This issue is part of a "milestone of quality" initiative. labels Oct 5, 2021
@lmazuel lmazuel added the MQ This issue is part of a "milestone of quality" initiative. label Oct 5, 2021
@lmazuel lmazuel added this to the [2021] December milestone Oct 5, 2021
@yunhaoling yunhaoling assigned swathipil and unassigned yunhaoling Nov 16, 2021
@yunhaoling yunhaoling added the P0 label Nov 16, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs help wanted This issue is tracking work for which community contributions would be welcomed and appreciated Messaging Messaging crew MQ This issue is part of a "milestone of quality" initiative. P0
Projects
None yet
6 participants