qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zhihua Che <zhihua....@gmail.com>
Subject Re: what does mean 'Capacity'?
Date Thu, 12 Jul 2012 11:58:14 GMT
2012/7/12 Gordon Sim <gsim@redhat.com>:
> On 07/12/2012 03:36 AM, Zhihua Che wrote:
>> hi,
>>      I got confused with the term of 'capacity' of the sender and
>> receiver.
> Essentially 'capacity' restricts the number of 'buffered' messages. In the
> case of the sender, this is messages that have been sent but not yet
> confirmed by the broker. In the case of the receiver this is the number of
> messages the broker can pre-emptively send to the client - what is often
> known as 'prefetch', i.e. messages send by the broker before the application
> has actually fetched them, in anticipation of- and in order to speed up-
> subsequent fetches.
>>      In my app, I create a queue and a sender and a receiver bound with
>> it.
>>      I also set both the capacity of the sender and receiver as 100.
>>      Through qpid-tool, I find that, every time the receiver receives
>> one message from the queue, a field named 'acquires' of the queue is
>> increased by one.
> Right, that indicates the broker allocating a message to the consumer.
>>      When the 'acquires' number reaches the 100, my app cannot get
>> message from the queue any more.
> What do you mean here? Certainly that number should not go up further
> without the receiver calling fetch(), but the receiver should certainly be
> able to fetch() more messages. The capacity 'window' is moved as messages
> sent by the broker are handed off to the application in response to fetch()
> calls.
>>      So, what does the term 'capacity' and the field 'acquires' mean?
> Hopefully the description of capacity above will make sense. The 'acquires'
> stat in management tracks the number of message 'allocations'. For competing
> consumers, each message is given to only one consumer - the consumer is
> considered to have 'acquired' the message.

>>      I noticed that, in qpid-tool, another field 'release' which is
>> actually above 'acquires' is always 0, is it right?
> Yes, unless you either release messages explicitly (through
> Session::release()) or end a session without acknowledging messages, there
> will be no released messages.
> Releasing a message is a mechanism for allowing a message acquired by one
> consumer to be returned to the available state and re-acquired (potentially
> by another consumer).
>>      As for my code, I use c++ client and qpid::messaging api. I send
>> the message using sender.send(msg, true), and fetch message with
>> fetch(msg, Duration::IMMEDIATE), and acknowledge by call
>> session.acknowledge();
> If sending synchronously (i.e. specifying true for the second parameter to
> send()), the senders capacity is of no real significance as you are blocking
> until that send has completed. (In effect the used capacity will never be
> greater than 1).
> If you are finding that you stop being able to fetch() messages even when
> there are some available on the queue, please provide a bit more detail on
> the receiving application, ideally a reproducer.
> Hope this helps...

Thanks for your detailed reply and it helps a lot.
But I still cannot understand the behavior of my app.

Precisely, there are two processes, a producer (sender) and a consumer
Before sending messing, sender.setCapacity(100) and
receiver.setCapacity(100) are called.
Then, sender.send(msg, true) is used to send message while
receiver.fetch(msg, Duration::IMMEDIATE) is used to fetch message.
The receiver also print the message content every time when it fetches
a message successfully.
The strange thing is the receiver cannot fetch any message from the
queue after it receives the 100 messages.
And the sender process still continues, that is, not blocked by the
call to send(msg, true).

To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org

View raw message