ActiveMQ - performance tuning - general

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

转载于:https://my.oschina.net/u/1242229/blog/282380

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值