ZeroMQ,RabbitMQ和Apache Qpid之间的性能比较 [英] Performance comparison between ZeroMQ, RabbitMQ and Apache Qpid

查看:654
本文介绍了ZeroMQ,RabbitMQ和Apache Qpid之间的性能比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要高性能的消息总线,因此我正在评估ZeroMQRabbitMQApache Qpid的性能.为了衡量性能,我正在运行一个测试程序,该程序使用消息队列实现之一发布10,000条消息,并在同一台计算机上运行另一个进程以消耗这10,000条消息.然后,我记录发布的第一条消息和收到的最后一条消息之间的时间差.

I need a high performance message bus for my application so I am evaluating performance of ZeroMQ, RabbitMQ and Apache Qpid. To measure the performance, I am running a test program that publishes say 10,000 messages using one of the message queue implementations and running another process in the same machine to consume these 10,000 messages. Then I record time difference between the first message published and the last message received.

以下是我用于比较的设置.

Following are the settings I used for the comparison.

  1. RabbitMQ:我使用了扇出"类型交换和默认配置的队列.我使用RabbitMQ C客户端库.
  2. ZeroMQ:我的发布者使用ZMQ_PUSH套接字发布到tcp://localhost:port1,我的代理侦听tcp://localhost:port1并将消息重新发送到tcp://localhost:port2,而我的使用者使用tcp://localhost:port2 >插座.我正在使用代理而不是ZeroMQ中的对等通信,以使性能比较与使用代理的其他消息队列实现公平.
  3. Qpid C ++消息代理:我使用扇出"类型交换和具有默认配置的队列.我使用了Qpid C ++客户端库.
  1. RabbitMQ: I used a "fanout" type exchange and a queue with default configuration. I used the RabbitMQ C client library.
  2. ZeroMQ: My publisher publises to tcp://localhost:port1 with ZMQ_PUSH socket, My broker listens on tcp://localhost:port1 and resends the message to tcp://localhost:port2 and my consumer listens on tcp://localhost:port2 using ZMQ_PULL socket. I am using a broker instead of peer to to peer communication in ZeroMQ to to make the performance comparison fair to other message queue implementation that uses brokers.
  3. Qpid C++ message broker: I used a "fanout" type exchange and a queue with default configuration. I used the Qpid C++ client library.

以下是效果结果:

  1. RabbitMQ:大约需要1秒才能收到10,000条消息.
  2. ZeroMQ:大约需要15毫秒来接收10,000条消息.
  3. Qpid:大约需要4秒才能收到10,000条消息.
  1. RabbitMQ: it takes about 1 second to receive 10,000 messages.
  2. ZeroMQ: It takes about 15 milli seconds to receive 10,000 messages.
  3. Qpid: It takes about 4 seconds to receive 10,000 messages.

问题:

  1. 有人在消息队列之间运行类似的性能比较吗?然后,我想将我的结果与您的结果进行比较.
  2. 有什么方法可以调整RabbitMQQpid以使其性能更好?
  1. Have anyone run similar performance comparison between the message queues? Then I like to compare my results with yours.
  2. Is there any way I could tune RabbitMQ or Qpid to make it performance better?

注意:

测试是在具有两个分配的处理器的虚拟机上完成的.结果可能因硬件不同而异,但是我主要对MQ产品的相对性能感兴趣.

The tests were done on a virtual machine with two allocated processor. The result may vary for different hardware, however I am mainly interested in relative performance of the MQ products.

推荐答案

RabbitMQ可能正在对这些消息进行持久化.我认为您需要设置消息优先级或消息中的其他选项以不进行持久性处理.届时性能将提高10倍.您应该期望通过AMQP代理每秒至少发送10万条消息.在OpenAMQ中,我们的性能高达每秒30万条消息.

RabbitMQ is probably doing persistence on those messages. I think you need to set the message priority or another option in messages to not do persistence. Performance will improve 10x then. You should expect at least 100K messages/second through an AMQP broker. In OpenAMQ we got performance up to 300K messages/second.

AMQP 是为提高速度而设计的(例如,它不对消息进行打包以路由它们),但是ZeroMQ只是在关键方面进行了更好的设计.例如.它通过在没有代理的情况下连接节点来删除跃点;它比任何AMQP客户端堆栈都有更好的异步I/O;它执行更积极的消息批处理.可能花费60%的时间来构建ZeroMQ来进行性能调整.这是非常艰苦的工作.这不是偶然造成的.

AMQP was designed for speed (e.g. it does not unpack messages in order to route them) but ZeroMQ is simply better designed in key ways. E.g. it removes a hop by connecting nodes without a broker; it does better asynchronous I/O than any of the AMQP client stacks; it does more aggressive message batching. Perhaps 60% of the time spent building ZeroMQ went into performance tuning. It was very hard work. It's not faster by accident.

我想做的一件事,但太忙了,是在ZeroMQ之上重新创建一个类似于AMQP的代理.这里有第一层: http://rfc.zeromq.org/spec:15 .整个堆栈的工作方式类似于RestMS,将传输和语义分为两层.它会提供与AMQP/0.9.1几乎相同的功能(并且在语义上可以互操作),但速度要快得多.

One thing I'd like to do, but am too busy, is to recreate an AMQP-like broker on top of ZeroMQ. There is a first layer here: http://rfc.zeromq.org/spec:15. The whole stack would work somewhat like RestMS, with transport and semantics separated into two layers. It would provide much the same functionality as AMQP/0.9.1 (and be semantically interoperable) but significantly faster.

这篇关于ZeroMQ,RabbitMQ和Apache Qpid之间的性能比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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