RabbitMQ中消息,队列和交换的限制是什么? [英] What are the limits of messages, queues and exchanges in RabbitMQ?

查看:89
本文介绍了RabbitMQ中消息,队列和交换的限制是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 允许的消息类型是什么(字符串,字节,整数等)?
  2. 邮件的最大大小是多少?
  3. 队列和交换的最大数量是多少?

推荐答案

  1. 理论上,任何东西都可以存储/发送为消息.您实际上不想在队列上存储任何内容.如果队列大多数时间都是空的,则系统将最有效地工作.您可以使用两个先决条件将想要发送的任何内容发送到队列:

  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:

  • 您要发送的内容可以与字节串相互转换
  • 消费者确切地知道得到了什么以及如何将其转换为原始对象

字符串很简单,它们具有一个内置的方法来与字节转换.如果您知道它是一个字符串,那么您就会知道如何将其转换回去.最好的选择是使用标记字符串,例如XML,JSON或YML.这样,您可以将对象转换为字符串,然后再次转换为原始对象.它们可以跨编程语言工作,因此只要知道如何理解对象,就可以使用与生产者不同的语言来编写您的消费者.我用Java工作.我想发送带有子对象的复杂消息.我使用自己的消息对象.消息对象还有两个附加方法 toBytes fromBytes ,它们可以与字节流进行相互转换.我使用的路由键毫无疑问地表明消费者正在接收哪种类型的消息.该消息是可序列化的.效果很好,但有一定局限性,因为我只能将其与其他Java程序一起使用.

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.

消息的大小受服务器上的内存限制,如果消息是持久性的,那么空闲的HDD空间也将受到限制.您可能不想发送太大的消息.最好发送对文件或数据库的引用.

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.

您可能还想阅读一下他们的绩效指标: http://www.rabbitmq.com/博客/2012/04/17/rabbitmq-performance-measurements-part-1/ http://www.rabbitmq.com/blog/2012/04/25/rabbitmq-performance-measurements-part-2/

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/

队列的重量很轻,您很可能会受到连接数量的限制.这将最有可能取决于服务器.这是一个类似问题的一些信息: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2009-February/003042.html

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

这篇关于RabbitMQ中消息,队列和交换的限制是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆