-
Notifications
You must be signed in to change notification settings - Fork 54
IWF-232: Add disabling sticky cache option #473
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
Changes from 5 commits
0f513cd
d019aa3
951e57e
cfacbaf
28d334b
2ed8404
7a888d6
fe750a4
51f2162
6c8497a
2e2b204
1e933ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,10 +177,18 @@ cadenceIntegTests: | |
$Q go test -v ./integ -temporal=false | ||
|
||
ci-cadence-integ-test: | ||
$Q go test -v ./integ -search=false -temporal=false -dependencyWaitSeconds=180 | ||
ifeq (${startsWith},) | ||
$Q go test -v ./integ -search=false -temporal=false -dependencyWaitSeconds=180 -disableStickyCache=true | ||
lwolczynski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else | ||
$Q go test -v ./integ -run "(?i)^Test[${startsWith}]" -search=false -temporal=false -dependencyWaitSeconds=180 -disableStickyCache=true | ||
endif | ||
|
||
ci-temporal-integ-test: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you test does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does work, but I can simplify it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
$Q go test -v ./integ -cover -coverprofile coverage.out -coverpkg ./service/... -search=false -cadence=false -dependencyWaitSeconds=60 | ||
ifeq (${startsWith},) | ||
$Q go test -v ./integ -cover -coverprofile coverage.out -coverpkg ./service/... -search=false -cadence=false -dependencyWaitSeconds=60 -disableStickyCache=true | ||
else | ||
$Q go test -v ./integ -run "(?i)^Test[${startsWith}]" -cover -coverprofile coverage.out -coverpkg ./service/... -search=false -cadence=false -dependencyWaitSeconds=60 -disableStickyCache=true | ||
endif | ||
|
||
ci-all-tests: | ||
# Fails CI when used with -coverprofile flag due to tests that panic; see https://go.dev/doc/build-cover#panicprof | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,11 @@ type InterpreterWorker struct { | |
tasklist string | ||
} | ||
|
||
type StartOptions struct { | ||
// When DisableStickyCache is true it can harm performance; should not be used in production environment | ||
DisableStickyCache bool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we have a specific use case for this start option to disable sticky cache, but I'm wondering if we should add a warning comment about the performance impacts of doing this for other reasons. (My understanding is that this would have a not insignificant impact on performance in a non-test/real-world use case. Is that right?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right. I'll add a comment pointing it out |
||
} | ||
|
||
func NewInterpreterWorker( | ||
config config.Config, service workflowserviceclient.Interface, domain, tasklist string, closeFunc func(), | ||
unifiedClient uclient.UnifiedClient, | ||
|
@@ -38,11 +43,25 @@ func (iw *InterpreterWorker) Close() { | |
} | ||
|
||
func (iw *InterpreterWorker) Start() { | ||
var options StartOptions | ||
|
||
// default options | ||
options.DisableStickyCache = false | ||
|
||
iw.StartWithOptions(options) | ||
} | ||
|
||
func (iw *InterpreterWorker) StartWithOptions(startOptions StartOptions) { | ||
config := env.GetSharedConfig() | ||
options := worker.Options{ | ||
MaxConcurrentActivityTaskPollers: 10, | ||
MaxConcurrentDecisionTaskPollers: 10, | ||
} | ||
|
||
if startOptions.DisableStickyCache { | ||
options.DisableStickyExecution = true | ||
lwolczynski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
if config.Interpreter.Cadence != nil && config.Interpreter.Cadence.WorkerOptions != nil { | ||
options = *config.Interpreter.Cadence.WorkerOptions | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,11 @@ type InterpreterWorker struct { | |
taskQueue string | ||
} | ||
|
||
type StartOptions struct { | ||
// When DisableStickyCache is true it can harm performance; should not be used in production environment | ||
DisableStickyCache bool | ||
} | ||
|
||
func NewInterpreterWorker( | ||
config config.Config, temporalClient client.Client, taskQueue string, memoEncryption bool, | ||
memoEncryptionConverter converter.DataConverter, unifiedClient uclient.UnifiedClient, | ||
|
@@ -36,6 +41,15 @@ func (iw *InterpreterWorker) Close() { | |
} | ||
|
||
func (iw *InterpreterWorker) Start() { | ||
var options StartOptions | ||
|
||
// default options | ||
options.DisableStickyCache = false | ||
|
||
iw.StartWithOptions(options) | ||
} | ||
|
||
func (iw *InterpreterWorker) StartWithOptions(startOptions StartOptions) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To even better address @mixydubs concerns, I feel like it's even better to have this StartWithOptions is also a little confusing with the workerOptions that we are passing through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
config := env.GetSharedConfig() | ||
options := worker.Options{ | ||
MaxConcurrentActivityTaskPollers: 10, | ||
|
@@ -49,6 +63,10 @@ func (iw *InterpreterWorker) Start() { | |
iw.worker = worker.New(iw.temporalClient, iw.taskQueue, options) | ||
worker.EnableVerboseLogging(config.Interpreter.VerboseDebug) | ||
|
||
if startOptions.DisableStickyCache { | ||
worker.SetStickyWorkflowCacheSize(0) | ||
} | ||
|
||
iw.worker.RegisterWorkflow(Interpreter) | ||
iw.worker.RegisterWorkflow(WaitforStateCompletionWorkflow) | ||
iw.worker.RegisterActivity(interpreter.StateStart) // TODO: remove in next release | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we wanted have one action to run with stickyCache, and another run without, right? (two actions run in parallel so that it won't slow down)
So I expect we need new yml files like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I thought we would only do tests with no sticky cache, but it makes sense to keep both scenarios 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done