此内容没有您所选择的语言版本。

43.2. Tuning JMS


Optimization is possible in the following areas when using the JMS API:
  • Disable message id. Use the setDisableMessageID() method on the MessageProducer class to disable message ids if not needed. This decreases the size of the message and also avoids the overhead of creating a unique ID.
  • Disable message time stamp. Use the setDisableMessageTimeStamp() method on the MessageProducer class to disable message timestamps not required.
  • Avoid ObjectMessage. ObjectMessage is convenient but it comes at a cost. The body of a ObjectMessage uses Java serialization to serialize it to bytes. The Java serialized form of even small objects is verbose, resulting in increased server traffic, also Java serialization is slow in comparison to custom marshaling techniques. Only use ObjectMessage if one of the other message types are unsuitable (for example, if the type of payload is unknown until run-time).
  • Avoid AUTO_ACKNOWLEDGE. AUTO_ACKNOWLEDGE mode requires an acknowledgment to be sent from the server for each message received on the client, this means more traffic on the network. If possible, use DUPS_OK_ACKNOWLEDGE, or use CLIENT_ACKNOWLEDGE or a transacted session and batch up many acknowledgments with one acknowledge/commit.
  • Avoid durable messages. By default JMS messages are durable. If really durable messages are not required, set the messages to be non-durable. Durable messages incur much more overhead in persisting them to storage.
  • Batch many sends or acknowledgments in a single transaction. HornetQ will only require a network round trip on the commit, not on every send or acknowledgment.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat