From 292f08d52943a0411248f62a95df9271f7eb5bd2 Mon Sep 17 00:00:00 2001 From: Steven Recio Date: Mon, 25 Apr 2016 13:59:12 -0400 Subject: [PATCH] Added ability to override the default number of gunicorn workers as well as updated the default to match the gunicorn documentation: (2 * num_cores) + 1 Source: http://docs.gunicorn.org/en/stable/design.html#how-many-workers --- manifests/gunicorn.pp | 1 + templates/gunicorn.erb | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 37739875..92a07c25 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -77,6 +77,7 @@ $appmodule = 'app:app', $osenv = false, $timeout = 30, + $workers = false, $access_log_format = false, $accesslog = false, $errorlog = false, diff --git a/templates/gunicorn.erb b/templates/gunicorn.erb index ca01e7d7..632c962f 100644 --- a/templates/gunicorn.erb +++ b/templates/gunicorn.erb @@ -31,7 +31,11 @@ CONFIG = { <% else -%> '--bind=<%= @bind %>', <% end -%> - '--workers=<%= @processorcount.to_i*2 %>', +<% if @workers -%> + '--workers=<%= @workers %>' +<% else -%> + '--workers=<%= @processorcount.to_i*2 + 1 %>', +<% end -%> '--timeout=<%= @timeout %>', <% if @access_log_format -%> '--access-logformat=<%= @access_log_format %>',