Slow producer in ActiveMQ failover mode

Problem Description

A cJMS is configured as follows:

failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false

 

If the primary broker is in an active state (master) and the secondary broker is in a standby state (slave), then the producer produces at a faster rate.

 

If the secondary broker becomes the master (during failover switch), or if you change the order of the brokers (primary is still the master) then the producer produces at a slower rate, as shown below:

failover:(tcp://secondary:61616,tcp://primary:61616)?randomize=false

 

Root Cause

The slowness is due to the default timeout waste.

 

Solution

Perform one of the following options to resolve the issue:

 

  • Set a smaller connectionTimeout=50 to every node in the URI, for example:

    "failover:(tcp://primary:61616?connectionTimeout=50,tcp://secondary:61616?connectionTimeout=50)?randomize=false" 

Or

  • Select the Use PooledConnectionFactory option on the cMQConnectionFactory component.

Version history
Revision #:
5 of 5
Last update:
‎07-05-2019 03:47 AM
Updated by: