- 浏览: 838897 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
zjhzwx1212:
为什么用threadLocal后,输出值是从20开始的,而定义 ...
j2ee的线程安全--threadlocal -
aeoluspu:
不错 mysql 测试部分感觉不详细
用sysbench(或者super-smack)测试mysql性能 -
nanPrivate:
有没有例子,只理论,实践起来还是不会啊
JMS可靠消息传送 -
lwclover:
一个网络工程师 装什么b
postfix 如何删除队列中的邮件 -
maimode:
我也欠缺不少啊
理想的计算机科学知识体系
FUSE Message Broker Performance Tuning Guide
<!-- Root decorator: this is a layer of abstraction that Confluence doesn't need. It will be removed eventually. -->The FUSE Message Broker is based on Apache ActiveMQ, which offers numerous options for perofmance optimization. There are various things which affect the performance of Apache ActiveMQ and there are many ways you can use to make it go faster depending on your exact requirements.
Choose the right Quality of Service
Using persistent messaging is quite a bit slower than non-persistent messaging. Many things are a tradeoff in IT between performance and quality of service.
With non-persistent messaging, things are reliable - unless the broker is killed in which case any messages in the broker are lost. Persistent messaging avoids this by ensuring by default that every message is written to disk before the MessageProducer.send() method returns.
Even if you need persistent messaging there are various things you can do to speed things up - such as do you really need to block the sender to wait until the message is physically on disk on the broker before being able to send another message? There now follows a number of options you can consider if you need the extra safety of persistent messaging.
Use Transactions
If you are using persistent messaging and you don't want to use Async Sends then you should use JMS transactions to batch up many operations inside a single transaction.
Even if you have to pay the performance cost of XA transactions - using batching (processing and sending many messages in a single transaction (JMS or XA) will boost performance considerably. This is because you share the synchrony cost (the waiting for things to be written and sync'd to disk) across many many messages.
Use asynchronous sending
If you enable Async Sends then you will reduce the blocking in senders which increases throughput.
Increase the prefetch size
ActiveMQ uses a prefetch size to determine how many messages are streamed to a JMS consumer. The higher this number then typically the higher the throughput of the consumers as it typically means under heavy message load then the consumer always has more messages available immediately in RAM for processing - rather than having to wait for messages to be read and parsed from a socket.
Use Session.DUPS_OK_ACKNOWLEDGE
For transient messages (non persistent) or where performance is more critical than QOS, use Session.DUPS_OK_ACKNOWLEDGE on message consumers. The message consumer can lazily acknowledge and batch receipt of messages to the broker - which will dramatically improve performance. However, if you use Session.DUPS_OK_ACKNOWLEDGE with durable topic or Queue consumers for persistent messages, duplicate messages can be received if a consumer terminates abnormally (is killed without closing).
Other flags
If you look at javadoc of ActiveMQConnection you will see a number of properties you can use.
For example if you enable the following flags
- optimizedAcknowledge
- optimizedMessageDispatch
- useAsyncSend
- asyncDispatch
You will generally make ActiveMQ go faster, acknowledge messages in batches and use asynchronous sending
You can set these properties on the Connection object using Java code or using the connection URI String such as for Async Sends
Reduce latency using embedded brokers
If you send a message from a producer to a consumer then there are 2 network hops; one to get to the broker then from the broker to the consumer.
You can reduce one network hop by deploying an embedded broker in either the producer or consumer. Then there is no network hop on one end which typically reduces latency.
Avoid TCP for embedded brokers
If you are using an embedded broker then using the VM Transport is much more efficient than using the TCP Transport as objects can be passed by reference rather than being marshalled onto/off of a socket..
For more details see How to Run a Broker
Avoid message copy
If you know you are not going to reuse the Message object after sending then disable copyMessageOnSend flag on the ActiveMQConnection (via Java code or the connection URI)
Avoid unnecessary object serialization
If you are using the VM Transport with an embedded broker and using ObjectMessage intances then you can optimise the use of serialization (assuming that the producer and consumer are using the same classpath to avoid classloader issues).
To do this enable the objectMessageSerializeDefered flag which will avoid doing unnecessary serialisation of the Java objects inside the ObjectMessage instances.
Reduce CPU Usage: Use OpenWire loose encoding
By default ActiveMQ uses tight encoding with ActiveMQ. This encoding method uses more CPU but produces smaller packets. In most enviroments this works well. In some other enviroments where bandwith is not an issue and CPU usage is the constraint, switching to loose encoding should help reduce CPU usage.
For more assistance
The FUSE forum is available for any questions you may have.
发表评论
-
Improving performance and scalability with DDD
2010-09-19 14:57 1041http://gojko.net/2009/06/23/imp ... -
Java EE meets Web 2.0
2010-09-19 14:56 2478http://www.ibm.com/developerwor ... -
最全面的Hibernate 性能优化技巧
2010-08-19 16:28 1164http://www.duka ... -
必备的 Java 参考资源列表
2010-03-16 11:42 1390Java™ 平台不久将迎来 ... -
CWE/SANS发布2010年25个最危险的编程错误
2010-02-26 09:05 1224http://www.infoq.com/cn/news/20 ... -
一个程序员的多年珍藏(Java&Linux)
2010-01-15 17:25 5373http://jythoner.iteye.com/blog/ ... -
Java 推荐读物与源代码阅读
2010-01-15 17:24 1089http://jythoner.iteye.com/blog/ ... -
A Spring Security ACL tutorial for PostgreSQL
2010-01-01 22:48 1514http://server.denksoft.com/word ... -
ddd using jpa
2009-12-28 10:00 1058http://www.iteye.com/topic/6540 ... -
java的ddd框架
2009-12-28 09:43 2677SpringXT是Spring框架的一个扩展用于开发riche ... -
hibernate session cache tips
2009-12-27 22:13 9721、只有当通过主键load或者get时,hibernate才不 ... -
事物tips
2009-12-27 20:27 9341、只读标志只在事务启动时应用。不启动任何事务,则只读标志被忽 ... -
常用正则表达式
2009-12-24 10:11 1006Email : /^\w+([-+.]\w+)*@\w+([- ... -
hibernate batch insert 和id策略
2009-11-17 10:40 1115在id生成策略为native的情况下,batch insert ... -
两个好用的java反编译工具
2009-11-09 09:54 874jad jd-gui -
Design Patterns in Dynamic Programming
2009-11-07 23:04 1049http://norvig.com/design-patter ... -
几个好用的开源工具
2009-11-02 14:20 1139DBDesigner4 一款开源的数据库设计、建模、维 ... -
持续集成的极好例子
2009-10-28 09:56 1924http://www.iteye.com/topic/4993 ... -
fix tomcat memory settings
2009-10-27 16:10 936-Dorg.apache.jasper.runtime.Bod ... -
CI和maven私服
2009-10-22 18:56 1051Nexus quickbuild hudson
相关推荐
1.4 JMS代码调优 1.4.1 注意必要的事项,避免使用不必要的特征 1.4.2 消息类型的选择 1.4.3 确认方式的选择和JMS事务 1.5 EJB代码调优 1.5.1 有效使用设计模式 1.5.2 使用EJB和WebLogic的特性 1.5.3 缓存资源 1.5.4 ...
[Packt Publishing] Liferay Portal 性能调优最佳实践 (英文版) [Packt Publishing] Liferay Portal Performance Best Practices (E-Book) ☆ 出版信息:☆ [作者信息] Samir Bhatt [出版机构] Packt Publishing...
JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS(JMS
Classes contained in javax.jms.jar: javax.transaction.xa.XAResource.class javax.jms.BytesMessage.class javax.jms.Message.class javax.jms.JMSException.class javax.jms.Destination.class javax.jms....
javax.jms.BytesMessage.class javax.jms.Connection.class javax.jms.ConnectionConsumer.class javax.jms.ConnectionFactory.class javax.jms.ConnectionMetaData.class javax.jms.DeliveryMode.class javax.jms....
文件包含: 13个不同固件 两个固件升级工具 其中一个是量产工具可以修改休眠时间和盒子信息 TRIM检查工具 有几个固件版本为全网首发,别人没有的资源 固件列表: JMS578_00.01.00.05 ...JMS578_254.02.03.09_NoUAS
JMS561U.PcbLib AD封装测试可用,给大家分享一下,。。。。
jms工具jar包,使用jms需要的jar包(jms工具jar包,使用jms需要的jar包)
JMicron JMS578 USB/SATA bridge JMS578介绍手册JMS578_Product+Brief.pdf JMS578固件(支持Android系统/linux系统) JMS578 windows的烧录工具和JMS578FwUpdate JMS578-Hardkenel-Release-v173.01.00.02-20190306....
weblogic笔记包括: weblogic 的性能调优 weblogic 与JVM的配合 weblogic JMS与集群之间的关系 apache的性能调优 apache研究安全性与吞吐量
JMS学习好的帮助文档。需要的同学下载。 概述……………………………………………………………………………………………..3 体系结构………………………………………………………………………………………..4 JMS...
Jmicron JMS583 Datasheet USB 3.1 Gen 2 to PCIe Gen3x2 Bridge
包含JMS必需的javax.jms.jar包,以及jms基础实例代码。
javax.jms包,sun的JMS接口规范包 2018年6月4日17:05:30
JMS583编程器固件备份,用于USB-NVME的固态硬盘桥接方案。nvme USB硬盘盒JMS583方案在市面上占有率很高,出现掉固件的情况可能会有,可以用编程器烧录试试。
绿巨能JMS578硬盘盒刷固件
JMS 简介以及Weblogic配置JMS图解
本人开发的spring jms项目,已经上线近一年了,这里是我项目jms配置文件,使用的是spring jms 整合weblogic jms。如果真的需要,请咨询我,并且附上我上传的这个配置文件,附近中没有带有这个文件,一律不作任何回答...
硬盘盒JMS578更新固件 休眠修改
JMS567用于硬盘盒3.5寸刷机,567芯片,可备份 JMS567用于硬盘盒3.5寸刷机,567芯片,可备份