From 0545625da9f83c123de854fa2c6ff05b941d56e7 Mon Sep 17 00:00:00 2001 From: Ahmad Mahmoudi Date: Mon, 3 Aug 2020 16:56:56 +0000 Subject: [PATCH] Scaling deckhand uwsgi workers Updated obsolete uwsgi default configuration parameters for better performance. Increased number of worker threads to increase performance. Uplifted uwsgi to the latest for bug fixes since 2018. For more info please see: https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html Change-Id: Ifedb9c6279e64be86deb6ec375810c5ecf97958a --- charts/deckhand/templates/deployment.yaml | 2 +- charts/deckhand/values.yaml | 2 +- entrypoint.sh | 11 +++++++---- requirements.txt | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/charts/deckhand/templates/deployment.yaml b/charts/deckhand/templates/deployment.yaml index 517b2456..46ae3def 100644 --- a/charts/deckhand/templates/deployment.yaml +++ b/charts/deckhand/templates/deployment.yaml @@ -66,7 +66,7 @@ spec: - name: 'DECKHAND_API_WORKERS' value: {{ .Values.conf.uwsgi.workers | default 1 | quote }} - name: 'DECKHAND_API_THREADS' - value: {{ .Values.conf.uwsgi.threads | default 4 | quote }} + value: {{ .Values.conf.uwsgi.threads | default 16 | quote }} image: {{ .Values.images.tags.deckhand }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} diff --git a/charts/deckhand/values.yaml b/charts/deckhand/values.yaml index 244e5c56..431203d7 100644 --- a/charts/deckhand/values.yaml +++ b/charts/deckhand/values.yaml @@ -234,7 +234,7 @@ conf: # SQLAlchemy engine pooled connection strings when workers > 1. As a # workaround, we use multiple threads but only 1 worker. For more # information, see: https://github.com/att-comdev/deckhand/issues/20 - threads: 4 + threads: 16 workers: 1 policy: admin_api: role:admin diff --git a/entrypoint.sh b/entrypoint.sh index 8dd47d08..2f43b2d4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,7 +30,7 @@ DECKHAND_API_TIMEOUT=${DECKHAND_API_TIMEOUT:-"600"} # Number of uWSGI workers to handle API requests DECKHAND_API_WORKERS=${DECKHAND_API_WORKERS:-"1"} # Threads per worker -DECKHAND_API_THREADS=${DECKHAND_API_THREADS:-"4"} +DECKHAND_API_THREADS=${DECKHAND_API_THREADS:-"16"} # The Deckhand configuration directory containing deckhand.conf DECKHAND_CONFIG_DIR=${DECKHAND_CONFIG_DIR:-"/etc/deckhand"} @@ -43,13 +43,16 @@ if [ "$1" = 'server' ]; then --die-on-term \ --enable-threads \ --http :${PORT} \ - --http-timeout $DECKHAND_API_TIMEOUT \ + --http-timeout ${DECKHAND_API_TIMEOUT} \ -L \ --lazy-apps \ --master \ --pyargv "--config-file ${DECKHAND_CONFIG_DIR}/deckhand.conf" \ - --threads $DECKHAND_API_THREADS \ - --workers $DECKHAND_API_WORKERS \ + --threads ${DECKHAND_API_THREADS} \ + --workers ${DECKHAND_API_WORKERS} \ + --strict \ + --vacuum \ + --need-app \ -w deckhand.cmd elif [ "$1" = 'alembic' ]; then exec alembic ${@:2} diff --git a/requirements.txt b/requirements.txt index ea22a666..7383ec08 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,6 +43,6 @@ Routes==2.4.1 six==1.11.0 stevedore==1.30.0 urllib3==1.24.3 -uwsgi==2.0.17.1 +uwsgi~=2.0.19.1 # To support profiling in non-prod Werkzeug==0.16.1