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

Optimize poller counting #6651

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

natemort
Copy link
Member

@natemort natemort commented Jan 30, 2025

Instead of iterating through the entire history cache, use the count where the values aren't needed.

Additionally remove the tasklist isolation specific logic from emitMisconfiguredPartitionMetrics. This could add additional CPU usage when enabling tasklist isolation and is inaccurate when tasklist <-> isolation group assignment is implemented.

Generally we need to revisit this metric as the source of truth for partition count is moving from the dynamic config to persistence, but this metric still relies only on dynamic config. If partition autoscaling is enabled then it seems strange to alert in this scenario.

What changed?

  • Replace len(tlMgr.pollerHistory.GetPollerInfo(time.Time{}))) with getting the size of the cache.
  • Remove tasklist isolation specific calculations from emitMisconfiguredPartitionMetrics.

Why?

  • Reduce CPU usage when the number of pollers is high.

How did you test it?

  • Unit tests

Potential risks

Release notes

Documentation Changes

Instead of iterating through the entire history cache, use the count where the values aren't needed.

Additionally remove the tasklist isolation specific logic from emitMisconfiguredPartitionMetrics. This could add additional CPU usage when enabling tasklist isolation and accurate when tasklist <-> isolation group assignment is implemented.

Generally we need to revisit this metric as the source of truth for partition count is moving from the dynamic config to persistence, but this metric still relies only on dynamic config. If partition autoscaling is enabled then it seems strange to alert in this scenario.
Comment on lines -948 to -956
pollerCount := len(c.pollerHistory.GetPollerInfo(time.Time{}))
if c.enableIsolation { // if isolation enabled, get the minimum poller count among the isolation groups
pollerCountsByIsolationGroup := c.pollerHistory.GetPollerIsolationGroups(time.Time{})
for _, count := range pollerCountsByIsolationGroup {
if count < pollerCount {
pollerCount = count
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

These are isolation related logic. Are they still needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

With the tasklist partition <-> isolation group mapping that I'm currently implementing it's no longer accurate. We've disabled isolation broadly so it's not an issue in the mean time.

@natemort natemort merged commit 3945418 into cadence-workflow:master Feb 4, 2025
22 checks passed
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