11-26-2021 11:13 AM
I'm working on implementing an architecture that's very heavily reliant on queues for data transfer.
However, I recently ran into a use case where I need to maximize the speed at which data is transferred from one thread to another.
Do DVRs provide a higher speed than queues? I tend to think of both as pointer type mechanisms, but I don't fully understand the internals.
11-26-2021 08:03 PM
A Queue is a buffer, typically a FIFO variety (you can use the Enqueue From Opposite End to make it a LIFO).
A DVR is a single value.
So you are talking about two completely different things here.
Generally speaking, a queue is the fastest way to pass data between two loops without losing any data. If you only care about the latest value, I would probably lean toward a Notifier since it will not cause the producer to be blocked while the consumer reads the value as you would with a DVR.
11-26-2021 11:50 PM
I should have been a little more specific. I'm deciding between a single element lossy queue (using preview queue on the reader side) and DVR. I believe notifiers behave basically the same way as the single element queue, but I am likely wrong about that. I do tend to use them the same way though...
Basically I'm wondering if DVR's have less overhead than queues or notifiers.
11-27-2021 01:06 AM
@plus1etal wrote:
I should have been a little more specific. I'm deciding between a single element lossy queue (using preview queue on the reader side) and DVR. I believe notifiers behave basically the same way as the single element queue, but I am likely wrong about that. I do tend to use them the same way though...
Basically I'm wondering if DVR's have less overhead than queues or notifiers.
Are you trying to use a DVR as some kind of fancy global variable?
11-27-2021 08:29 AM - edited 11-27-2021 08:31 AM
In essence, yes. I can't use globals because the processes are dynamically launched, factory style. So no named variables.
Edit: This is a reply to Bill. I'm not sure why it didn't do the normal reply format.
11-27-2021 10:23 AM
@plus1etal wrote:
In essence, yes. I can't use globals because the processes are dynamically launched, factory style. So no named variables.
Do you care to know when a new value has been received or just what the current value is?
Typically, my parallel loops are of a Queued Message Handler variant. So I will use the message queue to tell the process that a value has been updated. If you want more of a broadcast method, User Events are handy.