PERSISTENT message have much slower performance than NON_PERSISTENT message

ibm-mq, java, jms, mq, websphere-7

Solution

Given the new title, I find I now have a response to this question.

Yes, persistent messages will always take longer than non-persistent messages with all other aspects being equal. The degree to which they are slower is highly tunable, though. In order to get the results that you are seeing it is likely that the queue manager has many of the worst-case tunings. Here are some of the factors that apply:

- Whether the disk is local or networked. For 100MBS and slower connections talking to NFS mounted over spinning disks, a local drive is almost always much faster. (Mounts to SAN with fiber channel and battery-backed cached controllers are nearly always faster than local spinning drives, however.) A common example is use of consumer-grade NAS drives. As great as home NAS units are, throughput is always slower than local disk.

- For local drives, the speed of the drive. Newer 'green' drives vary rotational speed to conserve power. Even 7200RPM disks can exhibit performance degredation compared to a 10k RPM drive.

- For local drives, the degree of fragmentation. Even though the messages are small, they are placed into pre-allocated log files that may be highly fragmented.

- Putting disk and log files on the same local volume. This causes head contention because a single message is written to both files before control returns to the application.

- Linear versus circular logs. Linear are slower because the log formatter must allocate them new each time.

- Whether syncpoint is used or not. If many messages are written in a single unit of work, WMQ can use cached writes and optimize the sector put operations. Only the COMMIT need ever be a blocking call.

Since non-persistent messages are handled entirely in memory, or overflowed to at most one disk file, then they are not affected by most of these issues.

Problem

I found that PERSISTENT message have much slower performance than NON_PERSISTENT message. I sent and received non_persistent messages and the performance is as follows. ``` Method Number of Msg Elapsed Time Sending - 500 messages - 00:00:0332 Receiving - 500 messages - 00:00:0281 ``` I sent and received persistent messages and the performance is as follows. ``` Sending - 500 messages - 00:07:0688 Receiving - 500 messages - 00:06:0934 ``` This behavior happens in both MQMessage and JMSMessage. Thank all people helping me out the problem. Special thanks to Shashi, T.Rob and Pangea.

Original source

Related problems