-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[CAPPL-399] Syncer limits #16234
[CAPPL-399] Syncer limits #16234
Conversation
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
c22722f
to
10ba0d2
Compare
core/config/toml/types.go
Outdated
NetworkID *string | ||
ChainID *string | ||
GlobalEngineCountLimit *int32 | ||
WorkflowsPerOwnerLimit *int32 |
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.
Can we put these two fields in a new top-level field called Workflows? I think putting it in ExternalRegistry isn't quite right (that refers to the CapabilitiesRegistry btw, not the WorklfowRegistry)
@@ -291,6 +292,14 @@ func NewApplication(opts ApplicationOpts) (Application, error) { | |||
return nil, fmt.Errorf("could not instantiate workflow rate limiter: %w", err) | |||
} | |||
|
|||
workflowSyncerLimiter, err := syncerlimiter.NewWorkflowSyncerLimiter(syncerlimiter.Config{ |
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.
Just workflowLimiter, rather than workflowSyncerLimiter, it should apply to all workflows, not just those belonging to the workflowSyncer
core/services/workflows/engine.go
Outdated
@@ -1339,6 +1353,15 @@ func NewEngine(ctx context.Context, cfg Config) (engine *Engine, err error) { | |||
// - that the resulting graph is strongly connected (i.e. no disjointed subgraphs exist) | |||
// - etc. | |||
|
|||
// validate if adding another engine would exceed either the global or per owner count limit | |||
ownerAllow, globalAllow := cfg.WorkflowSyncerLimiter.Allow(cfg.WorkflowOwner) |
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.
Can we put this in Start() instead so it's symmetric with Close :) ?
10ba0d2
to
88e3844
Compare
7da41ca
to
3544aea
Compare
3544aea
to
2b8f98c
Compare
core/config/docs/core.toml
Outdated
[Capabilities.WorkflowRegistry.Limits] | ||
# WorkflowsGlobalLimit is the maximum number of workflows that can be registered globally. | ||
WorkflowsGlobalLimit = 50 # Default |
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.
Do we need to say Limit
twice? Or could we drop either the extra wrapper or the suffix?
core/config/capabilities_config.go
Outdated
@@ -27,6 +27,8 @@ type CapabilitiesWorkflowRegistry interface { | |||
MaxBinarySize() utils.FileSize | |||
MaxConfigSize() utils.FileSize | |||
RelayID() types.RelayID | |||
WorkflowsGlobal() int32 | |||
WorkflowsPerOwner() int32 |
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.
@agparadiso Is this correct? Looking at the docs there should be a struct beneath it called limits I think?
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.
true, this was working because underneath I was calling Limits:
func (c *capabilitiesWorkflowRegistry) WorkflowsGlobal() int32 {
return *c.c.Limits.WorkflowsGlobal
}
func (c *capabilitiesWorkflowRegistry) WorkflowsPerOwner() int32 {
return *c.c.Limits.WorkflowsPerOwner
}
will modify it, thanks!
core/config/docs/core.toml
Outdated
@@ -470,6 +470,12 @@ MaxEncryptedSecretsSize = '26.40kb' # Default | |||
# MaxConfigSize is the maximum size of a config that can be fetched from the given config url. | |||
MaxConfigSize = '50.00kb' # Default | |||
|
|||
[Capabilities.WorkflowRegistry.Limits] |
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 still think we should move this to something that doesn't imply it's a limit that only applies to the WorkflowRegistry
eg. [Workflows.Limits]
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.
Addressed 👍🏼
3353bab
to
c5e8a20
Compare
c5e8a20
to
891f2ee
Compare
core/config/docs/core.toml
Outdated
# Global is the maximum number of workflows that can be registered globally. | ||
Global = 50 # Default | ||
# PerOwner is the maximum number of workflows that can be registered per owner. | ||
PerOwner = 5 # Default |
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.
@agparadiso Can we set this to 200 Global and 200 PerOwner by default? This will be what we need for ST3
// validate if adding another workflow would exceed either the global or per owner engine count limit | ||
ownerAllow, globalAllow := e.workflowLimits.Allow(e.workflow.owner) | ||
if !globalAllow { | ||
e.metrics.with(platform.KeyWorkflowID, e.workflow.id, platform.KeyWorkflowOwner, e.workflow.owner).incrementWorkflowLimitGlobalCounter(ctx) |
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.
We also should log a message via Beholder here and below on line 166
4e954bb
to
2cdcf9c
Compare
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌1 Results
ArtifactsFor detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json. |
|
Description
This pr adds the following limits:
CAPPL-399
Requires
Supports