From 2b0fc9087ff6ef5ea1066a391035c4484d363df8 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Thu, 18 Dec 2014 11:53:10 -0500 Subject: [PATCH] Performance improvements meant to help get jobs off of the load balancer more quickly. --- Dockerfile.buildworker | 15 +++++++++++---- Dockerfile.web | 13 ++++++++++--- conf/init/gunicorn_registry/run | 2 +- conf/init/gunicorn_verbs/run | 2 +- conf/nginx-nossl.conf | 6 ------ conf/nginx.conf | 6 ------ conf/root-base.conf | 10 +++++++++- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Dockerfile.buildworker b/Dockerfile.buildworker index 4b6f995b9..09c1c91b7 100644 --- a/Dockerfile.buildworker +++ b/Dockerfile.buildworker @@ -1,23 +1,30 @@ # vim:ft=dockerfile + +############################### +# BEGIN COMMON SECION +############################### + FROM phusion/baseimage:0.9.15 ENV DEBIAN_FRONTEND noninteractive ENV HOME /root # Install the dependencies. -RUN apt-get update # 20NOV2014 +RUN apt-get update # 11DEC2014 # New ubuntu packages should be added as their own apt-get install lines below the existing install commands -RUN apt-get install -y git python-virtualenv python-dev libjpeg8 libjpeg62 libjpeg62-dev libevent-2.0.5 libevent-dev gdebi-core g++ libmagic1 phantomjs nodejs npm libldap-2.4-2 libldap2-dev libsasl2-modules libsasl2-dev libpq5 libpq-dev +RUN apt-get install -y git python-virtualenv python-dev libjpeg8 libjpeg62 libjpeg62-dev libevent-2.0.5 libevent-dev gdebi-core g++ libmagic1 phantomjs nodejs npm libldap-2.4-2 libldap2-dev libsasl2-modules libsasl2-dev libpq5 libpq-dev libfreetype6-dev libffi-dev # Build the python dependencies ADD requirements.txt requirements.txt RUN virtualenv --distribute venv RUN venv/bin/pip install -r requirements.txt -RUN apt-get remove -y --auto-remove python-dev g++ libjpeg62-dev libevent-dev libldap2-dev libsasl2-dev libpq-dev +RUN apt-get remove -y --auto-remove python-dev g++ libjpeg62-dev libevent-dev libldap2-dev libsasl2-dev libpq-dev libffi-dev -### End common section ### +############################### +# END COMMON SECION +############################### RUN apt-get install -y lxc aufs-tools diff --git a/Dockerfile.web b/Dockerfile.web index bd07d9999..d50256b2a 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -1,4 +1,9 @@ # vim:ft=dockerfile + +############################### +# BEGIN COMMON SECION +############################### + FROM phusion/baseimage:0.9.15 ENV DEBIAN_FRONTEND noninteractive @@ -8,16 +13,18 @@ ENV HOME /root RUN apt-get update # 11DEC2014 # New ubuntu packages should be added as their own apt-get install lines below the existing install commands -RUN apt-get install -y git python-virtualenv python-dev libjpeg8 libjpeg62 libjpeg62-dev libevent-2.0.5 libevent-dev gdebi-core g++ libmagic1 phantomjs nodejs npm libldap-2.4-2 libldap2-dev libsasl2-modules libsasl2-dev libpq5 libpq-dev libfreetype6-dev +RUN apt-get install -y git python-virtualenv python-dev libjpeg8 libjpeg62 libjpeg62-dev libevent-2.0.5 libevent-dev gdebi-core g++ libmagic1 phantomjs nodejs npm libldap-2.4-2 libldap2-dev libsasl2-modules libsasl2-dev libpq5 libpq-dev libfreetype6-dev libffi-dev # Build the python dependencies ADD requirements.txt requirements.txt RUN virtualenv --distribute venv RUN venv/bin/pip install -r requirements.txt -RUN apt-get remove -y --auto-remove python-dev g++ libjpeg62-dev libevent-dev libldap2-dev libsasl2-dev libpq-dev +RUN apt-get remove -y --auto-remove python-dev g++ libjpeg62-dev libevent-dev libldap2-dev libsasl2-dev libpq-dev libffi-dev -### End common section ### +############################### +# END COMMON SECION +############################### # Remove SSH. RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh diff --git a/conf/init/gunicorn_registry/run b/conf/init/gunicorn_registry/run index a0a09f5a2..3c88fd0e3 100755 --- a/conf/init/gunicorn_registry/run +++ b/conf/init/gunicorn_registry/run @@ -3,6 +3,6 @@ echo 'Starting gunicon' cd / -venv/bin/gunicorn -c conf/gunicorn_registry.py registry:application +nice -n 10 venv/bin/gunicorn -c conf/gunicorn_registry.py registry:application echo 'Gunicorn exited' \ No newline at end of file diff --git a/conf/init/gunicorn_verbs/run b/conf/init/gunicorn_verbs/run index 1cf2ee51c..d76a7adcf 100755 --- a/conf/init/gunicorn_verbs/run +++ b/conf/init/gunicorn_verbs/run @@ -3,6 +3,6 @@ echo 'Starting gunicon' cd / -nice -10 venv/bin/gunicorn -c conf/gunicorn_verbs.py verbs:application +nice -n 10 venv/bin/gunicorn -c conf/gunicorn_verbs.py verbs:application echo 'Gunicorn exited' \ No newline at end of file diff --git a/conf/nginx-nossl.conf b/conf/nginx-nossl.conf index fbcce63c0..cc985906a 100644 --- a/conf/nginx-nossl.conf +++ b/conf/nginx-nossl.conf @@ -1,11 +1,5 @@ include root-base.conf; -worker_processes 2; - -user root nogroup; - -daemon off; - http { include http-base.conf; diff --git a/conf/nginx.conf b/conf/nginx.conf index e208d30e0..01d554ae2 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,11 +1,5 @@ include root-base.conf; -worker_processes 2; - -user root nogroup; - -daemon off; - http { include http-base.conf; diff --git a/conf/root-base.conf b/conf/root-base.conf index be8072945..e6be69bb3 100644 --- a/conf/root-base.conf +++ b/conf/root-base.conf @@ -1,7 +1,15 @@ pid /tmp/nginx.pid; error_log /var/log/nginx/nginx.error.log; +worker_processes 2; +worker_priority -10; +worker_rlimit_nofile = 10240; + +user root nogroup; + +daemon off; + events { - worker_connections 1024; + worker_connections 10240; accept_mutex off; }