From 280ed67c35b390a7aad78026f6875df05fa52dbc Mon Sep 17 00:00:00 2001 From: Felix Huettner Date: Thu, 1 Sep 2022 14:02:50 +0200 Subject: [PATCH] rabbitmq: add erlang scheduler recommendation The official rabbitmq dockerimage sets `+stbt db` as a launch option of erlang. This option defines how the erlang scheduler threads (the threads actually running the erlang code) are distributed over the phyiscal cpu cores. Per default erlang spawns one scheduler thread per logical core (so hyperthread or phyiscal core depending on if you have hyperthreading enabled). The setting `db` translates to the setting `thread_no_node_processor_spread` which basically means that each scheduler thread is pinned to one specific logical core in a predetermined order. There are some more details to this specific setting, but they are not relevant for this issue (if interested please see https://www.erlang.org/doc/man/erl.html#+sbt). When possible the erlang runtime tries to run processes on the lowest possible scheduler id. As the scheduler id consistently mapping to a logical core this means that if possible all rabbitmq processes on a given host try to run code on the same logical core. The erlang documentation already metions that this can cause performance issues: > If the Erlang runtime system is the only operating system process that binds threads to logical processors, this improves the performance of the runtime system. However, if other operating system processes (for example another Erlang runtime system) also bind threads to logical processors, there can be a performance penalty instead. This performance penalty can sometimes be severe. If so, you are advised not to bind the schedulers. As this recommendation is quite hidden we add it to our config recommendations as well. The above is a summary of https://www.erlang.org/doc/man/erl.html#+sbt. Change-Id: Iee95287911097274c96c630fa912e7f994339b6a --- doc/source/other/rabbitmq.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/source/other/rabbitmq.rst b/doc/source/other/rabbitmq.rst index ceda6ac..d2de90c 100644 --- a/doc/source/other/rabbitmq.rst +++ b/doc/source/other/rabbitmq.rst @@ -75,6 +75,14 @@ When running the rabbit software on a node, you can configure some parameters fo The most important configuration are the following +Erlang scheduler configuration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you run multiple rabbitmq clusters it is common to run these clusters on the same 3 hosts. +If you do this then you must ensure that all of the rabbitmq/erlang processes are started with `-stbt u` or `-stb u`. +This ensures that erlang does not compete over using the same cpu cores. + +For details see https://www.erlang.org/doc/man/erl.html#+sbt net_ticktime and heartbeat ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -116,7 +124,7 @@ pattern Policies are applied based on a regex pattern. The pattern we agreed on (from the mailing list discussion) is the following: .. code-block:: console - + '^(?!(amq\.)|(.*_fanout_)|(reply_)).*' which will set HA on all queues, except the one that: