`

RabbitMQ vs Apache ActiveMQ vs Apache qpid

阅读更多

http://bhavin.directi.com/rabbitmq-vs-apache-activemq-vs-apache-qpid/
6 May, 2010
RabbitMQ vs Apache ActiveMQ vs Apache qpid

Posted by Bhavin Turakhia

We need a simple message queue to ensure asynchronous message passing across a bunch of our server side apps. The message volume is not intended to be very high, latency is not an issue, and order is not important, but we do need to guarantee that the message will be received and that there is no potential for failure irrespective of infrastructure downtime.

Dhruv from my team had taken up the task of researching various persistent message queue options and compiling notes on them. This is a compendium of his notes (disclaimer – this is an outline of our experience, there may be inaccuracies) -
RabbitMQ

General:

    * Some reading on clustering http://www.rabbitmq.com/clustering.html
    * DNS errors cause the DB(mnesia) to crash
    * A RabbitMQ instance won’t scale to LOTS of queues with each queue having fair load since all queues are stored in memory (queue metadata) and also in a clustered setup, each queue’s metadata (but not the queue’’s messages) is replicated on each node. Hence, there is the same amount of overhead due to queues on every node in a cluster
    * No ONCE-ONLY semanamntics. Messages may be sent twice by RabbitMQ to the consumer(s)
    * Multiple consumers can be configured for a single queue, and they will all get mutually exclusive messages
    * Unordered; not FIFO delivery
    * Single socket multiple connections. Each socket can have multiple channels and each channel can have multiple consumers
    * No provision for ETA
    * maybe auto-requeue (based on timeout) — needs investigation
    * Only closing connection NACKs a message. Removing the consumer from that channel does NOT. Hence, all queues being listened to on that channel/connetion are closed for the current consumer
    * NO EXPONENTIAL BACKOFF for failed consumers. Failed messages are re-tried almost immediately. Hence an error in the consumer logic that crashes the consumer while consuming a particular message may potentially block the whole queue. Hence, the consumer needs to be programmed well — error free. However, apps are like; well apps…
    * Consumer has to do rate limiting by not consuming messages too fast (if it wants to); no provision for this in RabbitMQ

Persistence:

    * It will use only it’s own DB — you can’t configure mySQL or any such thing

Clustering and Replication:

    * A RabbitMQ cluster is just a set of nodes running the RabbitMQ. No master node is involved.
    * You need to specify hostname of cluster nodes in a cluster manually on the command line or in a config file.
    * Basic load balancing by nodes in a cluster by redirecting requests to other nodes
    * A node can be a RAM node or a disk node. RAM nodes keep their state only in memory (with the exception of the persistent contents of durable queues which are still stored safely on disc). Disk nodes keep state in memory and on disk.
    * Queue metadata shared across all nodes.
    * RabbitMQ brokers tolerate the failure of individual nodes. Nodes can be started and stopped at will
    * It is advisable to have at least 1 disk node in a cluster of nodes
    * You need to specify which nodes are part of a cluster during node startup. Hence, when A is the first one to start, it will think that it is the only one in the cluster. When B is started it will be told that A is also in the cluster and when C starts, it should be told that BOTH A and B are part of the cluster. This is because if A or B go down, C still knows one of the machines in the cluster. This is only required for RAM nodes, since they don’t persist metadata on disk. So, if C is a memory node and it goes down and comes up, it will have to be manually told which nodes to query for cluster membership (since it itself doesn’t store that state locally).
    * Replication needs to be investigated (check addtl resources) however, from initial reading, it seems queue data replication does not exist
    * FAQ: “How do you migrate an instance of RabbitMQ to another machine?”. Seems to be a very manual process.

Transactions:

    * Any number of queues can be involved in a transaction

Addtl Resources

    * http://somic.org/2008/11/11/using-rabbitmq-beyond-queueing/
    * http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2009-August/004598.html
    * http://old.nabble.com/Durable-queues—bindings-td22959443.html
    * http://groups.google.com/group/rabbitmq-discuss/msg/e55ae8c821405044
    * RabbitMQ benchmarks (inconclusive): http://www.sheysrebellion.net/blog/2009/06/
    * Some more RabbitMQ benchmarks: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2009-October/005189.html
    * If you are still thirsty: http://www.rabbitmq.com/faq.html

Apache qpid

    * Supports transactions
    * Persistence using a pluggable layer — I believe the default is Apache Derby
    * This like the other Java based product is HIGHLY configurable
    * Management using JMX and an Eclipse Management Console application - http://www.lahiru.org/2008/08/what-qpid-management-console-can-do.html
    * The management console is very feature rich
    * Supports message Priorities
    * Automatic client failover using configurable connection properties -
          o http://qpid.apache.org/cluster-design-note.html
          o http://qpid.apache.org/starting-a-cluster.html
          o http://qpid.apache.org/cluster-failover-modes.html
    * Cluster is nothing but a set of machines have all the queues replicated
    * All queue data and metadata is replicated across all nodes that make up a cluster
    * All clients need to know in advance which nodes make up the cluster
    * Retry logic lies in the client code
    * Durable Queues/Subscriptions
    * Has bindings in many languages
    * For the curious: http://qpid.apache.org/current-architecture.html
    * In our tests -
          o Speed: Non-persistent mode: 5000 messages/sec (receive rate), Persistent mode: 1100 messages/sec (receive rate) (send rate will be typically a bit more, but when you start off with an empty queue, they are almost the same for most queue implementations). However, the interesting bit is that even in transacted mode, I saw a lot of message loss if I crashed the broker (by crash I mean Ctrl+C, not even the more -9 signal type of thing that I usually do). Why I stress this is that apps. can usually hook on to Ctrl+C and save data before quitting, but qpid didn’t think it prudent to do so. Out of 1265 messages sent (and committed), only 1218 were received by the consumer (before the inflicted crash). Even on restarting the broker and consumer, that didn’t change. We observed similar behaviour with RabbitMQ in our tests. However, RabbitMQ docs. mention that you need to run in TRANSACTED mode (not just durable/persistent) for guaranteed delivery. We haven’t run that test yet.

Apache ActiveMQ

    * HIGHLY configurable. You can probably do anything you want it to with it
    * You can choose a message store. 4 are already available
    * Has lots of clustering options:
          o Shared nothing Master-Slave: ACK sent to client when master stores the message
          o Shared Database: Acquires a lock on the DB when any instance tries to access the DB
          o Shared Filesystem: Locks a file when accessing the FS. Issues when using NFS with file-locking; or basically any network based file system since file locking is generally buggy in network file systems
    * Network of brokers: This is an option that allows a lot of flexibility. However, it seems to be a very problematic/buggy way of doing things since people face a lot of issues with this configuration
    * Scaling:
          o A. Default transport is blocking I/O with a thread per connection. Can be changed to use nio
          o Horizontal scaling: Though they mention this, the way to achieve this is by using a network of brokers
          o Patitioning: We all know Mr. Partitioning, don’t we. The client decides where to route packets and hence must maintain multiple open connections to different brokers
    * Allows producer flow-control!!
    * Has issues wrt lost/duplicate messages, but there is an active community that fixes these issues
    * Active MQ crashes fairly frequently, at least once per month, and is rather slow - http://stackoverflow.com/questions/957507/lightweight-persistent-message-queue-for-linux
    * Seems to have bindings in many languages(just like RabbitMQ)
    * Has lots of tools built around it 12. JMS compliant; supports XA transactions: http://activemq.apache.org/how-do-transactions-work.html
    * Less performant as compared to RabbitMQ
    * We were able to perform some tests on Apache Active MQ today, and here are the results:
          o Non persistent mode: 5k messages/sec
          o Persistent mode: 22 messages/sec (yes that is correct)
    * There are multiple persisters that can be configured with ActiveMQ, so we are planning to run another set of tests with MySQL and file as the persisters. However, the current default (KahaDB) is said to be more scalable (and offers faster recoverability) as compared to the older default(file/AMQ Message Store: http://activemq.apache.org/amq-message-store.html).
    * The numbers are fair. Others on the net have observed similar results: http://www.mostly-useless.com/blog/2007/12/27/playing-with-activemq/
    * With MySQL, I get a throughput of 8 messages/sec. What is surprising is that it is possible to achieve much better results using MySQL but ActiveMQ uses the table quite unwisely.
    * ActiveMQ created the tables as InnoDB instead of MyISAM even though it doesn’t seem to be using any of the InnoDB features.
    * I tried changing the tables to MyISAM, but it didn’t help much. The messages table structure has 4 indexes !! Insert takes a lot of time because MySQL needs to update 4 indexes on every insert. That sort of kills performance. However, I don’t know if performance should be affected for small (< 1000) messages in the table. Either ways, this structure won’t scale to millions of messages since everyone will block on this one table.
分享到:
评论

相关推荐

    apache-activemq5.15.3和5.15.5.zip

    - **协议兼容性**:提升了对AMQP 1.0协议的支持,使得与RabbitMQ、Qpid等其他消息中间件的互操作性更强。 - **故障恢复**:改进了故障恢复机制,增强了集群和网络故障时的数据一致性保证。 - **云集成**:更好地...

    jms Spring+ActiveMQ 5.4.2

    Spring的JMS模块允许开发者声明式地配置消息生产者(发送者)和消费者(接收者),并且支持多种JMS供应商,如ActiveMQ、RabbitMQ和Apache Qpid等。通过使用Spring的`JmsTemplate`类,我们可以方便地发送和接收消息,...

    java MqDemo

    首先,我们需要了解Java中的消息队列实现,如Apache ActiveMQ、RabbitMQ、Apache Qpid或者Amazon SQS等。这些MQ服务提供API和客户端库,使得开发者可以轻松地在Java应用程序中集成消息队列功能。 在Java中,通常会...

    Laravel开发-laravel-amqp-queue .zip

    常见的实现有RabbitMQ、Apache Qpid、ActiveMQ等。AMQP允许应用程序之间通过消息进行通信,这些消息可以是异步处理的,这样可以提高系统的并发性和容错性。 在Laravel中集成AMQP,首先需要安装laravel/amqp库,这...

    AMQP_Storm-1.4.0-py2.py3-none-any.whl.zip

    AMQP_Storm可能是一个用于简化AMQP操作的库,提供了一种更方便的方式来与支持AMQP的消息代理如RabbitMQ、Qpid或Apache ActiveMQ等交互。 描述中提到的"whl文件"是Python的Wheel格式,它是Python包索引(PyPI)上...

    java消息服务(第二版)

    此外,读者还将学习如何在不同的JMS提供者上部署和管理消息服务,如ActiveMQ、RabbitMQ和Apache Qpid等。 通过阅读《Java消息服务(第二版)》,开发者不仅可以掌握JMS的基本用法,还能深入了解其在复杂分布式系统...

    JMS简明教程(Word版)

    常见的消息代理有ActiveMQ、RabbitMQ和Apache Qpid等。 5. **目的地(Destination)**: 消息发送的目标,可以是队列(Queue)或主题(Topic)。队列遵循FIFO(先进先出)原则,确保每个消息只被一个消费者接收;而...

    Java Message Service

    6. **消息提供者(Message Broker)**:提供JMS服务的中间件,如ActiveMQ、RabbitMQ、Apache Qpid等,它们负责消息的存储、路由和传递。 ### 二、JMS搭建 **1. 准备工具** 首先,需要下载并安装消息提供者,这里...

    queue-demo-wwtbnbw.zip

    在Java中,有多个流行的消息队列实现,如Apache ActiveMQ、RabbitMQ、Kafka和Apache Qpid等。它们都提供了Java API供开发者使用。例如,RabbitMQ支持使用AMQP(Advanced Message Queuing Protocol)协议,而Kafka则...

    Jms的例子 不错的例子

    在JMS实现中,有多种提供商,如ActiveMQ、RabbitMQ和Apache Qpid等。每个提供商都有自己的API实现,但都遵循JMS规范,确保跨平台的兼容性。例如,使用ActiveMQ,我们需要导入相关的JMS库,并创建ConnectionFactory,...

    基于Java消息服务的异步邮件发送技术.pdf

    在实际部署中,企业可以根据需求选择合适的JMS实现,例如ActiveMQ、RabbitMQ或Apache Qpid等。同时,还可以利用消息持久化机制,保证在系统故障后仍能恢复未发送的邮件。 总结来说,基于Java消息服务的异步邮件发送...

    05_知其然而知其所以然:如何进行消息队列的技术选型?.zip

    例如,Apache ActiveMQ提供了多种级别的消息持久化,以适应不同场景的需求。 3. **可扩展性**:随着业务增长,MQ应能轻松扩展以处理更多消息。分布式MQ如Kafka和RabbitMQ支持水平扩展,可以通过增加节点来提升处理...

    Python库 | amqp_connection-1.4.3.tar.gz

    消息队列如RabbitMQ、Apache Qpid或ActiveMQ等通常使用AMQP协议,它们作为中间件,接收、存储并转发消息。`amqp_connection`库使得Python程序能够轻松地连接到这些消息队列服务,进行生产者(发送消息)和消费者...

    开源项目研究与应用小结.pdf

    Apache Qpid - **优点**:遵循高级消息队列协议(AMQP),提供C++/JAVA版本实现,消息模式可编程性强。 - **缺点**:需要掌握AMQP协议,成熟度略低于ActiveMQ。 ##### 3. Spring RabbitMQ - **优点**:遵循AMQP...

    WebJmsProject

    常见的JMS提供商有ActiveMQ、RabbitMQ、Apache Qpid等。它们负责存储、路由和传递消息,确保消息在生产者和消费者之间可靠传输。 5. **队列(Queue)**:队列是一种点对点的通信模式。每个消息只被一个消费者接收,...

    JMS的建立及其发布

    要建立JMS,首先你需要选择一个JMS提供商,如ActiveMQ、RabbitMQ或Apache Qpid等。每个提供商都有自己的实现,但都必须遵循JMS API规范。接下来,你需要配置JMS连接工厂,这通常涉及到设置URL、用户名、密码等连接...

    amqp1.0协议翻译

    由于其标准化和强大的功能,许多开源和商业消息队列产品都支持AMQP v1.0,如RabbitMQ、Apache Qpid、ActiveMQ等。 然而,需要注意的是,虽然AMQP v1.0提供了许可证,允许用户自由使用和实施规范,但用户需遵守条款...

    编码实现MQ连接池实现JMS消息发送连接管理

    1. **选择JMS实现**:首先,你需要选择一个JMS提供商,如ActiveMQ、RabbitMQ或Apache Qpid等。这些提供商提供了实现JMS规范的具体库,使得我们可以通过Java API与其交互。 2. **创建ConnectionFactory**:...

    JMS中/英文帮助文档

    常见的消息代理有ActiveMQ、RabbitMQ和Apache Qpid等。 7. **持久化(Persistence)**:为了保证消息的可靠性,JMS支持消息的持久化存储。即使消息代理崩溃,也能保证未被消费的消息不会丢失。 8. **事务...

    jms学习文档

    例如,ActiveMQ、RabbitMQ和Apache Qpid等都是流行的JMS提供者。选择合适的提供者取决于项目需求,如性能、稳定性、社区支持和与其他系统的集成能力等因素。 JMS的一个重要特性是事务支持,允许开发者将消息发送和...

Global site tag (gtag.js) - Google Analytics