From f9da3c74b9d5eb3e7b335f5eafc66da7041df366 Mon Sep 17 00:00:00 2001 From: James Wang Date: Wed, 23 Dec 2015 17:24:37 -0500 Subject: [PATCH] Calculate number of workers for gunicorn --- deploy | 2 +- scripts/gunicorn.py.ini | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 scripts/gunicorn.py.ini diff --git a/deploy b/deploy index 4789c79..fc3edc2 100755 --- a/deploy +++ b/deploy @@ -7,4 +7,4 @@ sudo service nginx stop echo "Starting the server..." cd /home/vagrant/server sudo service nginx start -gunicorn --bind 0.0.0.0:8000 -w 1 "app:app" \ No newline at end of file +gunicorn "app:app" -c /home/vagrant/scripts/gunicorn.py.ini diff --git a/scripts/gunicorn.py.ini b/scripts/gunicorn.py.ini new file mode 100644 index 0000000..d8cdb2c --- /dev/null +++ b/scripts/gunicorn.py.ini @@ -0,0 +1,4 @@ +from multiprocessing import cpu_count + +bind = "0.0.0.0:8000" +workers = cpu_count() * 2 + 1