From fa0780b9d06ca571b063ca8f548ffd66a77eeaa7 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Fri, 4 Nov 2016 13:36:11 -0400 Subject: [PATCH] Optimize uwsgi launching in dev container and prod * Set --master flag so we have a preforking master process to manage subprocs * Set max-requests to 1000 so uwsgi will recycle processes after 1000 requests * Set --no-orphans so uwsgi will track child processes and clean them up in order to respawn children * Turn stats on in the container and install uwsgitop in dev requirements so we can track uwsgi stats --- Makefile | 2 +- requirements/requirements_dev.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b39e7a2501..a1392da135 100644 --- a/Makefile +++ b/Makefile @@ -404,7 +404,7 @@ uwsgi: collectstatic @if [ "$(VENV_BASE)" ]; then \ . $(VENV_BASE)/tower/bin/activate; \ fi; \ - uwsgi -b 32768 --socket :8050 --module=awx.wsgi:application --home=/venv/tower --chdir=/tower_devel/ --vacuum --processes=5 --harakiri=60 --py-autoreload 1 + uwsgi -b 32768 --socket :8050 --module=awx.wsgi:application --home=/venv/tower --chdir=/tower_devel/ --vacuum --processes=5 --harakiri=60 --master --no-orphans --py-autoreload 1 --max-requests=1000 --stats /tmp/stats.socket daphne: @if [ "$(VENV_BASE)" ]; then \ diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index ab622d1343..9912b59bd4 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -11,3 +11,4 @@ pytest-django pytest-pythonpath pytest-mock flower +uwsgitop