- 浏览: 850834 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
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 1074http://gojko.net/2009/06/23/imp ... -
Java EE meets Web 2.0
2010-09-19 14:56 2510http://www.ibm.com/developerwor ... -
最全面的Hibernate 性能优化技巧
2010-08-19 16:28 1186http://www.duka ... -
必备的 Java 参考资源列表
2010-03-16 11:42 1426Java™ 平台不久将迎来 ... -
CWE/SANS发布2010年25个最危险的编程错误
2010-02-26 09:05 1246http://www.infoq.com/cn/news/20 ... -
一个程序员的多年珍藏(Java&Linux)
2010-01-15 17:25 5440http://jythoner.iteye.com/blog/ ... -
Java 推荐读物与源代码阅读
2010-01-15 17:24 1137http://jythoner.iteye.com/blog/ ... -
A Spring Security ACL tutorial for PostgreSQL
2010-01-01 22:48 1541http://server.denksoft.com/word ... -
ddd using jpa
2009-12-28 10:00 1084http://www.iteye.com/topic/6540 ... -
java的ddd框架
2009-12-28 09:43 2718SpringXT是Spring框架的一个扩展用于开发riche ... -
hibernate session cache tips
2009-12-27 22:13 10041、只有当通过主键load或者get时,hibernate才不 ... -
事物tips
2009-12-27 20:27 9741、只读标志只在事务启动时应用。不启动任何事务,则只读标志被忽 ... -
常用正则表达式
2009-12-24 10:11 1022Email : /^\w+([-+.]\w+)*@\w+([- ... -
hibernate batch insert 和id策略
2009-11-17 10:40 1152在id生成策略为native的情况下,batch insert ... -
两个好用的java反编译工具
2009-11-09 09:54 900jad jd-gui -
Design Patterns in Dynamic Programming
2009-11-07 23:04 1070http://norvig.com/design-patter ... -
几个好用的开源工具
2009-11-02 14:20 1167DBDesigner4 一款开源的数据库设计、建模、维 ... -
持续集成的极好例子
2009-10-28 09:56 1959http://www.iteye.com/topic/4993 ... -
fix tomcat memory settings
2009-10-27 16:10 966-Dorg.apache.jasper.runtime.Bod ... -
CI和maven私服
2009-10-22 18:56 1078Nexus quickbuild hudson
相关推荐
性能调优对于确保WebLogic Server上运行的应用程序能够高效、稳定地运行至关重要。性能调优主要涉及对应用程序、服务器和底层硬件资源的优化,以此提升系统性能和响应能力。 文档首先提出了在J2EE应用程序体系结构...
本文基于一份来自Oracle官方的中文版WebLogic性能调优教程,深入解析其中的关键知识点,涵盖WebLogic Server内核、Web应用程序、JDBC、EJB/MDB、JMS、超时及诊断性能问题等多方面调优策略。 ### WebLogic Server...
性能调优是确保这些应用程序高效运行的关键环节。下面将详细介绍Java EE性能调优的相关知识点。 1. **JVM参数调优**: - **内存配置**:调整初始堆大小(`-Xms`)和最大堆大小(`-Xmx`),以适应应用的内存需求,...
本文将详细介绍WebLogic Server 10的性能调优方法,涉及内核调优、Web应用程序调优、JDBC调优、EJB/MDB调优、JMS调优、应用程序调优、超时调优和诊断性能问题等方面。 内核调优主要是针对WebLogic Server的基本运行...
【WebLogic 10 性能调优】是Oracle WebLogic Server 10版本的优化技术探讨,这个主题涵盖了在企业级应用环境中如何提升WebLogic Server的运行效率和响应速度,确保系统的稳定性和高可用性。Oracle培训课程的资料包含...
性能调优是为了最大化应用程序的响应速度和系统吞吐量,同时保持良好的资源利用率。WebLogic提供了多种调优工具和策略,包括: - **JVM设置**:调整Java虚拟机的内存分配、垃圾收集策略等参数,以适应应用的需求。 ...
此外,文中还详细阐述了应用服务器的关键组件如类加载器(ClassLoader)的作用以及基于JMX的技术特点,在此基础上进一步解释了应用服务器性能调优的重要性和多种优化方式。 适合人群:从事Java应用开发运维的专业人士...
WebLogic Server性能调优是一个涉及多个层面的复杂过程,包括硬件、操作系统、网络、JVM、WebLogic Server自身配置以及应用程序的优化。下面将详细讲解这些方面的调优策略。 首先,硬件和操作系统的选择至关重要。...
【JBoss性能调优】 JBoss是一个开源的J2EE应用服务器,它的代码遵循LGPL许可证,因此在商业应用中可以免费使用。Jboss支持EJB 1.1和EJB 2.0规范,主要作为EJB的管理和运行容器。尽管Jboss核心服务主要是一个EJB...
[Packt Publishing] Liferay Portal 性能调优最佳实践 (英文版) [Packt Publishing] Liferay Portal Performance Best Practices (E-Book) ☆ 出版信息:☆ [作者信息] Samir Bhatt [出版机构] Packt Publishing...
除此之外,WAS的性能调优还包括JMS(Java消息服务)、EJB(企业JavaBean)、Session管理以及动态缓存等方面。例如,优化JMS的队列和主题配置,调整EJB容器的并发控制,以及合理配置Session的生命周期和缓存策略,都...
- **网络性能调优**:优化网络配置,减少网络延迟和丢包率。 #### 数据库性能调优 数据库往往是影响Web应用性能的重要因素之一。对于Oracle数据库,可以采取以下优化措施: - **ORACLE参数优化**:调整Oracle...
【WebSphere Application Server V7 性能调优】 WebSphere Application Server V7 是 IBM 提供的一款强大且可靠的服务器平台,用于支持多种企业级应用程序。由于每个应用程序都有其独特的特性和需求,因此,对于...
在BEA WebLogic平台上进行J2EE调优是确保企业级应用高效运行的关键步骤。以下是一些关键的调优策略: 1. **通用代码调优**: ...同时,性能调优不应只在出现问题后进行,而应贯穿于整个软件开发周期。
#### 一、性能调优概览(Performance Tuning Overview) 在J2EE环境中,性能调优是一项至关重要的任务,它直接影响到系统的响应时间、吞吐量以及稳定性。本部分主要介绍了性能调优的整体框架,强调了不同层面的调优...
在BEA WebLogic平台上进行J2EE调优是提高应用程序性能和稳定性的重要步骤。这篇文章将带你深入了解如何在各个层面上优化你的系统。 首先,我们从应用程序本身的调优开始。通用代码调优涉及到优化代码逻辑,减少不必...