ActiveMQ - performance tuning - general
博客专区 > nicholcz 的博客 > 博客详情
ActiveMQ - performance tuning - general
nicholcz 发表于3年前
ActiveMQ - performance tuning - general
  • 发表于 3年前
  • 阅读 39
  • 收藏 0
  • 点赞 0
  • 评论 0

What's delivery mode, which one is the default?

- The JMS spec allows for 2 delivery modes: persistent and non-persistent, the default mode is persistent.


Why non-peristent mode is faster?

  1. message producer doesn't have to wait for a receipt from the broker.

  2. persisting messages to message store is slow compared to messaging over network.


Hot to set non-persistent?

MessageProducer producer = session.createProducer(topic);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);


Why we batch up production of messages?

- Only the transaction boundary results in synchronous communication with the message broker.

So, we can batch up the production of messages.

Session session = con.createSession(true, Session.SESSION_TRANSACTED);
...
session.commit();


What transport should we use if the service that's dependent on a message broker co-locate with it?

- VM transport. Because messages delivered through a broker don't incur the cost of being serialized on the wire to be transported across the network.


What is OpenWire? How to tune this protocol?

- OpenWire is the default wire format used in ActiveMQ. 

- how to tune[default]:

  1. tightEncodingEnabled=false: this will disable CPU-intensive way to compact messages. [true]

  2. cacheEnabled=false: this will disable cache. Caching is good to remove repeated values from messages which improve the performance over network but cache look will bring about CPU load. [true]

.....

How to tune TCP transport?

  1. socketBufferSize: Usually the bigger the better. [65536]

  2. tcpNoDelay: normally a TCP socket buffers up small pieces of data before being sent. When we enable this option, messages will be sent ASAP.

Both above items are OS-dependent, it's worth testing!!


If we use Persistent delivery mode, how to tune?

- asynchronous send. This will tell producer not to expect receipt from broker that the message is on disk

标签: java JMS ActiveMQ
共有 人打赏支持
粉丝 0
博文 19
码字总数 4226
×
nicholcz
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: