Skip to content

Commit

Permalink
Increase number of HTTP workers (#72)
Browse files Browse the repository at this point in the history
* Use 5 workers by default for gunicorn

* Add more workers

* Start gunicorn workers based on number of CPUs

* Split options for readability
  • Loading branch information
ivan-c authored Nov 1, 2024
1 parent 6d351b3 commit 53cb0a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ ENV FLASK_APP=sof_wrapper.app:create_app() \

EXPOSE "${PORT}"

CMD gunicorn --bind "0.0.0.0:${PORT:-8000}" ${FLASK_APP}
# launch workers based on number of CPUs: 2n+1
CMD gunicorn \
--workers="$((2*$(nproc)+1))" \
--bind "0.0.0.0:${PORT:-8000}" \
${FLASK_APP}

0 comments on commit 53cb0a8

Please sign in to comment.