From 7a137e23557cf9111dfec35c1c44c082d461eebc Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Fri, 13 Oct 2017 08:49:12 +0300 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. [1] https://wiki.python.org/moin/GlobalInterpreterLock Change-Id: I116df85f259528d547a958850b9c3793d01e2a45 --- manifests/wsgi/apache.pp | 8 ++++---- manifests/wsgi/apache_api.pp | 8 ++++---- manifests/wsgi/apache_api_cfn.pp | 8 ++++---- manifests/wsgi/apache_api_cloudwatch.pp | 8 ++++---- spec/classes/heat_wsgi_apache_api_cfn_spec.rb | 4 ++-- spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb | 4 ++-- spec/classes/heat_wsgi_apache_api_spec.rb | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 3f50dc0c..fb7671bf 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -46,7 +46,7 @@ # # [*workers*] # Number of WSGI workers to spawn. -# Optional. Defaults to 1 +# Optional. Defaults to $::os_workers # # [*priority*] # (optional) The priority for the vhost. @@ -54,7 +54,7 @@ # # [*threads*] # (optional) The number of threads for the vhost. -# Defaults to $::os_workers +# Defaults to 1 # # [*ssl_cert*] # [*ssl_key*] @@ -105,7 +105,7 @@ define heat::wsgi::apache ( $bind_host = undef, $path = '/', $ssl = true, - $workers = 1, + $workers = $::os_workers, $ssl_cert = undef, $ssl_key = undef, $ssl_chain = undef, @@ -113,7 +113,7 @@ define heat::wsgi::apache ( $ssl_crl_path = undef, $ssl_crl = undef, $ssl_certs_dir = undef, - $threads = $::os_workers, + $threads = 1, $priority = '10', $vhost_custom_fragment = undef, $access_log_file = false, diff --git a/manifests/wsgi/apache_api.pp b/manifests/wsgi/apache_api.pp index 2a51417b..84d31313 100644 --- a/manifests/wsgi/apache_api.pp +++ b/manifests/wsgi/apache_api.pp @@ -41,7 +41,7 @@ # # [*workers*] # Number of WSGI workers to spawn. -# Optional. Defaults to 1 +# Optional. Defaults to $::os_workers # # [*priority*] # (optional) The priority for the vhost. @@ -49,7 +49,7 @@ # # [*threads*] # (optional) The number of threads for the vhost. -# Defaults to $::os_workers +# Defaults to 1 # # [*ssl_cert*] # [*ssl_key*] @@ -85,7 +85,7 @@ class heat::wsgi::apache_api ( $bind_host = undef, $path = '/', $ssl = true, - $workers = 1, + $workers = $::os_workers, $ssl_cert = undef, $ssl_key = undef, $ssl_chain = undef, @@ -93,7 +93,7 @@ class heat::wsgi::apache_api ( $ssl_crl_path = undef, $ssl_crl = undef, $ssl_certs_dir = undef, - $threads = $::os_workers, + $threads = 1, $priority = '10', $custom_wsgi_process_options = {}, ) { diff --git a/manifests/wsgi/apache_api_cfn.pp b/manifests/wsgi/apache_api_cfn.pp index b3594e53..6b1754af 100644 --- a/manifests/wsgi/apache_api_cfn.pp +++ b/manifests/wsgi/apache_api_cfn.pp @@ -41,7 +41,7 @@ # # [*workers*] # Number of WSGI workers to spawn. -# Optional. Defaults to 1 +# Optional. Defaults to $::os_workers # # [*priority*] # (optional) The priority for the vhost. @@ -49,7 +49,7 @@ # # [*threads*] # (optional) The number of threads for the vhost. -# Defaults to $::os_workers +# Defaults to 1 # # [*ssl_cert*] # [*ssl_key*] @@ -85,7 +85,7 @@ class heat::wsgi::apache_api_cfn ( $bind_host = undef, $path = '/', $ssl = true, - $workers = 1, + $workers = $::os_workers, $ssl_cert = undef, $ssl_key = undef, $ssl_chain = undef, @@ -93,7 +93,7 @@ class heat::wsgi::apache_api_cfn ( $ssl_crl_path = undef, $ssl_crl = undef, $ssl_certs_dir = undef, - $threads = $::os_workers, + $threads = 1, $priority = '10', $custom_wsgi_process_options = {}, ) { diff --git a/manifests/wsgi/apache_api_cloudwatch.pp b/manifests/wsgi/apache_api_cloudwatch.pp index ffd6726e..01ef8a96 100644 --- a/manifests/wsgi/apache_api_cloudwatch.pp +++ b/manifests/wsgi/apache_api_cloudwatch.pp @@ -41,7 +41,7 @@ # # [*workers*] # Number of WSGI workers to spawn. -# Optional. Defaults to 1 +# Optional. Defaults to $::os_workers # # [*priority*] # (optional) The priority for the vhost. @@ -49,7 +49,7 @@ # # [*threads*] # (optional) The number of threads for the vhost. -# Defaults to $::os_workers +# Defaults to 1 # # [*ssl_cert*] # [*ssl_key*] @@ -85,7 +85,7 @@ class heat::wsgi::apache_api_cloudwatch ( $bind_host = undef, $path = '/', $ssl = true, - $workers = 1, + $workers = $::os_workers, $ssl_cert = undef, $ssl_key = undef, $ssl_chain = undef, @@ -93,7 +93,7 @@ class heat::wsgi::apache_api_cloudwatch ( $ssl_crl_path = undef, $ssl_crl = undef, $ssl_certs_dir = undef, - $threads = $::os_workers, + $threads = 1, $priority = '10', $custom_wsgi_process_options = {}, ) { diff --git a/spec/classes/heat_wsgi_apache_api_cfn_spec.rb b/spec/classes/heat_wsgi_apache_api_cfn_spec.rb index b0a921b8..16a33375 100644 --- a/spec/classes/heat_wsgi_apache_api_cfn_spec.rb +++ b/spec/classes/heat_wsgi_apache_api_cfn_spec.rb @@ -11,14 +11,14 @@ describe 'heat::wsgi::apache_api_cfn' do :bind_host => nil, :path => '/', :ssl => true, - :workers => 1, + :workers => facts[:os_workers], :ssl_cert => nil, :ssl_key => nil, :ssl_chain => nil, :ssl_ca => nil, :ssl_crl_path => nil, :ssl_certs_dir => nil, - :threads => facts[:os_workers], + :threads => 1, :priority => 10, :custom_wsgi_process_options => {}, :access_log_file => false, diff --git a/spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb b/spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb index 3822d9b4..c32f46d6 100644 --- a/spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb +++ b/spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb @@ -11,14 +11,14 @@ describe 'heat::wsgi::apache_api_cloudwatch' do :bind_host => nil, :path => '/', :ssl => true, - :workers => 1, + :workers => facts[:os_workers], :ssl_cert => nil, :ssl_key => nil, :ssl_chain => nil, :ssl_ca => nil, :ssl_crl_path => nil, :ssl_certs_dir => nil, - :threads => facts[:os_workers], + :threads => 1, :priority => 10, :custom_wsgi_process_options => {}, ) } diff --git a/spec/classes/heat_wsgi_apache_api_spec.rb b/spec/classes/heat_wsgi_apache_api_spec.rb index a33c8416..096cea47 100644 --- a/spec/classes/heat_wsgi_apache_api_spec.rb +++ b/spec/classes/heat_wsgi_apache_api_spec.rb @@ -11,14 +11,14 @@ describe 'heat::wsgi::apache_api' do :bind_host => nil, :path => '/', :ssl => true, - :workers => 1, + :workers => facts[:os_workers], :ssl_cert => nil, :ssl_key => nil, :ssl_chain => nil, :ssl_ca => nil, :ssl_crl_path => nil, :ssl_certs_dir => nil, - :threads => facts[:os_workers], + :threads => 1, :priority => 10, :custom_wsgi_process_options => {}, :access_log_file => false,