From bb548588242086e921ca6b5117501dfaff2d8a8e Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 8 Aug 2018 14:11:42 +0200 Subject: [PATCH] apache wsgi: Exchange defaults for workers and threads Due to Python's GIL [1], we can't use multiple threads for running OpenStack services without a performance penalty, since the execution ends up serialized, which defeats the purpose. Instead, we should use several processes, since this approach doesn't have this limitation. See the same kind of change here [2] [1] https://wiki.python.org/moin/GlobalInterpreterLock [2] https://review.openstack.org/#/c/505192/ Change-Id: I9c1ef8991d63b18a0ec106a05576b74ab457a2a0 --- manifests/wsgi/apache.pp | 8 +++--- ...gi-processes-threads-66255fc01d1d48ed.yaml | 6 +++++ spec/classes/horizon_wsgi_apache_spec.rb | 25 ++++++++++--------- 3 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/apache-wsgi-processes-threads-66255fc01d1d48ed.yaml diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 17e601a3..c1e1d661 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -40,11 +40,11 @@ # # [*wsgi_processes*] # (optional) Number of Horizon processes to spawn -# Defaults to '3' +# Defaults to $::os_workers # # [*wsgi_threads*] # (optional) Number of thread to run in a Horizon process -# Defaults to '10' +# Defaults to '1' # # [*custom_wsgi_process_options*] # (optional) gives you the oportunity to add custom process options or to @@ -98,8 +98,8 @@ class horizon::wsgi::apache ( $horizon_cert = undef, $horizon_key = undef, $horizon_ca = undef, - $wsgi_processes = '3', - $wsgi_threads = '10', + $wsgi_processes = $::os_workers, + $wsgi_threads = '1', $custom_wsgi_process_options = {}, $priority = '15', $vhost_conf_name = 'horizon_vhost', diff --git a/releasenotes/notes/apache-wsgi-processes-threads-66255fc01d1d48ed.yaml b/releasenotes/notes/apache-wsgi-processes-threads-66255fc01d1d48ed.yaml new file mode 100644 index 00000000..3d79f581 --- /dev/null +++ b/releasenotes/notes/apache-wsgi-processes-threads-66255fc01d1d48ed.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The default value for horizon::wsgi::apache::wsgi_processes changed to $::os_workers + - | + The default value for horizon::wsgi::apache::wsgi_threads changed to 1 diff --git a/spec/classes/horizon_wsgi_apache_spec.rb b/spec/classes/horizon_wsgi_apache_spec.rb index 6414c9f6..e9e34a00 100644 --- a/spec/classes/horizon_wsgi_apache_spec.rb +++ b/spec/classes/horizon_wsgi_apache_spec.rb @@ -3,9 +3,7 @@ require 'spec_helper' describe 'horizon::wsgi::apache' do let :params do { - :servername => 'some.host.tld', - :wsgi_processes => '3', - :wsgi_threads => '10', + :servername => 'some.host.tld', } end @@ -46,8 +44,8 @@ describe 'horizon::wsgi::apache' do :wsgi_daemon_process => platforms_params[:wsgi_group], :wsgi_application_group => '%{GLOBAL}', :wsgi_daemon_process_options => { - 'processes' => params[:wsgi_processes], - 'threads' => params[:wsgi_threads], + 'processes' => facts[:os_workers], + 'threads' => '1', 'user' => platforms_params[:unix_user], 'group' => platforms_params[:unix_group], 'display-name' => 'horizon' @@ -58,8 +56,10 @@ describe 'horizon::wsgi::apache' do context 'with overridden parameters' do before do params.merge!({ - :priority => '10', - :redirect_type => 'temp', + :priority => '10', + :redirect_type => 'temp', + :wsgi_processes => '13', + :wsgi_threads => '3' }) end @@ -88,8 +88,8 @@ describe 'horizon::wsgi::apache' do :wsgi_daemon_process => platforms_params[:wsgi_group], :wsgi_application_group => '%{GLOBAL}', :wsgi_daemon_process_options => { - 'processes' => params[:wsgi_processes], - 'threads' => params[:wsgi_threads], + 'processes' => '13', + 'threads' => '3', 'user' => platforms_params[:unix_user], 'group' => platforms_params[:unix_group], 'display-name' => 'horizon' @@ -109,8 +109,8 @@ describe 'horizon::wsgi::apache' do it { should contain_apache__vhost('horizon_vhost').with( :wsgi_daemon_process_options => { - 'processes' => params[:wsgi_processes], - 'threads' => params[:wsgi_threads], + 'processes' => facts[:os_workers], + 'threads' => '1', 'user' => 'myuser', 'group' => platforms_params[:unix_group], 'display-name' => 'horizon', @@ -492,7 +492,8 @@ describe 'horizon::wsgi::apache' do facts.merge!(OSDefaults.get_facts({ :fqdn => 'some.host.tld', - :concat_basedir => '/var/lib/puppet/concat' + :concat_basedir => '/var/lib/puppet/concat', + :os_workers => '6' })) end