-
Notifications
You must be signed in to change notification settings - Fork 911
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
Add random delay to ArchiveExecutionTask #3565
Conversation
68982ee
to
5400383
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Archival queue is an immediate queue, there's no delay by definition & task visibility timestamp for immediate tasks (which is only for metrics purpose) will be overwritten to time.Now() by shard context.
@@ -102,6 +103,7 @@ type ( | |||
namespaceRegistry namespace.Registry | |||
mutableState MutableState | |||
config *configs.Config | |||
logger log.Logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do it need logger here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably from an older revision. Removed, thanks for spotting!
@@ -198,10 +202,20 @@ func (r *TaskGeneratorImpl) GenerateWorkflowCloseTasks( | |||
}, | |||
) | |||
if r.config.DurableArchivalEnabled() { | |||
delay := backoff.JitDuration( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backoff.JitDuration(delay, 1) / 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks!
With task processing rate limiter, do we still need the jitter here? I think this is the main reason we want to change it to scheduled queue. |
8cc6fb8
to
02ccc81
Compare
service/history/configs/config.go
Outdated
ArchiveRequestRPS dynamicconfig.IntPropertyFn | ||
ArchiveSignalTimeout dynamicconfig.DurationPropertyFn | ||
DurableArchivalEnabled dynamicconfig.BoolPropertyFn | ||
RandomArchiveExecutionDelayUpperBound dynamicconfig.DurationPropertyFn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used? Remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, thanks!
If we can avoid the spiky load in the first place, I think it's better than relying on the rate limiter to handle it after it occurs, which exists a possibility that the rate limiter can't handle it well (especially for tasks that needs to read history.) Plus, I don't think scheduled queue is a lot more expensive than immediate queues (especially when load is high). |
02ccc81
to
9cc45a9
Compare
What changed?
Why?
I did this to prevent us from having a ton of archive execution tasks arrive concurrently if many workflows close simultaneously.
How did you test it?
I added unit tests that verify edge cases like setting the dynamic config upper bound to 0.
Potential risks
Does not run via any production entrypoints.
Is hotfix candidate?
No.