04-21-2014 11:21 AM
Hi all,
Based on https://decibel.ni.com/content/thread/20890?tstart=0, it sounds like a lot of people have applications that stream data between actors outside of AF messsages (ie: for live data display). Since shared variables clearly have some drawbacks as discussed in the link, what do you use to stream data between actors?
Solved! Go to Solution.
04-21-2014 12:47 PM
Queues!
04-21-2014 12:55 PM
Network Streams
04-21-2014 01:11 PM
Todd: Do you have any update rate issues with using queues for streaming data? I have a requirement for an indicator to update at 10Hz from the acquisition device. Using messages to accomplish this so far has not met the required update rate. LVB: I've been looking at network streams this morning, but the one-to-one nature of streams isn't compatible with my system since I allow multiple consumers (say, a UI and a logger) to follow one producer. That fact was what led me to the SV's in the first place, of course.
04-21-2014 01:54 PM
I'll go out on a limb and say your problem isn't due to the queues. 10 Hz is nothing... I've had queues move hundreds of messages per second without breaking a sweat and seen reports of them moving thousands of messages per second.
04-21-2014 02:24 PM
To use queues to pass streaming data, I'd need to send the new data from the actor that generated/acquired it to an actor that forwards the message to any actor that is listening. Sounds like a lot of overhead, but maybe that points out a weakness in my approach...
04-22-2014 03:01 PM
I set up a new project today that uses queues to stream data. With three producers totally 25 channels firing at the controller and one consumer, I'm seeing elapsed times of 4ms to buffer the data and send it on to the consumer. This is WAY faster than shared variables! To handle the one to many requirement, I have each consumer register their message queue with the controller. When new data is uploaded, the controller sends a copy of the data via message to each subscriber. Data upload and data forwarding messages are type specific, but the code duplication is minimal. As long as each consumer at least has a method for each type of data forwarding message, there is no problem. Thank you everyone for your input!