HornetQ - producer.send() taking a long time
goldengate001 Jun 25, 2012 2:31 PMI am trying to migrate an application from JBOSS 4.2.2 to JBOSS 7.2.0.
Posting a message to a persistence enabled topic is taking a long time. It is as though the JBOSS server is blocking on something.
Here are the key information.
1. producer.send(message) is taking a long time. Eg: 10 seconds to 45 seconds.
2. Topic is persistence enabled.
3. There is only one durable consumer at this point. But, this will be 4 when this goes to production.
I did try setting the journal-sync-transactional to false to see if it is giving me a performance boost. Not much.
Standalone-full.xml entry is as follows:
| <subsystem xmlns="urn:jboss:domain:messaging:1.2"> | |
| <hornetq-server> | |
| <persistence-enabled>true</persistence-enabled> | |
| <journal-sync-transactional>false</journal-sync-transactional> | |
| <journal-file-size>102400</journal-file-size> | |
| <journal-min-files>2</journal-min-files> | |
| <journal-directory path="../data/messaging"/> |
| <connectors> | |
| <netty-connector name="netty" socket-binding="messaging"/> | |
| <netty-connector name="netty-throughput" socket-binding="messaging-throughput"> | |
| <param key="batch-delay" value="50"/> | |
| </netty-connector> | |
| <in-vm-connector name="in-vm" server-id="0"/> | |
| </connectors> |
| <acceptors> | |
| <netty-acceptor name="netty" socket-binding="messaging"/> | |
| <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput"> | |
| <param key="batch-delay" value="50"/> | |
| <param key="direct-deliver" value="false"/> | |
| </netty-acceptor> | |
| <in-vm-acceptor name="in-vm" server-id="0"/> | |
| </acceptors> |
| <security-settings> | |
| <security-setting match="#"> | |
| <permission type="send" roles="guest"/> | |
| <permission type="consume" roles="guest"/> | |
| <permission type="createNonDurableQueue" roles="guest"/> | |
| <permission type="deleteNonDurableQueue" roles="guest"/> | |
| </security-setting> | |
| </security-settings> |
| <address-settings> | |
| <address-setting match="#"> | |
| <dead-letter-address>jms.queue.DLQ</dead-letter-address> | |
| <expiry-address>jms.queue.ExpiryQueue</expiry-address> | |
| <redelivery-delay>0</redelivery-delay> | |
| <max-size-bytes>10485760</max-size-bytes> | |
| <address-full-policy>BLOCK</address-full-policy> | |
| <message-counter-history-day-limit>10</message-counter-history-day-limit> | |
| </address-setting> | |
| </address-settings> |
| <jms-connection-factories> | |
| <connection-factory name="InVmConnectionFactory"> | |
| <connectors> | |
| <connector-ref connector-name="in-vm"/> | |
| </connectors> | |
| <entries> | |
| <entry name="java:/ConnectionFactory"/> | |
| </entries> | |
| </connection-factory> | |
| <connection-factory name="RemoteConnectionFactory"> | |
| <connectors> | |
| <connector-ref connector-name="netty"/> | |
| </connectors> | |
| <entries> | |
| <entry name="RemoteConnectionFactory"/> | |
| <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/> | |
| </entries> | |
| </connection-factory> | |
| <pooled-connection-factory name="hornetq-ra"> | |
| <transaction mode="xa"/> | |
| <connectors> | |
| <connector-ref connector-name="in-vm"/> | |
| </connectors> | |
| <entries> | |
| <entry name="java:/JmsXA"/> | |
| </entries> | |
| </pooled-connection-factory> | |
| </jms-connection-factories> |
| <jms-destinations> | |
| <jms-queue name="testQueue"> | |
| <entry name="queue/test"/> | |
| <entry name="java:jboss/exported/jms/queue/test"/> | |
| </jms-queue> | |
| <jms-topic name="AlchemyJobTopic"> | |
| <entry name="topic/AlchemyJobTopic"/> | |
| <entry name="java:jboss/exported/jms/topic/AlchemyJobTopic"/> | |
| </jms-topic> | |
| </jms-destinations> | |
| </hornetq-server> | |
| </subsystem> |
Code that posts a message to the topic is as follows:
| try | |||
| { | |||
| Connection connection = connectionFactory.createConnection(); | |||
| Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); | |||
| MessageProducer producer = session.createProducer(topic); | |||
| connection.start(); | |||
| MapMessage message = session.createMapMessage(); | |||
| message.setString(eventType, body); | |||
| message.setIntProperty("JMS_JBOSS_REDELIVERY_DELAY", 60000); | |||
| message.setIntProperty("JMS_JBOSS_REDELIVERY_LIMIT", 1440); | |||
| message.setStringProperty("MESSAGE_TYPE", eventType); | |||
| log.debug("Before sent to Queue, " + eventType); | |||
| producer.send(message); | |||
| log.debug("After sent to Queue, " + eventType); |
| session.close(); | |||
| connection.close(); | |||
| } | |||
| catch(Exception e) | |||
| { | |||
| log.error("Error while posting to Queue : ", e); | |||
| } |
ConnectionFactory and the topic are injected as
@Resource(mappedName = "java:/JmsXA")
@Resource(mappedName = "java:/topic/AlchemyJobTopic")
I have not been able to figure out the rootcause yet. Please let me know if you have any thoughts. Thanks!