Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the limits of messages, queues and exchanges?

  1. What are the allowed types of messages (strings, bytes, integers, etc.)?
  2. What is the maximum size of a message?
  3. What is the maximum number of queues and exchanges?
like image 363
tuchk4 Avatar asked Aug 21 '13 09:08

tuchk4


People also ask

Does a queue have a limit?

Overview. The maximum length of a queue can be limited to a set number of messages, or a set number of bytes (the total of all message body lengths, ignoring message properties and any overheads), or both.

How many messages RabbitMQ can handle?

Number of queues Queues are single-threaded in RabbitMQ, and one queue can handle up to about 50 thousand messages.

What is the max message size in RabbitMQ?

While the theoretical message size limit in RabbitMQ is 2GB up to 3.7. 0, we don't recommend sending messages larger than 128MB, which is also the new max size limit in 3.8. 0 and onward. Large messages are especially problematic when using mirrored queues in HA clusters and can cause memory and performance issues.

How many queues can you have in RabbitMQ?

Thousands (or even tens of thousands) of queues should be no problem at all, though each object (e.g., queues, exchanges, bindings, etc) will take up some memory and/or disk space. By default, Erlang will enforce a maximum number of concurrent processes (i.e., lightweight threads) at around 32768 IIRC.


1 Answers

  1. Theoretically anything can be stored/sent as a message. You actually don't want to store anything on the queues. The system works most efficiently if the queues are empty most of the time. You can send anything you want to the queue with two preconditions:

    • The thing you are sending can be converted to and from a bytestring
    • The consumer knows exactly what it is getting and how to convert it to the original object

    Strings are pretty easy, they have a built in method for converting to and from bytes. If you know it is a string then you know how to convert it back. The best option is to use a markup string like XML, JSON, or YML. This way you can convert objects to Strings and back again to the original objects; they work across programming languages so your consumer can be written in a different language to your producer as long as it knows how to understand the object. I work in Java. I want to send complex messages with sub objects in the fields. I use my own message object. The message object has two additional methods toBytes and fromBytes that convert to and from the bytestream. I use routing keys that leave no doubt as to what type of message the consumer is receiving. The message is Serializable. This works fine, but is limiting as I can only use it with other Java programs.

  2. The size of the message is limited by the memory on the server, and if it is persistent then also the free HDD space too. You probably do not want to send messages that are too big; it might be better to send a reference to a file or DB.

    You might also want to read up on their performance measures: http://www.rabbitmq.com/blog/2012/04/17/rabbitmq-performance-measurements-part-1/ http://www.rabbitmq.com/blog/2012/04/25/rabbitmq-performance-measurements-part-2/

  3. Queues are pretty light weight, you will most likely be limited by the number of connections you have. It will depend on the server most likely. Here is some info on a similiar question: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2009-February/003042.html

like image 161
robthewolf Avatar answered Oct 02 '22 05:10

robthewolf