activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaya_srini <jya_sr...@Hotmail.com>
Subject Re: Question about Producer Consumer usage
Date Sun, 18 May 2008 03:43:30 GMT

Just adding to my previious post ...

I am not creating multiple threads in the application for sending messages.
There is only one main thread for the application which creates the JMS
objects upfront (i.e. only once) when it gets loaded. After that the objects
are reused for sending the messages as the link suggests below

http://activemq.apache.org/how-do-i-use-jms-efficiently.html


jaya_srini wrote:
> 
> Hi Hiram
> 
> I followed what was said in this link in the ActiveMQ page
> 
> http://activemq.apache.org/how-do-i-use-jms-efficiently.html
> 
> Also from our observation, it looked like a problem with the failover
> protocol and synchrounous sending of messages. It seemd like the thread
> trying to reconnect was deadlocking with the thread trying to send
> messages.
> 
> Once we removed the failover protocol and sent messages asyncrhonously we
> are not seeing this issue any more. I also loadtested with this
> configuration in our environment with 10 concurrent threads and we are not
> seeing the issue.
> 
> thanks
> jaya
> 
> Hiram Chirino wrote:
>> 
>> Looks like you have multiple threads concurrently sending messages
>> using only 1 session.  The JMS spec explicitly states that this is not
>> allowed.  Sessions should only be used by 1 thread at a time.
>> 
>> On Tue, May 13, 2008 at 1:45 PM, jaya_srini <jya_srini@hotmail.com>
>> wrote:
>>>
>>> thanks for the response, Filip!
>>>
>>> Thread dump below is what we got on the client side. I'll try and see if
>>> I
>>> can get a better dump. So what would be the resolution for this? Will
>>> enabling the jms.useAsyncSend property on the connection URI help fix
>>> this
>>> i.e cause the send to be asynchronous so that it doesn't block?
>>>
>>> daemon prio=6 tid=0x3793f400 nid=0x1f28 waiting for monitor entry
>>> [0x38aff000..0x38affc98]
>>>   java.lang.Thread.State: BLOCKED (on object monitor)
>>>        at
>>> org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1587)
>>>        - waiting to lock <0x07c45ea0> (a java.lang.Object)
>>>        at
>>> org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:226)
>>>        at
>>> org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:268)
>>>        at
>>> org.apache.activemq.ActiveMQTopicPublisher.publish(ActiveMQTopicPublisher.java:146)
>>>
>>>
>>> Filip Hanik - Dev Lists wrote:
>>>>
>>>> as I mentioned, the blocking happens on the mutex for an
>>>> ActiveMQSession, the only way you can end up blocking two threads
>>>> there,
>>>> is if two threads are using the same session,
>>>>
>>>> can you post the complete thread dump?
>>>>
>>>> thanks
>>>> Filip
>>>>
>>>> jaya_srini wrote:
>>>>> So Sorry! :(
>>>>>
>>>>> I just thought I would explain our scenario in more details.
>>>>>
>>>>>
>>>>> jaya_srini wrote:
>>>>>
>>>>>> Hello
>>>>>>
>>>>>> Apologies for all the questions but I am a newbie to ActiveMQ and
I
>>>>>> would
>>>>>> really like to better understand how the ActiveMQ broker works and
>>>>>> was
>>>>>> wondering if someone can explain how it would work for the scenario
>>>>>> below:
>>>>>>
>>>>>> I am using single session with 1 producer and 1 consumer (durable
>>>>>> Topic
>>>>>> subscrber) for producing and consuming messages i.e the same session
>>>>>> produces and consumes messages. The session/producer/consumer are
>>>>>> created
>>>>>> in app startup once and are reused through out.
>>>>>>
>>>>>> There is a message listener on the consumer for receiving messages
>>>>>> asynchrounously.
>>>>>>
>>>>>> Messages are persistent (written to the database) and we are using
>>>>>> the
>>>>>> Publish-Subscribe model.
>>>>>>
>>>>>> The client APP (that send and receives the message) and the ActiveMQ
>>>>>> broker are on different machines so I use a TCP transport to
>>>>>> establish
>>>>>> connection with a failover protocol so the connection URI looks like
>>>>>> below
>>>>>>
>>>>>> failover:(tcp://<broker_ip>:61616/)
>>>>>>
>>>>>> We are using ActiveMq 5.0.0
>>>>>>
>>>>>> Given the above info, what is the number of threads created on the
>>>>>> broker
>>>>>> side for sending and dispatching. Will the send and dispatch be
>>>>>> synchronous by default for the above?
>>>>>>
>>>>>> If I make the connection URI to be as follows
>>>>>>
>>>>>> tcp://<broker_ip>:61616?jms.useAsyncSend=true&jms.dispatchAsync=true
>>>>>>
>>>>>> will this cause the send and dispatch to be asynchronous?
>>>>>>
>>>>>> We are having some porblem with producer bloacking on
>>>>>> ActiveMQSession.send() with our current set up and I would like to
>>>>>> really
>>>>>> understand what's happening to be able to resolve this.
>>>>>>
>>>>>> thank you!
>>>>>> jaya
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Question-about-Producer-Consumer-usage-tp17170621s2354p17214415.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Regards,
>> Hiram
>> 
>> Blog: http://hiramchirino.com
>> 
>> Open Source SOA
>> http://open.iona.com
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-Producer-Consumer-usage-tp17170621s2354p17298961.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message