diff --git a/charts/model-engine/templates/gateway_deployment.yaml b/charts/model-engine/templates/gateway_deployment.yaml index 726d6e85..fe726ee1 100644 --- a/charts/model-engine/templates/gateway_deployment.yaml +++ b/charts/model-engine/templates/gateway_deployment.yaml @@ -60,6 +60,7 @@ spec: path: /readyz port: 5000 periodSeconds: 2 + timeoutSeconds: {{ ((.Values.gateway).readinessProbeTimeoutSeconds | default 5) }} failureThreshold: 30 command: - dumb-init diff --git a/charts/model-engine/values.yaml b/charts/model-engine/values.yaml index 15ba6bf9..15ce1eeb 100644 --- a/charts/model-engine/values.yaml +++ b/charts/model-engine/values.yaml @@ -33,6 +33,12 @@ celery_broker_type_redis: null # drop: # - ALL +# gateway [optional] tuning for the gateway deployment. +gateway: + # readinessProbeTimeoutSeconds sets the /readyz probe timeout. The k8s default of 1s + # ejects saturated-but-healthy pods and concentrates load on the survivors. + readinessProbeTimeoutSeconds: 5 + redis: auth: authSecretName: "" diff --git a/model-engine/model_engine_server/api/app.py b/model-engine/model_engine_server/api/app.py index 534aebb5..4c77e1de 100644 --- a/model-engine/model_engine_server/api/app.py +++ b/model-engine/model_engine_server/api/app.py @@ -313,8 +313,13 @@ def load_redis(): get_or_create_aioredis_pool() -def healthcheck() -> Response: - """Returns 200 if the app is healthy.""" +async def healthcheck() -> Response: + """Returns 200 if the app is healthy. + + Must be async: a sync handler runs in the shared threadpool, so under load the + probe queues behind blocked requests and misses its timeout, ejecting pods that + are saturated but healthy. + """ return Response(status_code=200)