breezy-lawyer-65638
03/03/2023, 11:27 PMpreview
. is this expected? I took a trace and it has a lot of stuff like thiscuddly-computer-18851
03/04/2023, 12:06 AMpreview
is common for our projects.
Running pulumi as close to the resources in question ( in our case AWS + EKS ) to reduce roundtrip latency has the biggest impact to reduce time.breezy-lawyer-65638
03/04/2023, 12:21 AMrefresh
taking a lot of time (since it is updating state), I would have thought preview
ought to be fast (since it could just compare local state, not sure if it does.)
it kind of looks to me from this trace and some logs that it's registering resources one at a time sequentially, but not sure if I am reading it correctly.cuddly-computer-18851
03/04/2023, 12:26 AMpreview
with --refresh ?
Also you can set the concurrency of requests, which is unlimited by default, but this can sometimes be slower if its causing rate-limiting at the k8s API.breezy-lawyer-65638
03/04/2023, 12:29 AMpulumi preview
I have been setting KubeClientSettingsArgs
, started with medium values, tried very high values, will try unset now. what are the other concurrency knobs?cuddly-computer-18851
03/04/2023, 12:30 AM-p, --parallel int Allow P resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded. (default 2147483647)
billowy-army-68599
03/04/2023, 12:36 AMbreezy-lawyer-65638
03/04/2023, 12:37 AMcuddly-computer-18851
03/04/2023, 12:47 AMbreezy-lawyer-65638
03/04/2023, 12:52 AMcuddly-computer-18851
03/04/2023, 1:04 AMbreezy-lawyer-65638
03/04/2023, 1:05 AMbillowy-army-68599
03/04/2023, 1:06 AMcuddly-computer-18851
03/04/2023, 1:07 AMRelease
resource type is much better than the older Chart
resource, but not an issue here I guess.
Ultimately after doing a huge k8s project w/ pulumi, I would not use it again.
The double handling of k8s state just doesn't work too often.breezy-lawyer-65638
03/04/2023, 1:08 AMbillowy-army-68599
03/04/2023, 1:29 AMbreezy-lawyer-65638
03/04/2023, 1:29 AMdiff --git a/pkg/resource/deploy/deployment_executor.go b/pkg/resource/deploy/deployment_executor.go
index cf6b3738d..1337ffcbf 100644
--- a/pkg/resource/deploy/deployment_executor.go
+++ b/pkg/resource/deploy/deployment_executor.go
@@ -19,6 +19,7 @@ import (
"errors"
"fmt"
"strings"
+ "sync"
"<http://github.com/pulumi/pulumi/pkg/v3/resource/deploy/providers|github.com/pulumi/pulumi/pkg/v3/resource/deploy/providers>"
"<http://github.com/pulumi/pulumi/pkg/v3/resource/graph|github.com/pulumi/pulumi/pkg/v3/resource/graph>"
@@ -38,6 +39,7 @@ type deploymentExecutor struct {
stepGen *stepGenerator // step generator owned by this deployment
stepExec *stepExecutor // step executor owned by this deployment
+ workers sync.WaitGroup
}
// checkTargets validates that all the targets passed in refer to existing resources. Diagnostics
@@ -271,6 +273,7 @@ func (ex *deploymentExecutor) Execute(callerCtx context.Context, opts Options, p
}
}()
+ ex.workers.Wait()
ex.stepExec.WaitForCompletion()
logging.V(4).Infof("deploymentExecutor.Execute(...): step executor has completed")
@@ -411,25 +414,34 @@ func (ex *deploymentExecutor) performDeletes(
func (ex *deploymentExecutor) handleSingleEvent(event SourceEvent) result.Result {
contract.Requiref(event != nil, "event", "must not be nil")
- var steps []Step
- var res result.Result
switch e := event.(type) {
- case RegisterResourceEvent:
- logging.V(4).Infof("deploymentExecutor.handleSingleEvent(...): received RegisterResourceEvent")
- steps, res = ex.stepGen.GenerateSteps(e)
- case ReadResourceEvent:
- logging.V(4).Infof("deploymentExecutor.handleSingleEvent(...): received ReadResourceEvent")
- steps, res = ex.stepGen.GenerateReadSteps(e)
case RegisterResourceOutputsEvent:
logging.V(4).Infof("deploymentExecutor.handleSingleEvent(...): received register resource outputs")
return ex.stepExec.ExecuteRegisterResourceOutputs(e)
}
- if res != nil {
- return res
- }
+ ex.workers.Add(1)
+ go func() {
+ defer ex.workers.Done()
+
+ var steps []Step
+ var res result.Result
+ switch e := event.(type) {
+ case RegisterResourceEvent:
+ logging.V(4).Infof("deploymentExecutor.handleSingleEvent(...): received RegisterResourceEvent")
+ steps, res = ex.stepGen.GenerateSteps(e)
+ case ReadResourceEvent:
+ logging.V(4).Infof("deploymentExecutor.handleSingleEvent(...): received ReadResourceEvent")
+ steps, res = ex.stepGen.GenerateReadSteps(e)
+ }
+
+ if res != nil {
+ return
+ }
+
+ ex.stepExec.ExecuteSerial(steps)
+ }()
- ex.stepExec.ExecuteSerial(steps)
return nil
}
@@ -453,6 +465,7 @@ func (ex *deploymentExecutor) importResources(
preview: preview,
}
res := importer.importResources(ctx)
+ ex.workers.Wait()
stepExec.SignalCompletion()
stepExec.WaitForCompletion()
@@ -503,6 +516,7 @@ func (ex *deploymentExecutor) refresh(callerCtx context.Context, opts Options, p
ctx, cancel := context.WithCancel(callerCtx)
stepExec := newStepExecutor(ctx, cancel, ex.deployment, opts, preview, true)
stepExec.ExecuteParallel(steps)
+ ex.workers.Wait()
stepExec.SignalCompletion()
stepExec.WaitForCompletion()
billowy-army-68599
03/04/2023, 3:35 AMbreezy-lawyer-65638
03/04/2023, 4:01 AMcuddly-computer-18851
03/04/2023, 4:54 AMbreezy-lawyer-65638
03/04/2023, 7:16 AM