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

Added exponential retry to the domain cache #6676

Conversation

jakobht
Copy link
Member

@jakobht jakobht commented Feb 18, 2025

What changed?
Added a proper retry policy to the domain cache so it does not just retry every second

Why?
The load from retrying every second can cause too much load on the database.

How did you test it?
Unit test

Potential risks
Might cause domain data to be out of date, but we are already in that situation when it's failing.

Release notes

Documentation Changes

@jakobht jakobht force-pushed the Add-exponential-retry-to-the-domain-cache branch from ac53f8f to 7991588 Compare February 18, 2025 14:27
}
err := c.refreshDomains()
if err != nil {
c.logger.Error("Error refreshing domain cache", tag.Error(err))
Copy link
Member Author

Choose a reason for hiding this comment

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

We could consider logging fatal here? Since we already retryed quite a lot, and we still failed.

Copy link
Member

Choose a reason for hiding this comment

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

Let's leave it like this. It may have failed due to persistence rps limits and in those cases we don't want to get into crash loop. Ideally fetching domains shouldn't be subject to the same limits. @davidporter-id-au will look into granular rate limits area.

common/util.go Outdated
@@ -88,6 +88,10 @@ const (
taskCompleterMaxInterval = 10 * time.Second
taskCompleterExpirationInterval = 5 * time.Minute

domainCacheInitialInterval = 1 * time.Second
domainCacheMaxInterval = 20 * time.Second
Copy link
Member

@davidporter-id-au davidporter-id-au Feb 19, 2025

Choose a reason for hiding this comment

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

Can I request we make this lower, like 5 seconds I think? I think there's the problem that this logic is smeared around in a few places (at least

// DomainCacheRefreshFailureRetryInterval is the wait time
) and relied upon to make decisions such as
if t.timeSource.Now().Sub(t.submitTime) > 5*cache.DomainCacheRefreshInterval {

I agree it's the subject of unnecessary load, but the domain cache (in)consistency across hosts during transfer tasks is a subject of some pretty difficult-to-figure out bugs during failover (because a child workflow might go to a different history host, with a different view of which region is active, and if hte domain cache doesn't update within a reasonable time-period we have no clear resolution strategy)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure - that's also a good justification for looking into this more. Since in the end, there is no guarantee that this will succeed in any reasonable time when it has already started failing.

@jakobht jakobht force-pushed the Add-exponential-retry-to-the-domain-cache branch from 7991588 to 64f975f Compare February 19, 2025 10:09
@jakobht jakobht force-pushed the Add-exponential-retry-to-the-domain-cache branch from a8bd03f to fb5586b Compare February 20, 2025 07:13
@jakobht jakobht merged commit 622fdce into cadence-workflow:master Feb 20, 2025
22 checks passed
Assem-Uber pushed a commit that referenced this pull request Feb 20, 2025
What changed?
Added a proper retry policy to the domain cache so it does not just retry every second

Why?
The load from retrying every second can cause too much load on the database.

How did you test it?
Unit test

Potential risks
Might cause domain data to be out of date, but we are already in that situation when it's failing.

Release notes

Documentation Changes
Assem-Uber pushed a commit that referenced this pull request Feb 20, 2025
What changed?
Added a proper retry policy to the domain cache so it does not just retry every second

Why?
The load from retrying every second can cause too much load on the database.

How did you test it?
Unit test

Potential risks
Might cause domain data to be out of date, but we are already in that situation when it's failing.

Release notes

Documentation Changes
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.

3 participants