Crazyconoli
Crazyconoli

Reputation: 671

Supervisor Django Gunicorn Gevent Memory Usage

I am running Django 1.4 sites on Ubuntu 12.04 with supervisor 3.0a8-1.1 and have run into a strange problem with gunicorn 0.17.2 and gevent 0.13.8.

Supervisor's memory usage keeps growing until the server is not responsive.

There are 5 sites with the following supervisor configs:

command=/app/virtualenv/bin/newrelic-admin run-program /app/virtualenv/bin/python /app/manage.py run_gunicorn -c gunicorn_conf.py -k gevent
directory=/app
autostart=true
autorestart=true
stopsignal=KILL
killasgroup=true
environment=NEW_RELIC_CONFIG_FILE='/app/newrelic.ini'

and the following gunicorn configs:

workers = 4
bind = '0.0.0.0:(Site Port Number)'

These are all being reverse proxied to via NGINX.

I am running these on a large EC2 instance which has 2 cores and 7.3GB of RAM which should be way more than I need.

Has anyone else run into this problem?

Upvotes: 3

Views: 2455

Answers (1)

Jack Shedd
Jack Shedd

Reputation: 3531

If memory is clearing correctly when you just run the projects without supervisord, that's baffling.

Supervisord is just a daemon manager. It doesn't do anything but launch and manage a process, which, in this case, is just manage.py.

The only thing I could think is that autorestart is turned on, which has been known to cause a memory leak, if supervisor is constantly restarting the process because it detects a change and errors don't get cleared out. This was actually fixed in supervisor 3.0b1. Maybe update your supervisor?

Upvotes: 5

Related Questions