-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-restart web dynos regularly (#2074)
- Loading branch information
1 parent
b19e222
commit d8293c6
Showing
1 changed file
with
11 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
release: ./heroku-release-phase.sh | ||
web: gunicorn server.app:app --preload | ||
# gunicorn runs multiple worker processes based on the WEB_CONCURRENCY | ||
# environment variable (set by Heroku automatically based on dyno size). | ||
# https://devcenter.heroku.com/articles/python-concurrency#common-runtime | ||
# At the time of writing, we use Standard-2x dynos, which results in 4 workers. | ||
# To tame slow memory leakage that we've observed but haven't solved, we | ||
# configure gunicorn to restart each worker after a certain number of requests | ||
# (with some random jitter). This threshold was set by observing how long it | ||
# took for memory to rise to an unacceptable level during peak traffic, then | ||
# counting the number of requests in that interval and dividing by the number | ||
# of workers. | ||
web: gunicorn server.app:app --preload --max-requests 1000 --max-requests-jitter 50 | ||
worker: python -m server.worker.worker | ||
slack_worker: python -m server.activity_log.slack_worker |