使用 RabbitMQ 最大化吞吐量 [英] Maximize throughput with RabbitMQ

查看:250
本文介绍了使用 RabbitMQ 最大化吞吐量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的项目中,我们希望使用任务队列"模式中的 RabbitMQ 来传递数据.

In our project, we want to use the RabbitMQ in "Task Queues" pattern to pass data.

在生产者端,我们构建了一些 TCP 服务器(在 node.js 中)来接收高并发数据,不做任何事情,直接发送到MQ.

On the producer side, we build a few TCP server(in node.js) to recv high concurrent data and send it to MQ without doing anything.

在消费者端,我们使用JAVA客户端从MQ,处理然后确认.

On the consumer side, we use JAVA client to get the task data from MQ, handle it and then ack.

所以问题是:要获得最大的消息传递吞吐量/性能(例如,400,000 msg/秒),最好使用多少个队列?更多的队列是否意味着更好的吞吐量/性能?还有什么我应该注意的吗?在这种情况下使用 RabbitMQ 的任何已知最佳实践指南?

So the question is: To get the maximum message passing throughput/performance( For example, 400,000 msg/second) , How many queues is best? Does that more queue means better throughput/performance? And is there anything else should I notice? Any known best practices guide for using RabbitMQ in such scenario?

非常感谢任何评论!!

推荐答案

为了在 RabbitMQ 中获得最佳性能,请遵循其创建者的建议.来自 RabbitMQ 博客:

For best performance in RabbitMQ, follow the advice of its creators. From the RabbitMQ blog:

RabbitMQ 的队列在空时速度最快.当队列是空,它有消费者准备好接收消息,然后尽快队列收到一条消息,它直接发送到消费者.对于持久队列中的持久消息,是的,它也将转到磁盘,但这是以异步方式完成的,并且被大量缓冲.重点是很少记账需要做的,很少修改数据结构,而且非常需要分配的额外内存很少.

RabbitMQ's queues are fastest when they're empty. When a queue is empty, and it has consumers ready to receive messages, then as soon as a message is received by the queue, it goes straight out to the consumer. In the case of a persistent message in a durable queue, yes, it will also go to disk, but that's done in an asynchronous manner and is buffered heavily. The main point is that very little book-keeping needs to be done, very few data structures are modified, and very little additional memory needs allocating.

如果你真的想深入挖掘 RabbitMQ 队列的性能,这个 他们的其他博客条目 更深入地研究了数据.

If you really want to dig deep into the performance of RabbitMQ queues, this other blog entry of theirs goes into the data much further.

这篇关于使用 RabbitMQ 最大化吞吐量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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