RabbitMQ threads should be configured dynamically
authorMichele Baldessari <michele@acksyn.org>
Tue, 20 Sep 2016 08:11:54 +0000 (10:11 +0200)
committerMichele Baldessari <michele@acksyn.org>
Tue, 20 Sep 2016 08:32:44 +0000 (10:32 +0200)
Currently in puppet/services/rabbitmq.yaml we hardcode the thread pool
size to 30 (via the +A30 snippet):
rabbitmq_environment:
    RABBITMQ_SERVER_ERL_ARGS: '"+K true +A30 +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<5000:64/native>>}]"'

Upstream rabbit has gained the ability to dynamically configure the
number of threads since 3.6.2 via the following commit:
https://github.com/rabbitmq/rabbitmq-server/commit/41ce5ad808863944cd6d62ce7f7e2271f1010582

Given that the default was hardcoded in rabbit from at least 3.4.0 up
until 3.6.2 (see LP bug associated to this commit), we can actually
remove this hardcoded value as it overrides a sane default.

Before the change:
/usr/lib64/erlang/erts-7.3.1/bin/beam.smp -W w -A 64 -K true -A30 -P 1048576 ...

After the change:
/usr/lib64/erlang/erts-7.3.1/bin/beam.smp -W w -A 64 -K true -P 1048576 ...

So effectively with this change we will have the following:
- With older rabbitmq versions we keep the +A30 default
- With rabbitmq versions >= 3.6.2 the thread number is dynamically
  computed to nr_cpus * 16

Change-Id: I8d30c7d141c29fcc439d40fc767498520be7966e
Closes-Bug: #1625486

puppet/services/rabbitmq.yaml

index e4a16e8..52300a2 100644 (file)
@@ -66,7 +66,7 @@ outputs:
         rabbitmq::repos_ensure: false
         rabbitmq_environment:
           RABBITMQ_NODENAME: "rabbit@%{::hostname}"
-          RABBITMQ_SERVER_ERL_ARGS: '"+K true +A30 +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<5000:64/native>>}]"'
+          RABBITMQ_SERVER_ERL_ARGS: '"+K true +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<5000:64/native>>}]"'
         rabbitmq_kernel_variables:
           inet_dist_listen_min: '25672'
           inet_dist_listen_max: '25672'