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?
message producer doesn't have to wait for a receipt from the broker.
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]:
tightEncodingEnabled=false: this will disable CPU-intensive way to compact messages. [true]
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?
socketBufferSize: Usually the bigger the better. 
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