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

Add StatsReporter component to estimate QPS #6286

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

Shaddoll
Copy link
Member

@Shaddoll Shaddoll commented Sep 16, 2024

What changed?

  • Add StatsReporter component to estimate QPS
  • Use the StatsReporter component to estimate AddTask QPS

Why?
We want to change the behavior of scalable tasklists based on AddTask QPS.

  • This is a prerequisite component for automatic partition management. With this component, Matching can automatically increase or decrease the number of partitions based on the AddTask QPS of a tasklist.

How did you test it?
unit tests, and verified in staging2

Potential risks

Release notes

Documentation Changes

common/quotas/stats.go Outdated Show resolved Hide resolved
@@ -258,6 +264,8 @@ func (c *taskListManagerImpl) AddTask(ctx context.Context, params AddTaskParams)
if params.ForwardedFrom == "" {
// request sent by history service
c.liveness.MarkAlive()
c.qpsReporter.ReportCounter(1)
c.scope.UpdateGauge(metrics.EstimatedAddTaskQPSGauge, c.qpsReporter.QPS())
Copy link
Member

Choose a reason for hiding this comment

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

could we pass c.scope to the qpsReporter so it can handle this UpdateGauge operation as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll not do that for now. This is a new component and I want to keep its function as minimal as possible so that we could iterate on this easily.

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 91.83673% with 4 lines in your changes missing coverage. Please review.

Project coverage is 73.11%. Comparing base (b41976a) to head (4dbd3b9).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
common/stats/stats.go 90.90% 2 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
service/matching/tasklist/task_list_manager.go 68.63% <100.00%> (+0.37%) ⬆️
common/stats/stats.go 90.90% <90.90%> (ø)

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b41976a...4dbd3b9. Read the comment docs.

Comment on lines +267 to +268
c.qpsTracker.ReportCounter(1)
c.scope.UpdateGauge(metrics.EstimatedAddTaskQPSGauge, c.qpsTracker.QPS())
Copy link
Member

Choose a reason for hiding this comment

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

it would be better if this was one line and qpsTracker also emits the metric.

defer r.wg.Done()
ticker := r.timeSource.NewTicker(r.bucketInterval)
defer ticker.Stop()

Copy link
Member

Choose a reason for hiding this comment

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

nit: suggest putting a defer/recover in case of any panics

@Shaddoll Shaddoll merged commit 78eb2c8 into cadence-workflow:master Sep 17, 2024
20 checks passed
@Shaddoll Shaddoll deleted the rps branch September 17, 2024 16:29
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