Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a configurable limit to message size, reduce default to 128 MiB #1812

Merged
merged 5 commits into from
Jan 2, 2019

Conversation

hairyhum
Copy link
Contributor

@hairyhum hairyhum commented Dec 28, 2018

Proposed Changes

Motivation: very large messages can be problematic for Erlang distribution. The distribution message can only be up to 2GB, but there will be some additional data, so the message body should be even smaller.
Another issue is failure detection, which is based on heartbeats. If a message is taking too long to transfer, the cluster nodes can miss the heartbeat and break the cluster.

Things like garbage collection and general performance can also suffer with a bigger message sizes.

Add max_message_size configuration to configure the limit in bytes.
If message is bigger - channel exception will be thrown, just like it was before for messages bigger than 2GB

Default limit is 128MB (134217728 bytes).
There is still a hard limit of 521MB (536870912), see rabbitmq/rabbitmq-common#289.

Types of Changes

  • Bugfix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Add `max_message_size` configuration to configure limit
in bytes.
If message is bigger - channel exception will be thrown.

Default limit is 128MB.
There is still a hard limit of 521MB.

[#161983593]
@hairyhum hairyhum added this to the 3.8.0 milestone Dec 28, 2018
@hairyhum
Copy link
Contributor Author

Should we consider adding some human-friendly configuration format (for example 128MB), as it is for memory limits?

Copy link
Member

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means every published message goes through a single group leader process. Please move this to channel state since the value can be assumed a runtime constant.

@hairyhum
Copy link
Contributor Author

@michaelklishin no, it's using ets tables https://github.com/erlang/otp/blob/master/lib/kernel/src/application_controller.erl#L332
And it does not need to get a group leader, because appliction name is explicit in this case.

@michaelklishin
Copy link
Member

Even then, why not make it a constant in the channel state and eliminate several new extra calls that would effectively always return the same value?

@hairyhum
Copy link
Contributor Author

Fair enough. The value can technically change during a channel lifetime, but that's not a public API, so we can move it to the channel state.

This can save us some reductions by avoiding ets read.

[#161983593]
@michaelklishin
Copy link
Member

I understand but it is unlikely to be a common event. We also can claim that the updated value (e.g. via rabbitmqctl eval will only take effect for new channels. That's how things work for a few configurable settings already.

 * Use smaller messages for tests
 * No need to publish a message above the hard limit, use a helper (these are unit tests)
 * Wording
@michaelklishin michaelklishin changed the title Introduce a configurable limit to message size. Introduce a configurable limit to message size Jan 2, 2019
@hairyhum hairyhum merged commit be0d287 into master Jan 2, 2019
@michaelklishin michaelklishin changed the title Introduce a configurable limit to message size Introduce a configurable limit to message size, reduce default to 128 MiB Jan 2, 2019
@michaelklishin michaelklishin deleted the max_msg_size branch January 2, 2019 10:02
michaelklishin added a commit that referenced this pull request Jan 9, 2019
Discovered while doing acceptance. References #1812.
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.

2 participants