Commit Graph

50747 Commits

Author SHA1 Message Date
Michael Klishin 0b477f31cb
Merge pull request #4827 from VictorGaiva/patch-1 2022-05-17 13:12:10 +04:00
Victor Gaiva 4b0b92631b
Update PROTOCOL.adoc
Fix missing ResponseCode in type definition.
2022-05-16 21:15:40 -03:00
Michael Klishin 3f44020dc9
Merge pull request #4814 from rabbitmq/mk-bump-credentials-obfuscation-to-3.1.0
Bump credentials_obfuscation to 3.1.0
2022-05-17 00:22:00 +04:00
Michael Klishin 3f6df2043a
Merge pull request #4819 from rabbitmq/mk-update-3.8.32-release-notes
3.8.32 release notes
2022-05-17 00:13:03 +04:00
Michael Klishin ef91c35d44
3.8.32 release notes 2022-05-17 00:12:38 +04:00
Michael Klishin 0b712dee65
Merge pull request #4817 from rabbitmq/mk-update-3.9.18-release-notes
3.9.18 release notes
2022-05-17 00:10:53 +04:00
Michael Klishin 1e4d41f718
3.9.18 release notes 2022-05-17 00:09:50 +04:00
Michael Klishin 3e8d62be1d
Merge pull request #4815 from rabbitmq/mk-3.10.2-release-notes
3.10.2 release notes
2022-05-17 00:06:13 +04:00
Michael Klishin 43e062918a
3.10.2 release notes 2022-05-17 00:05:25 +04:00
Michael Klishin 949f7e37db
Bump credentials_obfuscation to 3.1.0 2022-05-16 23:54:32 +04:00
Michael Klishin d026ba2d71
Merge pull request #4811 from rabbitmq/amqp10-binary-parser
Increase receiving throughput from a stream for AMQP 0-9-1 clients
2022-05-16 16:15:48 +04:00
David Ansari 4472ddf71c Increase receiving throughput from a stream via AMQP
This commit increases consumption throughput from a stream via AMQP 0.9.1
for 1 consumer by 83k msg/s or 55%,
for 4 consumers by 140k msg/s or 44%.

This commit tries to follow https://www.erlang.org/doc/efficiency_guide/binaryhandling.html
by reusing match contexts instead of creating new sub-binaries.

The CPU and mmap() memory flame graphs show that
when producing and consuming from a stream via AMQP 0.9.1
module amqp10_binary_parser requires
before this commit: 10.1% CPU time and 8.0% of mmap system calls
after this commit:  2.6% CPU time 2.5% of mmap system calls

Performance tests

Start rabbitmq-server without any plugins enabled and with 4 schedulers:
```
make run-broker PLUGINS="" RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="+JPperf true +S 4"
```

Test 1

Perf test client:
```
-x 1 -y 2 -qa x-queue-type=stream -ad false -f persistent -u s1 --qos 10000 --multi-ack-every 1000 -z 30
```

master branch:
sending rate avg msg/s 143k - 146k
receiving rate avg msg/s 188k - 194k

PR:
sending rate avg 133k - 138k
receiving rate avg 266k - 276k

This shows that with AMQP 0.9.1 and a stream, prior to this commit the broker could not
deliver messages to consumers as fast as they were published.
After this commit, it can.

Test 2

First, produce a few millions messages:
```
-x 1 -y 0 -qa x-queue-type=stream -ad false -f persistent -u s2
```
Then, consume them:
```
-x 0 -y 1 -qa x-queue-type=stream -ad false -f persistent -u s2 --qos 10000 --multi-ack-every 1000 -ca x-stream-offset=first -z 30
```

receving rate avg msg/s
master branch:
147k - 156k

PR:
230k - 237k

Improvement: 83k / 55%

Test 3

-x 0 -y 4 -qa x-queue-type=stream -ad false -f persistent -u s2 --qos 10000 --multi-ack-every 1000 -ca x-stream-offset=first -z 30

receving rate avg msg/s
master branch:
313k - 319k

PR:
450k - 461k

Improvement: 140k / 44%
2022-05-16 09:07:46 +00:00
Michael Klishin 5cf3a43523
Revert "Make master depend on credentials_obfuscation main branch"
This reverts commit 62819f3bcc.

This commit has served its QA purpose.

Will either update Bazel dependency to use git or pin to
a new release instead.
2022-05-14 02:58:07 +04:00
Michael Klishin 62819f3bcc
Make master depend on credentials_obfuscation main branch 2022-05-14 01:42:09 +04:00
Michael Klishin 149a7e78cf
Merge pull request #4803 from rabbitmq/rabbitmq-server-4799
Report crypto library version in 'rabbitmq-diagnostics status'
2022-05-12 16:42:40 +04:00
Michael Klishin 7ccd9821d7
Merge pull request #4801 from rabbitmq/less-mmap
Save memory when acking messages to quorum queue
2022-05-12 16:24:37 +04:00
Michael Klishin 2b80ed5c5e
Report crypto library version in 'rabbitmq-diagnostics status'
Just like we do in the node startup banner.

Closes #4799.
2022-05-12 16:19:41 +04:00
David Ansari a45ea01841 Save memory when acking messages to quorum queue
List `MsgIds` has fewer elements than list `Settles`.
Therefore, put it on the left side of the `++` operator.

The memory flame graph revealed that before this commit
5%-8% of all mmap() system calls happened in function
rabbit_fifo_client:settle/3.

After this commit only 1.6% - 1.8% of all mmap() system calls happen in
this function.

Note that we cannot do the same for discarded messages (`Discards`)
because the order in which messages will be dead lettered need to be
preserved.
2022-05-12 11:38:40 +00:00
Michael Klishin 36d2fd6991
Merge pull request #4798 from rabbitmq/format-log-level
Change default format of log level to full name
2022-05-12 15:01:36 +04:00
David Ansari 04938f1d6a Fix unit test
The new default format of the log level is the full name.
2022-05-12 10:01:04 +00:00
David Ansari bcc742c834 Change default format of log level to full name
The default format of how the log level gets printed should be the full
name. For example, we want "debug" instead of "dbug".

This was also the default behaviour before commit aca638abbb
2022-05-12 09:23:14 +00:00
Michael Klishin 7107e3ea9e
Merge pull request #4793 from cloudamqp/log_levels
Clarify documented/allowed log_level arg of rabbitmqctl set_log_level
2022-05-12 00:22:06 +04:00
Michael Klishin b522a1b3ac
Merge pull request #4606 from rabbitmq/route-faster
Route faster in direct exchange
2022-05-11 22:36:11 +04:00
Péter Gömöri 542ffeebb5 Clarify documented/allowed log_level arg of rabbitmqctl set_log_level
The `critical` log level is already documented on the website/logging section.
2022-05-11 19:22:28 +02:00
David Ansari 3ed7dfd800 Resolve direct_exchange_routing_v2 deadlock
Before this commit, when importing definitions with many bindings
and then enabling the feature flag direct_exchange_routing_v2 in
parallel a dead lock occurred.

The process that did the migration was hanging in:
```
(rabbit@r1-server-2.r1-nodes.default)42> erlang:process_info(<0.1447.0>, [current_stacktrace]).
[{current_stacktrace,[{gen,do_call,4,
                           [{file,"gen.erl"},{line,214}]},
                      {gen_server2,call,3,[{file,"gen_server2.erl"},{line,342}]},
                      {rabbit_misc,execute_mnesia_transaction,1,
                                   [{file,"rabbit_misc.erl"},{line,561}]},
                      {rabbit_core_ff,direct_exchange_routing_v2_migration,3,
                                      [{file,"rabbit_core_ff.erl"},{line,213}]},
                      {rabbit_feature_flags,run_migration_fun,3,
                                            [{file,"rabbit_feature_flags.erl"},{line,1621}]},
                      {rabbit_feature_flags,do_enable,1,
                                            [{file,"rabbit_feature_flags.erl"},{line,1523}]},
                      {erpc,execute_call,4,[{file,"erpc.erl"},{line,392}]}]}]
```

while all 8 worker processes under process `definition_import_pool_sup`
were hanging in:
```
(rabbit@r1-server-2.r1-nodes.default)38> erlang:process_info(<0.592.0>, [current_stacktrace]).
[{current_stacktrace,[{global,random_sleep,1,
                              [{file,"global.erl"},{line,2505}]},
                      {global,set_lock,4,[{file,"global.erl"},{line,421}]},
                      {rabbit_feature_flags,is_enabled,2,
                                            [{file,"rabbit_feature_flags.erl"},{line,581}]},
                      {rabbit_binding,sync_index_route,3,
                                      [{file,"rabbit_binding.erl"},{line,469}]},
                      {rabbit_binding,add,4,
                                      [{file,"rabbit_binding.erl"},{line,182}]},
                      {mnesia_tm,apply_fun,3,[{file,"mnesia_tm.erl"},{line,842}]},
                      {mnesia_tm,execute_transaction,5,
                                 [{file,"mnesia_tm.erl"},{line,818}]},
                      {rabbit_misc,'-execute_mnesia_transaction/1-fun-0-',1,
                                   [{file,"rabbit_misc.erl"},{line,565}]}]}]
```

So, all worker processes which imported the bindings were blocked
because rabbit_feature_flags:is_enabled/1 blocks because the feature
flag is in state_changing.

At the same time, the process which enables the feature flag could not
proceed because it was waiting for a lock held by the worker processes.

In this commit, we resolve the dead lock by not blocking in
rabbit_feature_flags:is_enabled/2.

This should be safe because we still rely on Mnesia locking to get a
consistent migration:
1. The migration process sets both a read lock on the rabbit_route table and a
write lock on the rabbit_index_route table. Therefore, once it acquired
both locks, it can populate the new rabbit_index_route table without any
import binding processes interfering.
2. Mnesia does a good job in avoiding dead locks by restarting
transactions (as long as we don't set out own locks outside of Mnesia,
as done prior to this commit).
2022-05-11 15:25:15 +00:00
David Ansari f4c5694813 Add feature flag direct_exchange_routing_v2 2022-05-11 15:25:15 +00:00
David Ansari 84ff7e6dea Increase routing throughput for direct exchange 2022-05-11 15:25:15 +00:00
Michael Klishin 5c6ecdc3bf
Merge pull request #4787 from rabbitmq/extra-bcc
Avoid ETS lookup if no extra_bcc queue set
2022-05-11 17:14:48 +04:00
David Ansari 70a639cd19 Avoid ETS lookup if no extra_bcc queue set
A queue (Q1) can have an extra_bcc queue (Q2).
Whenever a message is routed to Q1, it must also be routed to Q2.

Commit fc2d37ed1c
puts the logic to determine extra_bcc queues into
rabbit_exchange:route/2.
That is functionally correct because it ensures that messages being dead
lettered to target queues will also route to the target queues'
extra_bcc queues.
For every message being routed, that commit uses ets:lookup/2
just to check for an extra_bcc queue.

(Technically, that commit is not a regression because it does not slow
down the common case where a message is routed to a single target queue
because before that commit rabbit_channel:deliver_to_queues/3
used two ets:lookup/2 calls.)

However we can do better by avoiding the ets:lookup/2 for the common
case where there is no extra_bcc queue set.

One option is to use ets:lookup_element/3 to only fetch the queue
'options' field.

A better option (implemented in this commit) is determining whether to
send to an extra_bcc queue in the rabbit_channel and in the at-most
and at-least once dead lettering modules where the queue records
are already looked up.

This commit speeds up sending throughput by a few thousand messages per
second.
2022-05-11 07:31:30 +00:00
Michael Klishin 2640b5cfdc
Merge pull request #4783 from rabbitmq/mk-3.8.31-release-notes
3.8.31 release notes
2022-05-10 19:02:03 +04:00
Michael Klishin bfa277cac1
3.8.31 release notes 2022-05-10 18:56:53 +04:00
Michael Klishin 1b1bbb7d54
Merge pull request #4779 from rabbitmq/mk-3.9.17-release-notes
3.9.17 release notes
2022-05-10 17:38:29 +04:00
Michael Klishin d14bd1581b
3.9.17 release notes 2022-05-10 17:36:27 +04:00
Michael Klishin 1ff6ef045f
Merge pull request #4776 from rabbitmq/mk-3.10.1-release-notes
3.10.1 release notes
2022-05-10 17:04:11 +04:00
Michael Klishin 58905d318f
3.10.1 release notes 2022-05-10 17:02:53 +04:00
Michael Klishin b3f1460f34
Ignore VS Code and IDEA workspace directories 2022-05-10 16:19:12 +04:00
Michael Klishin d0ebabf346
Merge pull request #4774 from rabbitmq/exists
Check queue and exchange existence with ets:member/2
2022-05-10 15:26:16 +04:00
David Ansari 20677395cd Check queue and exchange existence with ets:member/2
This reduces memory usage and improves code readability.
2022-05-10 10:16:40 +00:00
Michael Klishin 0e65de0eff
Merge pull request #4767 from rabbitmq/dependabot/github_actions/master/peter-evans/create-pull-request-4.0.3
Bump peter-evans/create-pull-request from 4.0.2 to 4.0.3
2022-05-09 22:47:11 +04:00
dependabot[bot] 5578e569d7
Bump peter-evans/create-pull-request from 4.0.2 to 4.0.3
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v4.0.2...v4.0.3)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-09 18:34:11 +00:00
Arnaud Cogoluègnes f6f3f0942b
Merge pull request #3754 from rabbitmq/stream-single-active-consumer
Add single active consumer support for streams

Fixes #3753
2022-05-09 14:17:15 +02:00
David Ansari 4b62706357 Use UTF-8 in Bazel tests
Before this commit, on Ubuntu, even though locale and env variable was
set correctly:
```
$ locale
LANG=C.UTF-8
```

```
$ env | grep LANG
LANG=C.UTF-8
```

bazel tests were failing because that env variable does not get set in
the linux-sandbox:
```
bazel test //deps/rabbit:queue_parallel_SUITE
...
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8.
Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)

Timeout: 60.0 seconds ...
Listing queues for vhost / ...
name    messages        messages_ready  messages_unacknowledged
stream_queue_publish    1       1       0
a_queue_with_extra_bcc  3       3       0
queue_without_extra_bcc 1       1       0
queue_with_extra_bcc    1       1       0
extra.bcc       3       3       0
my_extra_bcc    1       1       0

Exit code: 0 (pid <0.1987.0>)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rabbit_ct_broker_helpers:rabbitmqctl_list failed on line 1098
Reason: {badmatch,[<<"warning: the VM is running with "...>>,<<"Time...}
```

This commits sets UTF-8 in the Bazel test environment.
2022-05-09 09:48:56 +00:00
Michael Klishin f3c3b2922a
Merge pull request #4762 from rabbitmq/bazel-test-node-logs-helper
Add test-node-logs and remote-test-node-logs rules for bazel
2022-05-09 13:24:25 +04:00
Philip Kuryloski 5f61a11224 rename test-node-logs -> test-node-data 2022-05-09 11:01:54 +02:00
Jean-Sébastien Pédron f5ac1c61df
Revert "Pre-launch logging: move type docstrings above the types"
Unlike other elements in an Erlang module, EDoc expects the description
of a type to be below its specification...

This reverts commit 03a8d49de7.
2022-05-09 11:01:52 +02:00
Arnaud Cogoluègnes 85b0625b6c
Address code review comments for stream SAC
References #3753
2022-05-09 10:52:38 +02:00
Arnaud Cogoluègnes 68e8ae8673
Rename function for clarity
References #3753
2022-05-09 10:52:38 +02:00
Arnaud Cogoluègnes 8ccdd7b6f7
Move SAC API to SAC coordinator
As per @ansd's suggestion. This way the stream coordinator
does not have to know about the SAC commands.

References #3753
2022-05-09 10:52:38 +02:00
Arnaud Cogoluègnes f4e2a95e6c
Address code review comments for stream SAC
References #3753
2022-05-09 10:52:37 +02:00
David Ansari 67126a84ae
Use more specific type 2022-05-09 10:52:37 +02:00