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

Introduce task scheduler rate limiter #6677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Shaddoll
Copy link
Member

@Shaddoll Shaddoll commented Feb 19, 2025

What changed?
Introduce task scheduler rate limiter which is disabled by default. If enabled, it will run in shadow mode for all domains by default.

Why?

  • The rate limiter can protect the Cadence cluster from being overloaded
  • The rate limiter can protect domains from being affected by one bursty domain with too many tasks

How did you test it?
unit tests, also tested in dev2

Potential risks
history task scheduler might be broken

Release notes

Documentation Changes


func (r *taskRateLimiterImpl) Wait(ctx context.Context, t Task) error {
limiter, scope, shadow := r.getLimiter(t)
rsv := limiter.Reserve()
Copy link
Member Author

Choose a reason for hiding this comment

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

@Groxx Is it the correct usage?

domainID := t.GetDomainID()
domainName, err := r.domainCache.GetDomainName(domainID)
if err != nil {
r.logger.Warn("failed to get domain name from domain cache", tag.WorkflowDomainID(domainID), tag.Error(err))
Copy link
Member

Choose a reason for hiding this comment

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

What will r.limiters.For(domainName) return for non-existing domains? Should we return here while handling err instead of letting the below line execute?

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.

2 participants