Skip to content

Commit

Permalink
Switch from uWSGI to Gunicorn
Browse files Browse the repository at this point in the history
While uWSGI has a lot of options and is theoretically better than
gunicorn, we're going to switch back to gunicorn. uWSGI breaks a lot
of the rules of a Python interpreter in order to squeeze out more
performance and the sum of all of these made working with it
difficult.

We'll use gunicorn with the gevent worker so that we don't block
threads when there are large uploads happening.
  • Loading branch information
dstufft committed Nov 13, 2015
1 parent 0bc1ab5 commit 8c7f49f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 45 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ RUN set -x \
&& apt-get update \
&& apt-get install gcc libpq-dev libffi-dev --no-install-recommends -y \
&& pip install -U pip setuptools \
&& pip install pyinotify \
&& pip install -c requirements.txt uwsgi \
&& pip install -c requirements.txt gunicorn gevent setproctitle \
&& pip install -c requirements.txt -r requirements-dev.txt -e . \
&& find /usr/local -type f -name '*.pyc' -name '*.pyo' -delete \
&& rm -rf ~/.cache/ \
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: bin/redis-tls bin/fastly-config && bin/redis-tls newrelic-admin run-program uwsgi --ini=uwsgi.ini --processes=${WEB_CONCURRENCY:=1}
web: bin/redis-tls bin/fastly-config && bin/redis-tls newrelic-admin run-program gunicorn -b 0.0.0.0:$PORT -n warehouse -k gevent --preload warehouse.wsgi
worker: bin/redis-tls newrelic-admin run-program celery -A warehouse worker -l info
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ app:
web:
extends:
service: app
command: uwsgi --ini=uwsgi.ini --processes=1 --py-autoreload=3
command: gunicorn -b 0.0.0.0:8000 -n warehouse -k gevent --reload warehouse.wsgi
environment:
PORT: 8000
ports:
Expand Down
7 changes: 6 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# $ invoke pip.compile
#

-f https://github.com/benoitc/gunicorn/archive/master.zip#egg=gunicorn-19.4.dev

alembic==0.8.3
amqp==1.4.7 # via kombu
anyjson==0.3.3 # via kombu
Expand All @@ -21,6 +23,9 @@ click==5.1
docutils==0.12 # via botocore, readme
elasticsearch-dsl==0.0.9
elasticsearch==2.1.0 # via elasticsearch-dsl
gevent==1.1b6
greenlet==0.4.9 # via gevent
gunicorn==19.4.dev0
hiredis==0.2.0
html5lib==0.9999999 # via bleach
itsdangerous==0.24
Expand Down Expand Up @@ -53,14 +58,14 @@ redis==2.10.5
repoze.lru==0.6 # via pyramid
requests==2.8.1
rfc3986==0.3.0
setproctitle==1.1.9
six==1.10.0 # via bcrypt, bleach, elasticsearch-dsl, html5lib, python-dateutil, readme
sqlalchemy-citext==1.3.post0
sqlalchemy==1.0.9 # via alembic, sqlalchemy-citext, zope.sqlalchemy
structlog==15.3.0
transaction==1.4.4 # via pyramid-tm, zope.sqlalchemy
translationstring==1.3 # via pyramid
urllib3==1.12 # via elasticsearch
uwsgi==2.0.11.2
venusian==1.0 # via pyramid, pyramid-rpc
webob==1.5.1 # via pyramid
wtforms==2.0.2
Expand Down
9 changes: 8 additions & 1 deletion tasks/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@


REQUIREMENTS_IN = """
-f https://github.com/benoitc/gunicorn/archive/master.zip#egg=gunicorn-19.4.dev
-e .
newrelic
uwsgi
gevent>=1.1a1
gunicorn>=19.4.dev
setproctitle
"""


Expand All @@ -32,6 +37,8 @@
# $ invoke pip.compile
#
-f https://github.com/benoitc/gunicorn/archive/master.zip#egg=gunicorn-19.4.dev
""".lstrip()


Expand Down
39 changes: 0 additions & 39 deletions uwsgi.ini

This file was deleted.

0 comments on commit 8c7f49f

Please sign in to comment.