Skip to content

Conversation

@mergify
Copy link

@mergify mergify bot commented Jan 4, 2023

This is an automatic backport of pull request #6684 done by Mergify.
Cherry-pick of 8f0800e has failed:

On branch mergify/bp/v3.11.x/pr-6684
Your branch is up to date with 'origin/v3.11.x'.

You are currently cherry-picking commit 8f0800e578.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   deps/rabbit/BUILD.bazel
	modified:   deps/rabbit/src/rabbit_classic_queue_index_v2.erl
	modified:   deps/rabbit/src/rabbit_file.erl
	modified:   deps/rabbit/src/rabbit_msg_store.erl
	modified:   deps/rabbit/src/rabbit_msg_store_ets_index.erl
	modified:   deps/rabbit/test/rabbit_stream_queue_SUITE.erl
	new file:   deps/rabbit/test/unicode_SUITE.erl

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   deps/rabbit/src/rabbit_classic_queue_store_v2.erl
	both modified:   deps/rabbit/src/rabbit_variable_queue.erl

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

ansd added 2 commits January 4, 2023 17:01
Store directory names as binary instead of string.

This commit saves >1GB of memory per 100,000 classic queues v2.
With longish node names, the memory savings are even much higher.

This commit is especially a prerequisite for scalalbe MQTT where every
subscribing MQTT connection creates its own classic queue.

So, with 3 million MQTT subscribers, this commit saves >30 GB of memory.

This commits stores file names as binaries and converts back to
file:filename() when passed to file API functions.
This is to reduce risk of breaking behaviour for path names containing
unicode chars on certain platforms.

Alternatives to the implementation in this commit:
1. Store common directory list prefix only once (e.g. put it into
   persistent_term) and store per queue directory names in ETS.
2. Use file:filename_all() instead of file:filename() and pass binaries
   to the file module functions. However this might be brittle on some
   platforms since these binaries are interpreted as "raw filenames".
   Using raw filenames requires more changes to classic queues which we
   want to avoid to reduce risk.

The downside of the implemenation in this commit is that the binary gets
converted to a list sometimes.
This happens whenever a file is flushed or a new file gets created for
example.

Following perf tests did not show any regression in performance:
```
java -jar target/perf-test.jar -s 10 -x 1 -y 0 -u q -f persistent -z 30
java -jar target/perf-test.jar -s 10000 -x 1 -y 0 -u q -f persistent -z 30
java -jar target/perf-test.jar -s 10 -x 100 -qp q%d -qpf 1 -qpt 100 -y 0 -f persistent -z 60 -c 1000
```

Furthermore `rabbit_file` did not show up in the CPU flame graphs
either.

(cherry picked from commit 8f0800e)

# Conflicts:
#	deps/rabbit/src/rabbit_classic_queue_store_v2.erl
#	deps/rabbit/src/rabbit_variable_queue.erl
(cherry picked from commit b0d0308)
@mergify mergify bot added the conflicts label Jan 4, 2023
@mergify mergify bot assigned ansd Jan 4, 2023
@mergify mergify bot added the bazel label Jan 4, 2023
@michaelklishin michaelklishin merged commit b3a175e into v3.11.x Jan 4, 2023
@michaelklishin michaelklishin deleted the mergify/bp/v3.11.x/pr-6684 branch January 4, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants