Skip to content

Commit

Permalink
Reduce memory/cpu step size to 128Mi:125m
Browse files Browse the repository at this point in the history
  • Loading branch information
karlkfi committed Apr 18, 2024
1 parent cd8b14b commit 49cc302
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions e2e/testcases/stress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ func TestStressManyRootSyncs(t *testing.T) {
nt.T.Logf("Adding test namespace: %s", ns)
nt.Must(nt.RootRepos[configsync.RootSyncName].Add(fmt.Sprintf("%s/ns-%s.yaml", gitproviders.DefaultSyncDir, ns), fake.NamespaceObject(ns)))

syncCount := 3
deployCount := 2000
syncCount := 20
deployCount := 200

for i := 1; i <= syncCount; i++ {
syncName := fmt.Sprintf("sync-%d", i)
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconcilermanager/controllers/reposync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1202,13 +1202,13 @@ func (r *RepoSyncReconciler) mutationsFor(ctx context.Context, rs *v1beta1.RepoS
}

memoryMinimum := float64(128)
memoryStepSize := float64(256)
memoryStepSize := float64(128)
memoryUsage := float64(objectCount)/10 + memoryMinimum
memoryLimit := math.Floor(memoryUsage/memoryStepSize)*memoryStepSize + memoryStepSize
memoryQuantity := resource.NewQuantity(int64(memoryLimit*bytes.MiB), resource.BinarySI)
klog.V(3).Infof("%s reconciler container memory: %s - %s", r.syncKind, memoryQuantity, memoryQuantity)

cpuStepSize := float64(250)
cpuStepSize := float64(125)
cpuLimit := math.Floor(memoryLimit/memoryStepSize) * cpuStepSize
cpuQuantity := resource.NewMilliQuantity(int64(cpuLimit), resource.DecimalSI)
klog.V(3).Infof("%s reconciler container cpu: %s - %s", r.syncKind, cpuQuantity, cpuQuantity)
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconcilermanager/controllers/rootsync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1259,13 +1259,13 @@ func (r *RootSyncReconciler) mutationsFor(ctx context.Context, rs *v1beta1.RootS
}

memoryMinimum := float64(128)
memoryStepSize := float64(256)
memoryStepSize := float64(128)
memoryUsage := float64(objectCount)/10 + memoryMinimum
memoryLimit := math.Floor(memoryUsage/memoryStepSize)*memoryStepSize + memoryStepSize
memoryQuantity := resource.NewQuantity(int64(memoryLimit*bytes.MiB), resource.BinarySI)
klog.V(3).Infof("%s reconciler container memory: %s - %s", r.syncKind, memoryQuantity, memoryQuantity)

cpuStepSize := float64(250)
cpuStepSize := float64(125)
cpuLimit := math.Floor(memoryLimit/memoryStepSize) * cpuStepSize
cpuQuantity := resource.NewMilliQuantity(int64(cpuLimit), resource.DecimalSI)
klog.V(3).Infof("%s reconciler container cpu: %s - %s", r.syncKind, cpuQuantity, cpuQuantity)
Expand Down

0 comments on commit 49cc302

Please sign in to comment.