Messages taking lot of time to be sent (as if they were blocked)
zenzei2k Nov 26, 2011 11:24 AMI have a strange problem in a Jboss 4.2.3+HornetQ 2.2.5 installation, and i don't know where to look at.
I'm sending a lot of not so big messages and the operation is almost normal, with messages of around 4k bytes sended in 0.01 seconds. I'm measuring the send time as the time it takes the call to
{code}producer.send(message);{code}
But sometimes happens that the same messages (4k) take a long time to be sent, around 70 seconds (without throwing any kind of warn or errors). As it happens randomly in production, I don't have the steps to reproduce it in a simple manner.
I must say I have Paging and Persistence disabled, with PRE_ACKNOWLEDGE mode activated.
Here is the code I use to create my server connection
{code}
ConnectionFactory cf = (ConnectionFactory) jndiTemplate.lookup("java:/JmsXA");
Destination topic = (Destination) jndiTemplate.lookup("topic/testTopic");
Connection connection = cf.createConnection();
Session session = connection.createSession(false, HornetQJMSConstants.PRE_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(topic);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
producer.setDisableMessageID(true);
producer.setDisableMessageTimestamp(true);
producer.setTimeToLive(5000);
connection.start();
{code}
The code of the send method
{code}
public void send(byte[] payload) throws Exception
{
try {
BytesMessage message = session.createBytesMessage();
message.writeBytes(payload);long time = System.nanoTime();
producer.send(message);log.debug("Message sended in "+((System.nanoTime()-time)/Math.pow(10, 9)));
} catch (IllegalStateException e) {
destroy();
initialize();
}
}
{code}
And here the code of the client (I have fifty of them)
{code}
ConnectionFactory cf = (ConnectionFactory) jndiTemplate.lookup("ConnectionFactory");
Destination destination = (Destination) jndiTemplate.lookup("topic/testTopic");
Connection connection = cf.createConnection();
connection.setExceptionListener(this);
Session session = connection.createSession(false, HornetQJMSConstants.PRE_ACKNOWLEDGE);
MessageConsumer consumer = session.createConsumer(destination);
connection.start();
{code}
This is the global address-settings configuration
{code:xml}
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<!--dead-letter-address>jms.queue.DLQ</dead-letter-address-->
<!--expiry-address>jms.queue.ExpiryQueue</expiry-address-->
<max-delivery-attempts>1</max-delivery-attempts>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<page-size-bytes>1048576</page-size-bytes>
<last-value-queue>true</last-value-queue>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
</address-setting>
</address-settings>
<persistence-enabled>false</persistence-enabled>
{code:xml}
Anybody knows why this could be happening or where to look at to try to discover the problem? I really don't know if theres is some kind of blocking or is something else. Maybe is there any timeout I can configure to kill the send of a message if takes more than X seconds?
Thanks in advance!
-
jms-ds.xml.zip 976 bytes
-
hornetq-jms.xml 2.1 KB
-
ra.xml 15.1 KB