From 2008b4e6e3fee110dc899c2e97e5bb55cce44de1 Mon Sep 17 00:00:00 2001 From: raydds Date: Fri, 17 Jan 2020 11:21:06 -0500 Subject: [PATCH 1/3] Run UWSGI with 4 processes and 2 threads. Allocate more CPU/memory --- deploy/azure/autoscaling.yml | 4 ++-- deploy/azure/azure.yml | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/deploy/azure/autoscaling.yml b/deploy/azure/autoscaling.yml index e208d943..8bab90f4 100644 --- a/deploy/azure/autoscaling.yml +++ b/deploy/azure/autoscaling.yml @@ -17,7 +17,7 @@ spec: - type: Resource resource: name: cpu - targetAverageUtilization: 60 + targetAverageUtilization: 70 --- apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler @@ -37,4 +37,4 @@ spec: - type: Resource resource: name: cpu - targetAverageUtilization: 60 + targetAverageUtilization: 70 diff --git a/deploy/azure/azure.yml b/deploy/azure/azure.yml index 81612d5d..7feb0823 100644 --- a/deploy/azure/azure.yml +++ b/deploy/azure/azure.yml @@ -29,6 +29,13 @@ spec: containers: - name: atst image: $CONTAINER_IMAGE + env: + - name: UWSGI_PROCESSES + value: "4" + - name: UWSGI_THREADS + value: "2" + - name: UWSGI_ENABLE_THREADS + value: "1" envFrom: - configMapRef: name: atst-envvars @@ -50,11 +57,11 @@ spec: mountPath: "/config" resources: requests: - memory: 200Mi - cpu: 400m + memory: 400Mi + cpu: 1200m limits: - memory: 200Mi - cpu: 400m + memory: 400Mi + cpu: 1200m - name: nginx image: nginx:alpine ports: @@ -86,10 +93,10 @@ spec: resources: requests: memory: 20Mi - cpu: 10m + cpu: 100m limits: memory: 20Mi - cpu: 10m + cpu: 100m volumes: - name: nginx-client-ca-bundle configMap: From 14b9f3620440e9c684054f3a1b3d282b5e2332a7 Mon Sep 17 00:00:00 2001 From: raydds Date: Mon, 20 Jan 2020 14:06:54 -0500 Subject: [PATCH 2/3] Minimize staging --- deploy/overlays/staging/autoscaling.yml | 16 ++++++++++++++++ deploy/overlays/staging/kustomization.yaml | 1 + 2 files changed, 17 insertions(+) create mode 100644 deploy/overlays/staging/autoscaling.yml diff --git a/deploy/overlays/staging/autoscaling.yml b/deploy/overlays/staging/autoscaling.yml new file mode 100644 index 00000000..b7500c09 --- /dev/null +++ b/deploy/overlays/staging/autoscaling.yml @@ -0,0 +1,16 @@ +--- +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: atst +spec: + minReplicas: 1 + maxReplicas: 2 +--- +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: atst-worker +spec: + minReplicas: 1 + maxReplicas: 2 diff --git a/deploy/overlays/staging/kustomization.yaml b/deploy/overlays/staging/kustomization.yaml index 24705531..c1ef8fd2 100644 --- a/deploy/overlays/staging/kustomization.yaml +++ b/deploy/overlays/staging/kustomization.yaml @@ -5,6 +5,7 @@ resources: - namespace.yml - reset-cron-job.yml patchesStrategicMerge: + - autoscaling.yml - ports.yml - envvars.yml - flex_vol.yml From 35cd76adf5c36079873731c2ad21bff52e272edd Mon Sep 17 00:00:00 2001 From: raydds Date: Mon, 20 Jan 2020 14:07:08 -0500 Subject: [PATCH 3/3] Try to fit two web processes per node --- deploy/azure/autoscaling.yml | 4 ++-- deploy/azure/azure.yml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deploy/azure/autoscaling.yml b/deploy/azure/autoscaling.yml index 8bab90f4..e208d943 100644 --- a/deploy/azure/autoscaling.yml +++ b/deploy/azure/autoscaling.yml @@ -17,7 +17,7 @@ spec: - type: Resource resource: name: cpu - targetAverageUtilization: 70 + targetAverageUtilization: 60 --- apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler @@ -37,4 +37,4 @@ spec: - type: Resource resource: name: cpu - targetAverageUtilization: 70 + targetAverageUtilization: 60 diff --git a/deploy/azure/azure.yml b/deploy/azure/azure.yml index 7feb0823..f988d5fc 100644 --- a/deploy/azure/azure.yml +++ b/deploy/azure/azure.yml @@ -31,7 +31,7 @@ spec: image: $CONTAINER_IMAGE env: - name: UWSGI_PROCESSES - value: "4" + value: "2" - name: UWSGI_THREADS value: "2" - name: UWSGI_ENABLE_THREADS @@ -58,10 +58,10 @@ spec: resources: requests: memory: 400Mi - cpu: 1200m + cpu: 940m limits: memory: 400Mi - cpu: 1200m + cpu: 940m - name: nginx image: nginx:alpine ports: @@ -93,10 +93,10 @@ spec: resources: requests: memory: 20Mi - cpu: 100m + cpu: 25m limits: memory: 20Mi - cpu: 100m + cpu: 25m volumes: - name: nginx-client-ca-bundle configMap: