For the python web folks, what web server do you tend to put in front of your Django/Flask apps and how do you typically deploy new updates with zero downtime?
This is our gunicorn.conf that ensures gunicorn does not cause memory leaks
import multiprocessing
import os
import random
from getenv import env
def pre_fork(server, worker):
f = '/tmp/app-initialized'
open(f, 'w').close()
bind = 'unix:///tmp/nginx.socket'
workers = os.environ.get('WEB_CONCURRENCY',
(multiprocessing.cpu_count() * 1 - 1))
MAX_GUNICORN_REQUESTS = env('MAX_GUNICORN_REQUESTS', 100)
if MAX_GUNICORN_REQUESTS:
max_requests = MAX_GUNICORN_REQUESTS
MAX_REQUESTS_JITTER = env('MAX_REQUESTS_JITTER', 25)
if MAX_REQUESTS_JITTER:
max_requests_jitter = env('MAX_REQUESTS_JITTER', 25)Having multiple instances behind a reverse proxy allows you to do rolling deploys, which will have no downtime.
Now I use kubernetes with uwsgi. Once you are kubernetes any app server works, so went uwsgi because it is very very simple.