uber-go / cadence-client

Framework for authoring workflows and activities running on top of the Cadence orchestration engine.
https://cadenceworkflow.io
MIT License
344 stars 130 forks source link

Add poller autoscaler #1184

Closed shijiesheng closed 2 years ago

shijiesheng commented 2 years ago

What changed?

Why?

Pollers constantly poll the cadence-frontend for tasks even though there are no tasks. To reduce unnecessary polling, an autoscaler is used to limit the number of concurrent polls. This PR addresses the implementation of polleraAutoscaler and there will be a follow-up PR to add the autoscaler on pollers.

As for the design of autoscaler, a resizable semaphore is used to limit concurrency.

How did you test it?

unit tests

Potential risks

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 0182dc0d-f5a2-4033-bffd-2b4b85a25e34


Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/common/autoscaler/recommender.go 21 22 95.45%
internal/internal_poller_autoscaler.go 80 82 97.56%
<!-- Total: 107 110 97.27% -->
Totals Coverage Status
Change from base Build 01826fe7-7f06-47b4-bbe2-421af8f4fde0: 0.2%
Covered Lines: 12539
Relevant Lines: 19573

💛 - Coveralls