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

IWF-274: Optimize Timer creation #529

Merged
merged 11 commits into from
Feb 5, 2025
Merged

IWF-274: Optimize Timer creation #529

merged 11 commits into from
Feb 5, 2025

Conversation

bowersj27
Copy link
Contributor

@bowersj27 bowersj27 commented Dec 23, 2024

Description

Checklist

  • Code compiles correctly
  • Tests for the changes have been added
  • All tests passing
  • This PR change is backwards-compatible
  • This PR CONTAINS a (planned) breaking change (it is not backwards compatible)

Related Issue

Closes #465

Copy link
Contributor

@longquanzheng longquanzheng left a comment

Choose a reason for hiding this comment

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

Very great job!! this is quite complicated, but I believe it's worth it.

@longquanzheng longquanzheng changed the title Jira/iwf 274 IWF-274: Optimize Timer creation Dec 23, 2024
@longquanzheng
Copy link
Contributor

Would be great to add a new test case to it -- especially the idleTimeout pattern, which is that main use case that this optimization is for.

Most of the code can be from any_timer_signal_test
https://github.com/indeedeng/iwf/blob/main/integ/workflow/any_timer_signal/routers.go#L47
Currently it’s
S1-1->S1-2->S2-1

S1-1 will wait for timer, S1-2 will wait for timer+signal.

We can change it to
S1-1->S1-2->(maybe a few more iterations) -> completeWF

Both S1-1 and S1-2 will wait for signal+timer and only the second timer will fired. We will expect only one timer was started in Temporal.
Maybe we have to check history events like this: https://github.com/indeedeng/iwf/blob/main/integ/wait_until_search_attributes_optimization_test.go#L133
(and only doing it for Temporal is fine)

@bowersj27 bowersj27 force-pushed the jira/IWF-274 branch 6 times, most recently from cf53b87 to f6fda1b Compare January 31, 2025 06:41
@bowersj27
Copy link
Contributor Author

Moved interfaces to it's own package. There's a fair amount of IDE refactored code because of this. The main changes to review are

  • workflowImpl
  • greedyTimerScheduler
  • greedyTimerProcessor
  • new integTests

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 93.12321% with 24 lines in your changes missing coverage. Please review.

Project coverage is 65.70%. Comparing base (2d552b8) to head (06500dc).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
service/interpreter/timers/greedyTimerProcessor.go 92.59% 7 Missing and 1 partial ⚠️
service/interpreter/timers/greedyTimerScheduler.go 93.75% 3 Missing and 2 partials ⚠️
service/interpreter/cadence/workflowProvider.go 85.71% 3 Missing ⚠️
service/interpreter/queryHandler.go 72.72% 2 Missing and 1 partial ⚠️
service/interpreter/temporal/workflowProvider.go 91.66% 2 Missing ⚠️
service/interpreter/activityImpl.go 88.88% 1 Missing ⚠️
service/interpreter/timers/simpleTimerProcessor.go 94.11% 1 Missing ⚠️
service/interpreter/workflowImpl.go 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #529      +/-   ##
==========================================
+ Coverage   64.66%   65.70%   +1.03%     
==========================================
  Files          59       62       +3     
  Lines        6639     6849     +210     
==========================================
+ Hits         4293     4500     +207     
- Misses       2067     2068       +1     
- Partials      279      281       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bowersj27 bowersj27 marked this pull request as ready for review February 3, 2025 20:29
@bowersj27 bowersj27 force-pushed the jira/IWF-274 branch 2 times, most recently from e66b879 to 5a35a77 Compare February 4, 2025 22:42
@bowersj27 bowersj27 merged commit 5b9db14 into main Feb 5, 2025
10 checks passed
@bowersj27 bowersj27 deleted the jira/IWF-274 branch February 5, 2025 20:25
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.

Optimize timer started for saving cost
3 participants