From 63d73db1164da00d032759734a2acb49d95e984e Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff Date: Tue, 21 Jun 2016 18:58:51 +0300 Subject: [PATCH] Remove erlang/rabbit thread pool calculation Proper version of this calculation is implemented upstream - https://github.com/rabbitmq/rabbitmq-server/issues/151 And removed version of the code is actually harmful, as it's using physicalprocessorcount (i.e. number of CPU sockets) for calculations. So on a 2 CPU/48 thread system there it was 30 threads instead of 768 calculated upstream. I've decided that it's easier to completely remove this code instead of duplicating current formula in upstream and providing a way to override this value through hiera - just not worth a hassle. Change-Id: I415d446af0a822d2a5ce3478fd9db1dd0f13e115 Closes-Bug: 1573696 (cherry picked from commit 0c16cbc9a723edfc7a9edd08faac8f5fc1b974bf) --- deployment/puppet/fuel/examples/rabbitmq.pp | 4 +--- .../puppet/osnailyfacter/manifests/rabbitmq/rabbitmq.pp | 4 +--- tests/noop/spec/hosts/master/rabbitmq_spec.rb | 6 +----- tests/noop/spec/hosts/rabbitmq/rabbitmq_spec.rb | 7 +------ 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/deployment/puppet/fuel/examples/rabbitmq.pp b/deployment/puppet/fuel/examples/rabbitmq.pp index 55de0d75e0..6eeee5d6ae 100644 --- a/deployment/puppet/fuel/examples/rabbitmq.pp +++ b/deployment/puppet/fuel/examples/rabbitmq.pp @@ -2,8 +2,6 @@ notice('MODULAR: rabbitmq.pp') $fuel_settings = parseyaml($astute_settings_yaml) -$thread_pool_calc = min(100,max(12*$physicalprocessorcount,30)) - class { 'fuel::rabbitmq': astute_user => $::fuel_settings['astute']['user'], astute_password => $::fuel_settings['astute']['password'], @@ -11,7 +9,7 @@ class { 'fuel::rabbitmq': mco_user => $::fuel_settings['mcollective']['user'], mco_password => $::fuel_settings['mcollective']['password'], env_config => { - 'RABBITMQ_SERVER_ERL_ARGS' => "+K true +A${thread_pool_calc} +P 1048576", + 'RABBITMQ_SERVER_ERL_ARGS' => "+K true +P 1048576", 'ERL_EPMD_ADDRESS' => $::fuel_settings['ADMIN_NETWORK']['ipaddress'], 'NODENAME' => "rabbit@${::fuel_settings['HOSTNAME']}", }, diff --git a/deployment/puppet/osnailyfacter/manifests/rabbitmq/rabbitmq.pp b/deployment/puppet/osnailyfacter/manifests/rabbitmq/rabbitmq.pp index 837f1c9d59..3ff79d381e 100644 --- a/deployment/puppet/osnailyfacter/manifests/rabbitmq/rabbitmq.pp +++ b/deployment/puppet/osnailyfacter/manifests/rabbitmq/rabbitmq.pp @@ -112,12 +112,10 @@ class osnailyfacter::rabbitmq::rabbitmq { } $config_management_variables_merged = merge($config_management_variables_default, $config_management_variables) - # NOTE(bogdando) to get the limit for threads, the max amount of worker processess will be doubled - $thread_pool_calc = min($workers_max*2,max(12*$physicalprocessorcount,30)) $environment_variables_init = hiera('rabbit_environment_variables', { - 'SERVER_ERL_ARGS' => "\"+K true +A${thread_pool_calc} +P 1048576\"", + 'SERVER_ERL_ARGS' => "\"+K true +P 1048576\"", 'ERL_EPMD_ADDRESS' => $epmd_bind_ip_address, 'PID_FILE' => $pid_file, } diff --git a/tests/noop/spec/hosts/master/rabbitmq_spec.rb b/tests/noop/spec/hosts/master/rabbitmq_spec.rb index 92492e44c4..6cbdd6e954 100644 --- a/tests/noop/spec/hosts/master/rabbitmq_spec.rb +++ b/tests/noop/spec/hosts/master/rabbitmq_spec.rb @@ -12,10 +12,6 @@ describe manifest do YAML.load facts[:astute_settings_yaml] end - let(:thread_pool_calc) do - [[12 * facts[:physicalprocessorcount].to_i, 30].max, 100].min - end - it 'should declare "fuel::rabbitmq" class correctly' do parameters = { :astute_user => fuel_settings['astute']['user'], @@ -24,7 +20,7 @@ describe manifest do :mco_user => fuel_settings['mcollective']['user'], :mco_password => fuel_settings['mcollective']['password'], :env_config => { - 'RABBITMQ_SERVER_ERL_ARGS' => "+K true +A#{thread_pool_calc} +P 1048576", + 'RABBITMQ_SERVER_ERL_ARGS' => "+K true +P 1048576", 'ERL_EPMD_ADDRESS' => fuel_settings['ADMIN_NETWORK']['ipaddress'], 'NODENAME' => "rabbit@#{fuel_settings['HOSTNAME']}", }, diff --git a/tests/noop/spec/hosts/rabbitmq/rabbitmq_spec.rb b/tests/noop/spec/hosts/rabbitmq/rabbitmq_spec.rb index 7bf975deee..a199203c95 100644 --- a/tests/noop/spec/hosts/rabbitmq/rabbitmq_spec.rb +++ b/tests/noop/spec/hosts/rabbitmq/rabbitmq_spec.rb @@ -50,7 +50,6 @@ describe manifest do amqp_port = Noop.hiera('amqp_port', '5673') workers_max = Noop.hiera 'workers_max' debug = Noop.hiera('debug', false) - threads_max = 2*workers_max.to_i rabbit_hash = Noop.hiera_structure 'rabbit' rabbitmq_admin_enabled = rabbit_hash.fetch(['use_rabbitmq_admin'], true) use_pacemaker = rabbit_hash.fetch(['pacemaker'], true) @@ -98,11 +97,7 @@ describe manifest do end it 'has correct SERVER_ERL_ARGS in environment_variables' do - expect($environment_variables['SERVER_ERL_ARGS']).to eq "\"+K true +A#{threads_max} +P 1048576\"" - end - - it 'has correct SERVER_ERL_ARGS in environment_variables on 4 CPU & 32G system' do - expect($environment_variables['SERVER_ERL_ARGS']).to eq "\"+K true +A34 +P 1048576\"" + expect($environment_variables['SERVER_ERL_ARGS']).to eq "\"+K true +P 1048576\"" end it 'has correct ERL_EPMD_ADDRESS in environment_variables' do