From bc50fab00479b181499ede643e1f032af4c6b75e Mon Sep 17 00:00:00 2001 From: Hans Kallekleiv <16436291+HansKallekleiv@users.noreply.github.com> Date: Wed, 29 Nov 2023 17:10:11 +0100 Subject: [PATCH] tweak --- .../src/backend/primary/user_session_proxy.py | 2 +- radixconfig.yml | 316 +++++++++--------- 2 files changed, 162 insertions(+), 156 deletions(-) diff --git a/backend/src/backend/primary/user_session_proxy.py b/backend/src/backend/primary/user_session_proxy.py index 719258a9a..649c4efad 100644 --- a/backend/src/backend/primary/user_session_proxy.py +++ b/backend/src/backend/primary/user_session_proxy.py @@ -88,7 +88,7 @@ async def _create_new_job(self, user_id: str) -> None: # these could be dynamic based on e.g. the selected ensemble sizess by the user. json={ "resources": { - "limits": {"memory": "128GiB", "cpu": "16"}, + "limits": {"memory": "64GiB", "cpu": "2"}, "requests": {"memory": "32GiB", "cpu": "1"}, } }, diff --git a/radixconfig.yml b/radixconfig.yml index d95b702e8..8bda4b0a2 100644 --- a/radixconfig.yml +++ b/radixconfig.yml @@ -1,169 +1,175 @@ apiVersion: radix.equinor.com/v1 kind: RadixApplication metadata: - name: webviz + name: webviz spec: - environments: - - name: prod - build: - from: main - - name: review - build: - from: review + environments: + - name: prod + build: + from: main + - name: review + build: + from: review - components: - - name: frontend - dockerFileName: frontend-prod.Dockerfile - publicPort: http - ports: - - name: http - port: 8080 + components: + - name: frontend + dockerFileName: frontend-prod.Dockerfile + publicPort: http + ports: + - name: http + port: 8080 + ingressConfiguration: + - websocketfriendly - - name: backend-primary - dockerFileName: backend.Dockerfile - ports: - - name: http - port: 5000 - secretRefs: - azureKeyVaults: - - name: webviz - items: - - name: WEBVIZ-CLIENT-SECRET - envVar: WEBVIZ_CLIENT_SECRET - - name: WEBVIZ-SMDA-RESOURCE-SCOPE - envVar: WEBVIZ_SMDA_RESOURCE_SCOPE - - name: WEBVIZ-SMDA-SUBSCRIPTION-KEY - envVar: WEBVIZ_SMDA_SUBSCRIPTION_KEY - variables: - UVICORN_PORT: 5000 - UVICORN_ENTRYPOINT: src.backend.primary.main:app - environmentConfig: - - environment: prod + - name: backend-primary + dockerFileName: backend.Dockerfile + ports: + - name: http + port: 5000 + ingressConfiguration: + - websocketfriendly secretRefs: - azureKeyVaults: - - name: webviz - items: - - name: WEBVIZ-INSIGHTS-CONNECTIONSTRING-PROD - envVar: APPLICATIONINSIGHTS_CONNECTION_STRING + azureKeyVaults: + - name: webviz + items: + - name: WEBVIZ-CLIENT-SECRET + envVar: WEBVIZ_CLIENT_SECRET + - name: WEBVIZ-SMDA-RESOURCE-SCOPE + envVar: WEBVIZ_SMDA_RESOURCE_SCOPE + - name: WEBVIZ-SMDA-SUBSCRIPTION-KEY + envVar: WEBVIZ_SMDA_SUBSCRIPTION_KEY variables: - OTEL_RESOURCE_ATTRIBUTES: service.name=primary-backend, service.namespace=prod, service.version=tbd0.1.2 - resources: - requests: - memory: 8Gi - cpu: 1000m - limits: - # Memory limit=request and cpu limit omitted on purpose - memory: 8Gi - horizontalScaling: - minReplicas: 2 - maxReplicas: 4 - resources: - memory: - averageUtilization: 60 - cpu: - averageUtilization: 80 - - environment: review - secretRefs: - azureKeyVaults: - - name: webviz - items: - - name: WEBVIZ-INSIGHTS-CONNECTIONSTRING-REVIEW - envVar: APPLICATIONINSIGHTS_CONNECTION_STRING - variables: - OTEL_RESOURCE_ATTRIBUTES: service.name=primary-backend, service.namespace=review, service.version=tbd0.1.2 - resources: - requests: - memory: 4Gi - cpu: 500m - limits: - memory: 4Gi - horizontalScaling: - minReplicas: 1 - maxReplicas: 3 - resources: - memory: - averageUtilization: 60 - cpu: - averageUtilization: 80 - - - name: redis-user-session - image: bitnami/redis:6.2.10@sha256:bd42fcdab5959ce2b21b6ea8410d4b3ee87ecb2e320260326ec731ecfcffbd0e - ports: - - name: http - port: 6379 - variables: - ALLOW_EMPTY_PASSWORD: yes + UVICORN_PORT: 5000 + UVICORN_ENTRYPOINT: src.backend.primary.main:app + environmentConfig: + - environment: prod + secretRefs: + azureKeyVaults: + - name: webviz + items: + - name: WEBVIZ-INSIGHTS-CONNECTIONSTRING-PROD + envVar: APPLICATIONINSIGHTS_CONNECTION_STRING + variables: + OTEL_RESOURCE_ATTRIBUTES: service.name=primary-backend, service.namespace=prod, service.version=tbd0.1.2 + resources: + requests: + memory: 8Gi + cpu: 1000m + limits: + # Memory limit=request and cpu limit omitted on purpose + memory: 8Gi + horizontalScaling: + minReplicas: 2 + maxReplicas: 4 + resources: + memory: + averageUtilization: 60 + cpu: + averageUtilization: 80 + - environment: review + secretRefs: + azureKeyVaults: + - name: webviz + items: + - name: WEBVIZ-INSIGHTS-CONNECTIONSTRING-REVIEW + envVar: APPLICATIONINSIGHTS_CONNECTION_STRING + variables: + OTEL_RESOURCE_ATTRIBUTES: service.name=primary-backend, service.namespace=review, service.version=tbd0.1.2 + resources: + requests: + memory: 4Gi + cpu: 500m + limits: + memory: 4Gi + horizontalScaling: + minReplicas: 1 + maxReplicas: 3 + resources: + memory: + averageUtilization: 60 + cpu: + averageUtilization: 80 - - name: redis-cache - image: bitnami/redis:6.2.10@sha256:bd42fcdab5959ce2b21b6ea8410d4b3ee87ecb2e320260326ec731ecfcffbd0e - ports: - - name: http - port: 6379 - variables: - ALLOW_EMPTY_PASSWORD: yes - # https://redis.io/docs/management/config/#configuring-redis-as-a-cache - # maxmemory for redis must be aligned with component's requested memory, here 1gb vs 2gb - REDIS_EXTRA_FLAGS: --maxmemory 1gb --maxmemory-policy allkeys-lru --save '' --appendonly no --loglevel verbose - resources: - requests: - memory: 2Gi - cpu: 200m - limits: - memory: 2Gi + - name: redis-user-session + image: bitnami/redis:6.2.10@sha256:bd42fcdab5959ce2b21b6ea8410d4b3ee87ecb2e320260326ec731ecfcffbd0e + ports: + - name: http + port: 6379 + variables: + ALLOW_EMPTY_PASSWORD: yes - jobs: - - name: backend-user-session - dockerFileName: backend.Dockerfile - schedulerPort: 8000 - ports: - - name: http - port: 8000 - secretRefs: - azureKeyVaults: - - name: webviz - items: - - name: WEBVIZ-CLIENT-SECRET - envVar: WEBVIZ_CLIENT_SECRET - - name: WEBVIZ-SMDA-RESOURCE-SCOPE - envVar: WEBVIZ_SMDA_RESOURCE_SCOPE - - name: WEBVIZ-SMDA-SUBSCRIPTION-KEY - envVar: WEBVIZ_SMDA_SUBSCRIPTION_KEY - variables: - UVICORN_PORT: 8000 - UVICORN_ENTRYPOINT: src.backend.user_session.main:app - environmentConfig: - # As of October 2023 in radix, these settings need to be duplicated for both environments. - - environment: prod - secretRefs: - azureKeyVaults: - - name: webviz - items: - - name: WEBVIZ-INSIGHTS-CONNECTIONSTRING-PROD - envVar: APPLICATIONINSIGHTS_CONNECTION_STRING + - name: redis-cache + image: bitnami/redis:6.2.10@sha256:bd42fcdab5959ce2b21b6ea8410d4b3ee87ecb2e320260326ec731ecfcffbd0e + ports: + - name: http + port: 6379 variables: - OTEL_RESOURCE_ATTRIBUTES: service.name=user-session, service.namespace=prod, service.version=tbd0.1.2 - volumeMounts: - - name: webvizcache - path: /tmp/webvizcache/ - blobfuse2: - container: cache - uid: 1234 - - environment: review + ALLOW_EMPTY_PASSWORD: yes + # https://redis.io/docs/management/config/#configuring-redis-as-a-cache + # maxmemory for redis must be aligned with component's requested memory, here 1gb vs 2gb + REDIS_EXTRA_FLAGS: --maxmemory 1gb --maxmemory-policy allkeys-lru --save '' --appendonly no --loglevel verbose + resources: + requests: + memory: 2Gi + cpu: 200m + limits: + memory: 2Gi + + jobs: + - name: backend-user-session + dockerFileName: backend.Dockerfile + schedulerPort: 8000 + ports: + - name: http + port: 8000 + ingressConfiguration: + - websocketfriendly secretRefs: - azureKeyVaults: - - name: webviz - items: - - name: WEBVIZ-INSIGHTS-CONNECTIONSTRING-REVIEW - envVar: APPLICATIONINSIGHTS_CONNECTION_STRING + azureKeyVaults: + - name: webviz + items: + - name: WEBVIZ-CLIENT-SECRET + envVar: WEBVIZ_CLIENT_SECRET + - name: WEBVIZ-SMDA-RESOURCE-SCOPE + envVar: WEBVIZ_SMDA_RESOURCE_SCOPE + - name: WEBVIZ-SMDA-SUBSCRIPTION-KEY + envVar: WEBVIZ_SMDA_SUBSCRIPTION_KEY variables: - OTEL_RESOURCE_ATTRIBUTES: service.name=user-session, service.namespace=review, service.version=tbd0.1.2 - volumeMounts: - - name: webvizcache - path: /tmp/webvizcache/ - blobfuse2: - container: cache - uid: 1234 + UVICORN_PORT: 8000 + UVICORN_ENTRYPOINT: src.backend.user_session.main:app + environmentConfig: + # As of October 2023 in radix, these settings need to be duplicated for both environments. + - environment: prod + secretRefs: + azureKeyVaults: + - name: webviz + items: + - name: WEBVIZ-INSIGHTS-CONNECTIONSTRING-PROD + envVar: APPLICATIONINSIGHTS_CONNECTION_STRING + variables: + OTEL_RESOURCE_ATTRIBUTES: service.name=user-session, service.namespace=prod, service.version=tbd0.1.2 + volumeMounts: + - name: webvizcache + path: /tmp/webvizcache/ + blobfuse2: + container: cache + uid: 1234 + - environment: review + secretRefs: + azureKeyVaults: + - name: webviz + items: + - name: WEBVIZ-INSIGHTS-CONNECTIONSTRING-REVIEW + envVar: APPLICATIONINSIGHTS_CONNECTION_STRING + variables: + OTEL_RESOURCE_ATTRIBUTES: service.name=user-session, service.namespace=review, service.version=tbd0.1.2 + volumeMounts: + - name: webvizcache + path: /tmp/webvizcache/ + blobfuse2: + container: cache + uid: 1234 - dnsAppAlias: - environment: prod - component: frontend + dnsAppAlias: + environment: prod + component: frontend