So the reason for this is that currently there is a single thread per
connection processing server side operations. Normally these
operations are pretty fast; but if a producer is blocked, currently we
block the producer thread (to stopt it potentially sending more
messages and causing more trouble).

So if you are getting into scenarios of blocking producers, its
probably worth having a separate connection for all your consumers.

Another option is to try out 4.2-SNAPSHOT which has spooling to disk
as an option (as an alternative to blocking producers).


On 2/26/07, TonyLeigh <[EMAIL PROTECTED]> wrote:

Hello All,

I've been struggling with a problem of ActiveMQ locking up with a
combination of fast producers and slow consumers.  After trawling through
the threads I think I understand what is happening and why the lockup
occurs, but I can only solve the lockup with two connections when it seems
that one should work.

The situation is that I have a  http://www.nabble.com/file/6787/Client.java
Client.java
 making large requests as a fast producer and a
http://www.nabble.com/file/6788/Server.java Server.java  acting as a slow
consumer.

If you run the examples with a standard broker configuration the broker will
lock up due to lack of memory as the consumer in the sender cannot consume
messages as it needs to produce a reply inorder to send an ack.  If you
change the broker config to limit the memory per queue:

    <destinationPolicy>
      <policyMap><policyEntries>
          <policyEntry queue="TEST.>" memoryLimit="20000"/>
          <policyEntry queue="TEST.SERVER.IN" memoryLimit="10000"/>
      </policyEntries></policyMap>
    </destinationPolicy>

Then the broker does not lock up and the server is able to produce messages
to the client input queue.

The problem is that the consumer in the client will block and not receive
messages from the client queue if the consumer (and session) were created
from the same connection as the producer.  If a separate connection is used
then the client consumer will always consumer messages and the system does
not lock.

Why do I need a separate connection for the client consumer?  According to
the JMS spec a session should create a separate thread for message
consumption so the client should not block on consumption even if message
production is blocked.

Thanks,

Tony


--
View this message in context: 
http://www.nabble.com/Consumer-blocking-when-session-created-on-same-connection-as-blocked-producer-tf3294332s2354.html#a9163565
Sent from the ActiveMQ - User mailing list archive at Nabble.com.




--

James
-------
http://radio.weblogs.com/0112098/

Reply via email to