Skip to content

Commit 28ca1ae

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Reduce RabbitMQ busy waiting, lowering CPU load" into stable/wallaby
2 parents 77308e2 + 6c9b917 commit 28ca1ae

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed

ansible/roles/rabbitmq/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ rabbitmq_user: "openstack"
7171
rabbitmq_cluster_name: "openstack"
7272
rabbitmq_hostname: "{{ ansible_hostname }}"
7373
rabbitmq_pid_file: "/var/lib/rabbitmq/mnesia/rabbitmq.pid"
74-
rabbitmq_server_additional_erl_args: ""
74+
rabbitmq_server_additional_erl_args: "+S 2:2 +sbwt none"
7575
# Dict of TLS options for RabbitMQ. Keys will be prefixed with 'ssl_options.'.
7676
rabbitmq_tls_options: {}
7777
# To avoid split-brain

doc/source/reference/message-queues/rabbitmq.rst

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,25 @@ internal VIP. As such, traffic to this endpoint is encrypted when
8686
Passing arguments to RabbitMQ server's Erlang VM
8787
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8888

89-
Erlang programs run in Erlang VM (virtual machine) and use Erlang runtime.
90-
Erlang VM can be configured.
89+
Erlang programs run in an Erlang VM (virtual machine) and use the Erlang
90+
runtime. The Erlang VM can be configured.
9191

9292
Kolla Ansible makes it possible to pass arguments to the Erlang VM via the
93-
usage of ``rabbitmq_server_additional_erl_args`` variable. The contents of it
94-
are appended to ``RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS`` environment variable
95-
passed to RabbitMQ server startup script. Kolla Ansible already configures
96-
RabbitMQ server for IPv6 (if necessary). Any argument can be passed there as
97-
documented in https://www.rabbitmq.com/runtime.html
93+
usage of the ``rabbitmq_server_additional_erl_args`` variable. The contents of
94+
it are appended to the ``RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS`` environment
95+
variable which is passed to the RabbitMQ server startup script. Kolla Ansible
96+
already configures RabbitMQ server for IPv6 (if necessary). Any argument can be
97+
passed there as documented in https://www.rabbitmq.com/runtime.html
98+
99+
The default value for ``rabbitmq_server_additional_erl_args`` is ``+S 2:2 +sbwt
100+
none``.
101+
102+
By default RabbitMQ starts N schedulers where N is the number of CPU cores,
103+
including hyper-threaded cores. This is fine when you assume all CPUs are
104+
dedicated to RabbitMQ. Its not a good idea in a typical Kolla Ansible setup.
105+
Here we go for two scheduler threads (``+S 2:2``). More details can be found
106+
here: https://www.rabbitmq.com/runtime.html#scheduling and here:
107+
https://erlang.org/doc/man/erl.html#emulator-flags
108+
109+
The ``+sbwt`` argument prevents busy waiting of the scheduler, for more details
110+
see: https://www.rabbitmq.com/runtime.html#busy-waiting.

etc/kolla/globals.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,12 @@
395395
# See Kolla Ansible docs RabbitMQ section for details.
396396
# These are appended to args already provided by Kolla Ansible
397397
# to configure IPv6 in RabbitMQ server.
398-
#rabbitmq_server_additional_erl_args: ""
398+
# More details can be found in the RabbitMQ docs:
399+
# https://www.rabbitmq.com/runtime.html#scheduling
400+
# https://www.rabbitmq.com/runtime.html#busy-waiting
401+
# The default tells RabbitMQ to always use two cores (+S 2:2),
402+
# and not to busy wait (+sbwt none):
403+
#rabbitmq_server_additional_erl_args: "+S 2:2 +sbwt none"
399404
# Whether to enable TLS encryption for RabbitMQ client-server communication.
400405
#rabbitmq_enable_tls: "no"
401406
# CA certificate bundle in RabbitMQ container.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes an issue where RabbitMQ consumes a large amount of CPU, particularly
5+
on multi-core systems. The default RabbitMQ tuning assumes that RabbitMQ
6+
is running on a dedicated host, which is the opposite of a typical Kolla
7+
Ansible container setup. For more details on tuning RabbitMQ in your
8+
environment, please see: https://www.rabbitmq.com/runtime.html#busy-waiting
9+
https://www.rabbitmq.com/runtime.html#scheduling
10+
upgrade:
11+
- |
12+
Modifies the default value of ``rabbitmq_server_additional_erl_args`` from
13+
an empty string to ``+S 2:2 +sbwt none``.

0 commit comments

Comments
 (0)