Parallelize independent resource reconciliation in createBranchResources

perfloop/neon-operator · FAN OUT

https://perfloop.ai/t/oss/case_7f32p6cvtn

Verdict

VERIFIED · settled 2026-08-18

What happened: The paired measurements met the required improvement.

Hypothesis

In BranchReconciler.createBranchResources, the reconciler sequentially reconciles the branch ConfigMap, Deployment, admin Service, and postgres Service. Since these four steps are completely independent and do not rely on each other's outputs, they can be executed concurrently using an errgroup.Group. This parallelization will reduce the latency of createBranchResources by overlapping the blocking Kubernetes API round-trips (Get and Create/Patch calls) for each resource.

Change to test: Use an errgroup.Group (from golang.org/x/sync/errgroup) to execute the independent sub-reconciliation steps (reconciling the ConfigMap, Deployment, admin Service, and postgres Service) concurrently instead of sequentially.

Where it lives

perfloop/neon-operator · internal/controller/branch_controller.go

Evidence

delayed initial reconciliation wall time and process CPU · 10 sample pairs

metric baseline candidate paired median change confidence range required result
ns/op 82687182 66524335 −19.7% (−16280549) −16664625 to −15794905 < −4134359 PASSED
cpu-ns/op 17171875 13312500 −22.7% (−3906250) −4906250 to −2218750 ≤ 100000 PASSED

Checks: 3 of 3 passed. Verification: no defect found.

Timeline