You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Toralf Lund <to...@pgs.com> on 2012/07/23 09:27:39 UTC

Delivery order of LVQ data?

Hi.

In my C++ messaging client, I'm reading data from a last-value queue via 
a loop that's essentially as follows:

while(1) {
    try
       session.sync();
       qpid::messaging::Receiver receiver=session.nextReceiver(timeout);

       message=receiver.fetch(qpid::messaging::Duration::IMMEDIATE);
       session.acknowledge();
       messageType=message.getProperties()["message_type"].asString();
< handle the data... >

    } catch(const qpid::messaging::NoMessageAvailable &error) {
    }
}



At the moment, the session has just one receiver, associated with a 
"common" LVQ for all the data. "message_type" is registered as last 
value queue key via "qpid.last_value_queue_key: message_type" in the X 
declare arguments. The receiver is also set up with "mode: browse".

In what order can I expect to get data from these calls? Note that 
"replacements" in the terms of the LVQ behaviour may well appear on the way.

The reason why I'm asking is that although the above works in a way, in 
some cases I never seem to receive certain "message_type"s that are 
supposed to be on the queue. One possible explanation is perhaps that 
"replacement" messages from data that I've read in the past keeps 
appearing, and will get priority so that I never get to some of the 
unread types, if you know what I mean. But I may be seeing something 
else entirely...

Thanks,


- Toralf


This e-mail, including any attachments and response string, may contain proprietary information which is confidential and may be legally privileged. It is for the intended recipient only. If you are not the intended recipient or transmission error has misdirected this e-mail, please notify the author by return e-mail and delete this message and any attachment immediately. If you are not the intended recipient you must not use, disclose, distribute, forward, copy, print or rely on this e-mail in any way except as permitted by the author.

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


Re: Delivery order of LVQ data?

Posted by Gordon Sim <gs...@redhat.com>.
On 07/25/2012 11:57 AM, Toralf Lund wrote:
> I believe I have found the actual root of the problem now - there was
> also a Session::sync() call for every message received, which I somehow
> overlooked earlier, and had quite forgotten that I inserted at some
> stage as a part of some kind of experiment... I suppose that without the
> acknowledge calls this would just exit directly as there was nothing to
> sync, but with the calls in place, it would wait for each
> acknowledgement to reach the server (like when you pass "true" for the
> "block" parameter.) I guess this is expected to take as long as what I'm
> seeing?

Yes, with the sync() it will take a roundtrip per message and without 
tcp-nodelay being set that could be the 40ms per message you are seeing.

> Anyhow, I can easily move the call so that it gets executed
> every second or two when I let the message receive loop exit to do
> various checks and household tasks, rather than once for every message,
> but I'm also sort of wondering if there is a need to synchronise
> explicitly at all.

No, since all you are confirming is that the broker got the accept, and 
the accept is in fact not needed, there is no value to the sync.

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


Re: Delivery order of LVQ data?

Posted by Toralf Lund <to...@pgs.com>.
On 25/07/12 11:59, Gordon Sim wrote:
> On 07/25/2012 08:19 AM, Toralf Lund wrote:
>> The problem appears to be that I call
>> qpid::Messaging::session::acknowledge() every time a new message has
>> been received. If I just comment out this call, I can read all the 1288
>> messages that are currently sitting on my queue in something like 175 
>> ms...
>>
>> So, I suppose I still don't quite understand how the acknowledgement
>> logic works. I mean, isn't it supposed to be possible to acknowledge
>> messages as they are received? Maybe it's right to just leave out the
>> call in any case, when browsing the messages via "mode: browse" in
>> receiver arguments?
>
> Certainly the acknowledge call isn't needed in the browse case.
OK.
> Also acknowledging each message individually is less optimal than 
> acknowledging in batches (say every 20 messages or so). I'm still 
> rather surprised at how slow it was in the original form.
I believe I have found the actual root of the problem now - there was 
also a Session::sync() call for every message received, which I somehow 
overlooked earlier, and had quite forgotten that I inserted at some 
stage as a part of some kind of experiment... I suppose that without the 
acknowledge calls this would just exit directly as there was nothing to 
sync, but with the calls in place, it would wait for each 
acknowledgement to reach the server (like when you pass "true" for the 
"block" parameter.) I guess this is expected to take as long as what I'm 
seeing? Anyhow, I can easily move the call so that it gets executed 
every second or two when I let the message receive loop exit to do 
various checks and household tasks, rather than once for every message, 
but I'm also sort of wondering if there is a need to synchronise 
explicitly at all.

Thanks again,


- Toralf



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


This e-mail, including any attachments and response string, may contain proprietary information which is confidential and may be legally privileged. It is for the intended recipient only. If you are not the intended recipient or transmission error has misdirected this e-mail, please notify the author by return e-mail and delete this message and any attachment immediately. If you are not the intended recipient you must not use, disclose, distribute, forward, copy, print or rely on this e-mail in any way except as permitted by the author.

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


Re: Delivery order of LVQ data?

Posted by Gordon Sim <gs...@redhat.com>.
On 07/25/2012 08:19 AM, Toralf Lund wrote:
> The problem appears to be that I call
> qpid::Messaging::session::acknowledge() every time a new message has
> been received. If I just comment out this call, I can read all the 1288
> messages that are currently sitting on my queue in something like 175 ms...
>
> So, I suppose I still don't quite understand how the acknowledgement
> logic works. I mean, isn't it supposed to be possible to acknowledge
> messages as they are received? Maybe it's right to just leave out the
> call in any case, when browsing the messages via "mode: browse" in
> receiver arguments?

Certainly the acknowledge call isn't needed in the browse case. Also 
acknowledging each message individually is less optimal than 
acknowledging in batches (say every 20 messages or so). I'm still rather 
surprised at how slow it was in the original form.

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


Re: Delivery order of LVQ data?

Posted by Toralf Lund <to...@pgs.com>.
On 25/07/12 09:03, Toralf Lund wrote:
> On 23/07/12 16:33, Gordon Sim wrote:
>> On 07/23/2012 01:58 PM, Toralf Lund wrote:
>>> On 23/07/12 10:42, Gordon Sim wrote:
>>>> On 07/23/2012 08:27 AM, Toralf Lund wrote:
>>>>> Hi.
>>>>>
>>>>> In my C++ messaging client, I'm reading data from a last-value 
>>>>> queue via
>>>>> a loop that's essentially as follows:
>>>>>
>>>>> while(1) {
>>>>>     try
>>>>>        session.sync();
>>>>>        qpid::messaging::Receiver 
>>>>> receiver=session.nextReceiver(timeout);
>>>>>
>>>>>        message=receiver.fetch(qpid::messaging::Duration::IMMEDIATE);
>>>>>        session.acknowledge();
>>>>>        
>>>>> messageType=message.getProperties()["message_type"].asString();
>>>>> < handle the data... >
>>>>>
>>>>>     } catch(const qpid::messaging::NoMessageAvailable &error) {
>>>>>     }
>>>>> }
>>>>>
> [ ... ]
>
>>
>>>>
>>>> What capacity are you using on the receiver?
>>> At the moment, just 1 - to make sure nextReceiver() will actually 
>>> return
>>> something... Perhaps this makes the message reception very inefficient?
>>
>> It can certainly slow down the browser quite a lot.
> I changed it to 1000, but it didn't really make a lot of difference.
>
> I can extract messages only at a rate of about 25 messages a second, 
> even when a lot of them are already queued, and the queue resides on 
> the local host. The messages aren't that large, either - content size 
> ranges from around 10 to 120 or so.
>
> Maybe I'm doing this the wrong way...
The problem appears to be that I call 
qpid::Messaging::session::acknowledge() every time a new message has 
been received. If I just comment out this call, I can read all the 1288 
messages that are currently sitting on my queue in something like 175 ms...

So, I suppose I still don't quite understand how the acknowledgement 
logic works. I mean, isn't it supposed to be possible to acknowledge 
messages as they are received? Maybe it's right to just leave out the 
call in any case, when browsing the messages via "mode: browse" in 
receiver arguments?


- Toralf
>
>
> - Toralf
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: users-help@qpid.apache.org
>>
>
>
> This e-mail, including any attachments and response string, may 
> contain proprietary information which is confidential and may be 
> legally privileged. It is for the intended recipient only. If you are 
> not the intended recipient or transmission error has misdirected this 
> e-mail, please notify the author by return e-mail and delete this 
> message and any attachment immediately. If you are not the intended 
> recipient you must not use, disclose, distribute, forward, copy, print 
> or rely on this e-mail in any way except as permitted by the author.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>


This e-mail, including any attachments and response string, may contain proprietary information which is confidential and may be legally privileged. It is for the intended recipient only. If you are not the intended recipient or transmission error has misdirected this e-mail, please notify the author by return e-mail and delete this message and any attachment immediately. If you are not the intended recipient you must not use, disclose, distribute, forward, copy, print or rely on this e-mail in any way except as permitted by the author.

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


Re: Delivery order of LVQ data?

Posted by Toralf Lund <to...@pgs.com>.
On 23/07/12 16:33, Gordon Sim wrote:
> On 07/23/2012 01:58 PM, Toralf Lund wrote:
>> On 23/07/12 10:42, Gordon Sim wrote:
>>> On 07/23/2012 08:27 AM, Toralf Lund wrote:
>>>> Hi.
>>>>
>>>> In my C++ messaging client, I'm reading data from a last-value 
>>>> queue via
>>>> a loop that's essentially as follows:
>>>>
>>>> while(1) {
>>>>     try
>>>>        session.sync();
>>>>        qpid::messaging::Receiver 
>>>> receiver=session.nextReceiver(timeout);
>>>>
>>>>        message=receiver.fetch(qpid::messaging::Duration::IMMEDIATE);
>>>>        session.acknowledge();
>>>>        messageType=message.getProperties()["message_type"].asString();
>>>> < handle the data... >
>>>>
>>>>     } catch(const qpid::messaging::NoMessageAvailable &error) {
>>>>     }
>>>> }
>>>>
[ ... ]

>
>>>
>>> What capacity are you using on the receiver?
>> At the moment, just 1 - to make sure nextReceiver() will actually return
>> something... Perhaps this makes the message reception very inefficient?
>
> It can certainly slow down the browser quite a lot.
I changed it to 1000, but it didn't really make a lot of difference.

I can extract messages only at a rate of about 25 messages a second, 
even when a lot of them are already queued, and the queue resides on the 
local host. The messages aren't that large, either - content size ranges 
from around 10 to 120 or so.

Maybe I'm doing this the wrong way...


- Toralf

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


This e-mail, including any attachments and response string, may contain proprietary information which is confidential and may be legally privileged. It is for the intended recipient only. If you are not the intended recipient or transmission error has misdirected this e-mail, please notify the author by return e-mail and delete this message and any attachment immediately. If you are not the intended recipient you must not use, disclose, distribute, forward, copy, print or rely on this e-mail in any way except as permitted by the author.

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


Re: Delivery order of LVQ data?

Posted by Gordon Sim <gs...@redhat.com>.
On 07/23/2012 01:58 PM, Toralf Lund wrote:
> On 23/07/12 10:42, Gordon Sim wrote:
>> On 07/23/2012 08:27 AM, Toralf Lund wrote:
>>> Hi.
>>>
>>> In my C++ messaging client, I'm reading data from a last-value queue via
>>> a loop that's essentially as follows:
>>>
>>> while(1) {
>>>     try
>>>        session.sync();
>>>        qpid::messaging::Receiver receiver=session.nextReceiver(timeout);
>>>
>>>        message=receiver.fetch(qpid::messaging::Duration::IMMEDIATE);
>>>        session.acknowledge();
>>>        messageType=message.getProperties()["message_type"].asString();
>>> < handle the data... >
>>>
>>>     } catch(const qpid::messaging::NoMessageAvailable &error) {
>>>     }
>>> }
>>>
>>>
>>>
>>> At the moment, the session has just one receiver, associated with a
>>> "common" LVQ for all the data. "message_type" is registered as last
>>> value queue key via "qpid.last_value_queue_key: message_type" in the X
>>> declare arguments. The receiver is also set up with "mode: browse".
>>>
>>> In what order can I expect to get data from these calls? Note that
>>> "replacements" in the terms of the LVQ behaviour may well appear on the
>>> way.
>>
>> The messages should be delivered in FIFO order from the LVQ.
> OK.
>>
>>> The reason why I'm asking is that although the above works in a way, in
>>> some cases I never seem to receive certain "message_type"s that are
>>> supposed to be on the queue. One possible explanation is perhaps that
>>> "replacement" messages from data that I've read in the past keeps
>>> appearing, and will get priority so that I never get to some of the
>>> unread types, if you know what I mean. But I may be seeing something
>>> else entirely...
>>
>> When a new message arrives with a key matching an existing message,
>> the older message will be removed, and the new one added in a new
>> position at the end of the queue. Replacement messages therefore move
>> the key back in the delivery order.
> And this is done regardless of whether the original messages where
> actually delivered to the application(s)? I suppose it must be, since
> it's not for the (shared browse-only) queue to know who exactly is
> supposed to read the data...
>
> I think this could be my problem, which would kind of make it the
> opposite of what I suggested. The thing is, some of the messages that
> appear to be missing are actually transferred at a higher rate that most
> others, which at least makes it more likely that I won't be able to read
> one particular "instance" before it's replaced... If it also turns out
> that I can't even get through all the "lower rate" messages before new
> versions appear, surely I may have a scenario where the "fast" data
> continues to be pushed back in the queue?

Yes, that could be the case...

> I really don't see any reasons why I shouldn't be able to handle *all*
> messages, though, so perhaps I need to check my receiver setup again...
>
>> They do not let that key leapfrog over other keys, so cannot delay
>> delivery of other existing values.
>>
>> I suppose in theory it would be possible for a particular interleaving
>> to continually delay delivery of a particular key, such that it was
>> never delivered. It seems unlikely, and I haven't succeeded in
>> reproducing it, but I couldn't rule it out completely.
>>
>> What capacity are you using on the receiver?
> At the moment, just 1 - to make sure nextReceiver() will actually return
> something... Perhaps this makes the message reception very inefficient?

It can certainly slow down the browser quite a lot.

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


Re: Delivery order of LVQ data?

Posted by Toralf Lund <to...@pgs.com>.
On 23/07/12 10:42, Gordon Sim wrote:
> On 07/23/2012 08:27 AM, Toralf Lund wrote:
>> Hi.
>>
>> In my C++ messaging client, I'm reading data from a last-value queue via
>> a loop that's essentially as follows:
>>
>> while(1) {
>>     try
>>        session.sync();
>>        qpid::messaging::Receiver receiver=session.nextReceiver(timeout);
>>
>>        message=receiver.fetch(qpid::messaging::Duration::IMMEDIATE);
>>        session.acknowledge();
>>        messageType=message.getProperties()["message_type"].asString();
>> < handle the data... >
>>
>>     } catch(const qpid::messaging::NoMessageAvailable &error) {
>>     }
>> }
>>
>>
>>
>> At the moment, the session has just one receiver, associated with a
>> "common" LVQ for all the data. "message_type" is registered as last
>> value queue key via "qpid.last_value_queue_key: message_type" in the X
>> declare arguments. The receiver is also set up with "mode: browse".
>>
>> In what order can I expect to get data from these calls? Note that
>> "replacements" in the terms of the LVQ behaviour may well appear on the
>> way.
>
> The messages should be delivered in FIFO order from the LVQ.
OK.
>
>> The reason why I'm asking is that although the above works in a way, in
>> some cases I never seem to receive certain "message_type"s that are
>> supposed to be on the queue. One possible explanation is perhaps that
>> "replacement" messages from data that I've read in the past keeps
>> appearing, and will get priority so that I never get to some of the
>> unread types, if you know what I mean. But I may be seeing something
>> else entirely...
>
> When a new message arrives with a key matching an existing message, 
> the older message will be removed, and the new one added in a new 
> position at the end of the queue. Replacement messages therefore move 
> the key back in the delivery order.
And this is done regardless of whether the original messages where 
actually delivered to the application(s)? I suppose it must be, since 
it's not for the (shared browse-only) queue to know who exactly is 
supposed to read the data...

I think this could be my problem, which would kind of make it the 
opposite of what I suggested. The thing is, some of the messages that 
appear to be missing are actually transferred at a higher rate that most 
others, which at least makes it more likely that I won't be able to read 
one particular "instance" before it's replaced... If it also turns out 
that I can't even get through all the "lower rate" messages before new 
versions appear, surely I may have a scenario where the "fast" data 
continues to be pushed back in the queue?

I really don't see any reasons why I shouldn't be able to handle *all* 
messages, though, so perhaps I need to check my receiver setup again...

> They do not let that key leapfrog over other keys, so cannot delay 
> delivery of other existing values.
>
> I suppose in theory it would be possible for a particular interleaving 
> to continually delay delivery of a particular key, such that it was 
> never delivered. It seems unlikely, and I haven't succeeded in 
> reproducing it, but I couldn't rule it out completely.
>
> What capacity are you using on the receiver?
At the moment, just 1 - to make sure nextReceiver() will actually return 
something... Perhaps this makes the message reception very inefficient?

- Toralf

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


This e-mail, including any attachments and response string, may contain proprietary information which is confidential and may be legally privileged. It is for the intended recipient only. If you are not the intended recipient or transmission error has misdirected this e-mail, please notify the author by return e-mail and delete this message and any attachment immediately. If you are not the intended recipient you must not use, disclose, distribute, forward, copy, print or rely on this e-mail in any way except as permitted by the author.

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


Re: Delivery order of LVQ data?

Posted by Gordon Sim <gs...@redhat.com>.
On 07/23/2012 08:27 AM, Toralf Lund wrote:
> Hi.
>
> In my C++ messaging client, I'm reading data from a last-value queue via
> a loop that's essentially as follows:
>
> while(1) {
>     try
>        session.sync();
>        qpid::messaging::Receiver receiver=session.nextReceiver(timeout);
>
>        message=receiver.fetch(qpid::messaging::Duration::IMMEDIATE);
>        session.acknowledge();
>        messageType=message.getProperties()["message_type"].asString();
> < handle the data... >
>
>     } catch(const qpid::messaging::NoMessageAvailable &error) {
>     }
> }
>
>
>
> At the moment, the session has just one receiver, associated with a
> "common" LVQ for all the data. "message_type" is registered as last
> value queue key via "qpid.last_value_queue_key: message_type" in the X
> declare arguments. The receiver is also set up with "mode: browse".
>
> In what order can I expect to get data from these calls? Note that
> "replacements" in the terms of the LVQ behaviour may well appear on the
> way.

The messages should be delivered in FIFO order from the LVQ.

> The reason why I'm asking is that although the above works in a way, in
> some cases I never seem to receive certain "message_type"s that are
> supposed to be on the queue. One possible explanation is perhaps that
> "replacement" messages from data that I've read in the past keeps
> appearing, and will get priority so that I never get to some of the
> unread types, if you know what I mean. But I may be seeing something
> else entirely...

When a new message arrives with a key matching an existing message, the 
older message will be removed, and the new one added in a new position 
at the end of the queue. Replacement messages therefore move the key 
back in the delivery order. They do not let that key leapfrog over other 
keys, so cannot delay delivery of other existing values.

I suppose in theory it would be possible for a particular interleaving 
to continually delay delivery of a particular key, such that it was 
never delivered. It seems unlikely, and I haven't succeeded in 
reproducing it, but I couldn't rule it out completely.

What capacity are you using on the receiver?

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