-
Notifications
You must be signed in to change notification settings - Fork 339
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
The default backoff policy does not have mandatory stop, which could cause unexpected send timeout #1270
Comments
Go and Java design are different. In the Go, we have a gorotinue to check the timeout. Maybe your application needs to wait for 60 seconds, is it right? I'm improving this: #1256 What problem have you encountered? |
There is a case that the server side took 25 seconds to recover while the client side failed with timeout.
I didn't mean the Golang client does not check the timeout, let's take a look at the following case (reusing the delay I ran before)
Let's see how Java client solves the issue. .setMandatoryStop(Math.max(100, conf.getSendTimeoutMs() - 100), TimeUnit.MILLISECONDS) Backoff backoff = new Backoff(100, TimeUnit.MILLISECONDS, 60, TimeUnit.SECONDS, 30000 - 100, TimeUnit.MILLISECONDS);
for (int i = 0; i < 10; i++) {
System.out.println(backoff.next());
}
Though it's a little different than I've thought. But generally, having a delay greater than the send timeout does not make sense. |
It looks like you want to reduce the maximum retry time and retry interval.
Please see #454 We can consider https://aws.amazon.com/cn/blogs/architecture/exponential-backoff-and-jitter/ design. |
Yes I want to limit the max retry time according to the send timeout config. The exponential backoff mechanism is good that we can support it in future. But currently we'd better adopt the same behavior with the Java client. |
Ok, I see. We need to reduce the retry interval, not limit the max retry time, this is the root cause. https://github.com/cenkalti/backoff/blob/v4/exponential.go#L39-L50 provides an example, could you checkout? BTW, the |
Expected behavior
For a producer, when the retry time exceeds the left time when a message would fail with timeout error, it should be reduced to be less than the left time.
See
ProducerImpl
's constructor in Java client:There is a
mandatoryStop
field.Actual behavior
The default backoff policy simply increases the next delay until the max retry time (60s).
Steps to reproduce
Modify the test above in
backoff_test.go
and rungo test -run TestBackoff_NextMinValue
in the same directory.System configuration
Pulsar version: x.y
The text was updated successfully, but these errors were encountered: