FlowControl does not work when no consumer is attached
------------------------------------------------------

                 Key: AMQ-2685
                 URL: https://issues.apache.org/activemq/browse/AMQ-2685
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.3.1
         Environment: Linux 2.6.25.20-0.5-default SMP x86_64 GNU/Linux
            Reporter: André Lison


When a producer fills a queue with flow control enabled and there is no 
consumer, flow control does not work as expected, therefore it does not slow 
down or block the producer. If the queue is over the configured limit and then 
a consumer is attached, the flow control kicks in immediately and denies 
producers to push new messages onto the queue until the CursorPercentUsage is 
down to 100%.

More detailed:
When there is only one producer and no consumer, the jconsole shows 
CursorMemoryUsage=0 and CursorPercentUsage=0 and the broker fills up the 
storage until it is full according to the systemUsage settings. 
CursorMemoryUsage can increase slightly but does not reflect the overall memory 
usage of the queue (mem+storage). The producer is only stopped (by the flow 
control?) when the queue hits the storeUsage-limit.
As soon as there is a consumer attached, the CursorMemoryUsage shows much 
higher values and the CursorPercentUsage is of course way over 100%. The 
producer is blocked until the CursorPercentUsage down to 100% and 
CursorPercentUsage is almost equal to the policyEntry/memoryLimit of the queue 
- which looks like the desired behavior to me. Now flow control works and keeps 
producer and consumer in balance.

My activemq.xml:
        ...
        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="false" 
memoryLimit="5mb">
                  <pendingSubscriberPolicy>
                    <vmCursor />
                  </pendingSubscriberPolicy>
                </policyEntry>
                <policyEntry queue="result.>" producerFlowControl="true" 
memoryLimit="60 mb">
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy> 
        .....
        <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage limit="100 mb"/>
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="1 gb" name="foo"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="100 mb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>
        ...





-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to