NewsBlur/config/gunicorn_conf.py

24 lines
601 B
Python
Raw Normal View History

2013-06-24 12:38:00 -07:00
from vendor import psutil
2013-03-13 23:21:30 -07:00
import math
2011-02-09 15:45:41 -05:00
GIGS_OF_MEMORY = psutil.TOTAL_PHYMEM/1024/1024/1024.
2012-07-20 19:50:11 -07:00
NUM_CPUS = psutil.NUM_CPUS
2011-02-09 15:45:41 -05:00
bind = "0.0.0.0:8000"
2013-02-25 19:01:04 -08:00
pidfile = "/srv/newsblur/logs/gunicorn.pid"
logfile = "/srv/newsblur/logs/production.log"
accesslog = "/srv/newsblur/logs/production.log"
errorlog = "/srv/newsblur/logs/errors.log"
2011-02-09 15:45:41 -05:00
loglevel = "debug"
name = "newsblur"
timeout = 120
max_requests = 1000
2012-07-20 19:50:11 -07:00
if GIGS_OF_MEMORY > NUM_CPUS:
workers = NUM_CPUS
else:
2012-07-20 19:50:11 -07:00
workers = int(NUM_CPUS / 2)
2013-03-13 23:21:30 -07:00
2013-03-14 18:57:35 -07:00
if workers <= 4:
2013-03-14 22:41:03 -07:00
workers = max(int(math.floor(GIGS_OF_MEMORY * 1000 / 512)), 4)
2013-03-14 19:03:33 -07:00
if workers > 8:
workers = 8