From 4330df505469c67dcc0d9ee4566dd96185e13a5d Mon Sep 17 00:00:00 2001 From: andersonid Date: Sat, 4 Oct 2025 09:05:59 -0300 Subject: [PATCH] Optimize application resource requests/limits based on real usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Reduce replicas from 2 to 1 (single instance sufficient) - Adjust CPU requests: 100m → 50m (based on actual usage) - Adjust CPU limits: 500m → 200m (4x headroom for spikes) - Adjust memory requests: 128Mi → 64Mi (realistic baseline) - Adjust memory limits: 512Mi → 256Mi (2x headroom for 160MB peak usage) - Update S2I template with same optimized values - Maintain proper resource ratios (4:1 CPU, 4:1 Memory) - Eliminate resource waste and improve cluster efficiency --- k8s/deployment.yaml | 10 +++++----- openshift-s2i.yaml | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 0a7ea20..37e3775 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -7,7 +7,7 @@ metadata: app.kubernetes.io/name: resource-governance app.kubernetes.io/component: governance spec: - replicas: 2 + replicas: 1 strategy: type: RollingUpdate rollingUpdate: @@ -115,11 +115,11 @@ spec: key: SERVICE_ACCOUNT_NAME resources: requests: - cpu: 100m - memory: 128Mi + cpu: 50m + memory: 64Mi limits: - cpu: 500m - memory: 512Mi + cpu: 200m + memory: 256Mi volumeMounts: - name: reports mountPath: /tmp/reports diff --git a/openshift-s2i.yaml b/openshift-s2i.yaml index 4e95c80..53b4177 100644 --- a/openshift-s2i.yaml +++ b/openshift-s2i.yaml @@ -49,25 +49,25 @@ parameters: - name: CPU_REQUEST displayName: "CPU Request" description: "The amount of CPU to request for the container." - value: "100m" + value: "50m" required: true - name: CPU_LIMIT displayName: "CPU Limit" description: "The amount of CPU to limit the container to." - value: "500m" + value: "200m" required: true - name: MEMORY_REQUEST displayName: "Memory Request" description: "The amount of memory to request for the container." - value: "256Mi" + value: "64Mi" required: true - name: MEMORY_LIMIT displayName: "Memory Limit" description: "The amount of memory to limit the container to." - value: "1Gi" + value: "256Mi" required: true - name: REPLICAS