How to use Exponential backoff in couchbase .net client 3.0.5

How to use inbuild Exponential backoff in .net client 3.0.5? It would be helpful is there is an example to use exponential backoff.

Are you talking about with the built in retries, or some situation where you do it yourself? What operation is this for?

A simple do-while loop with a variable and a sleep will let you do it externally. The while is your ceiling, the variable increments and you use it to sleep an exponent of the variable.

1 Like

I was mentioning about the exponential backoff available in Couchbase.Core.Retry. However, I have implemented an external exponential backoff using do while. I was curious about how to use the inbuild exponential backoff mechanism in the couchbase library.

@Lal_John -

The SDK internally uses ExponentialBackoff as part of the BestEffortRetryStrategy for all operations; there is nothing to configure - currently this behavior is not overridable but that will happen in a later version:



A do-while loop with the fast-fail retry strategy should be an effective workaround. Is there a bug for @Lal_John to track @jmorris?

I have implemented do-while loop with exponential backoff and jitter

1 Like

Here is a ticket for tracking:

IRetryStrategy is exposed on the XxxOptions, but not currently wired up - the default ExponentialBackoffStrategy is always used. This ticket is to wire up that functionality and in addition, add a FailFastStrategy so that retries can be disabled.

1 Like