ActiveMQ:批量发布,持久发布消息,但不是异步发布消息? [英] ActiveMQ: Publish Messages in bulk, persistent, but not async?

查看:156
本文介绍了ActiveMQ:批量发布,持久发布消息,但不是异步发布消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以批量存储大量消息? 我想让它们同步,持久地发送,但是一次要非常快.

is it possible to store a large amount of messages in bulk? I want to send them sync, persistent, but to get speed very much at one time.

我正在使用NMS(Java框架的.net版本).但是,如果您只知道如何在Java中执行此操作,那么它甚至会有所帮助.也许我可以更轻松地找到.net的解决方案.

I am using NMS, the .net version of the java-framework. But if you only know how to do this in java, it would even help. Maybe I can find a solution for .net more easier.

我想到了诸如交易之类的事情.但是我只让交易对消费者有用,而对生产者没有作用.

I thought of things like transactions. But I only got transactions to work for consumers, not for producers.

推荐答案

传统的建议是,如果您希望在批量发送时获得最大的吞吐量,那么您应该采用SESSION_TRANSACTED确认模式,并将所有消息发送与批处理一起发送. .commit().

Conventional wisdom used to suggest that if you wanted maximum throughput when sending in bulk, then you should a SESSION_TRANSACTED acknowledgement mode and batch all of the message sends together with a .commit().

不幸的是,这是一个基准测试,表明情况并非如此.

Unfortunately, here's a benchmark showing this not to be the case http://www.jakubkorab.net/2011/09/batching-jms-messages-for-performance-not-so-fast.html and that are you better off just sending them as normal without transactions. If you are already using transactions, then it may make sense to try and batch them.

我在这里的建议还在于,除非您要处理对时间极为敏感的消息,否则产生的速率不会有太大的问题-您应该更关注带宽而不是速度的邮件发送.如果您不介意消息混乱,则可以让多个生产者将这些消息生产到给定的目的地...或者如果您需要它们,以便使用多个生产者,然后使用

My advice here also is that unless you are dealing with messages that are extremely time sensitive, the rate at which you produce isn't going to be that big of a deal - you should be more concerned with bandwidth as opposed to speed of message sends. If you don't mind your messages being out of order you can have multiple producers produce these messages to a given destination... or if you need them in order use multiple producers and then a resequencer after they are in the broker.

这篇关于ActiveMQ:批量发布,持久发布消息,但不是异步发布消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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