DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Directly sending messages to ONLY specific cloneable module instance?

I'm aware of how the messages to cloneable modules works (all receive the message, only th addressed module ID acts on it) and the reasons for this design choice. However, I'm finding myself in a situation where I need a cloneable module, but they will be receiving lots of messages in quick succession. I believe the overhead of discarding messages not addressed to the specific module will add up to something detrimental to overall performance one there are a few modules involved. Are there any recommendations for setting up specifically addressed communications between a specific module and the module that launches it? My first thought is to pass a queue reference (or maybe event reference) to the module at startup. Would that work? Is that the "best" solution? Any experiences doing this sort of thing?

0 Kudos
Message 1 of 10
(1,671 Views)

I don't think there's a single "best" solution, as there are many ways to skin a cat, and an infinite amount of scenarios...

 

My go-to solution would be a manually created user event(*), probably created by the module starting the clone, and then handing the event reference to the clone via a regular request. The clone can then register for the event, either in the EHL or in a helper loop. You can also hand the reference over via the Start Module.vi, however using a request gives you more freedom in when you provide the reference, or even re-sending the reference...

 

(*) I like to use user events as that is the default communication paradigm in DQMH. Obviously, you could go with a queue instead...




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


Message 2 of 10
(1,656 Views)

Just out of curiosity, how many clones do you expect to have and how quickly will you send requests?

 

On my PC it took about 11us per request, using 100 clones and 1000 requests all addressed to the first clone.

Strangely, if I address the request to all clones (-1) it sends the requests much faster, I'm not sure why.

 

Capture.PNG

Message 3 of 10
(1,651 Views)

@Gregory wrote:

Just out of curiosity, how many clones do you expect to have and how quickly will you send requests?

 

On my PC it took about 11us per request, using 100 clones and 1000 requests all addressed to the first clone.

Strangely, if I address the request to all clones (-1) it sends the requests much faster, I'm not sure why.

 

Capture.PNG


Well... you may laugh but. It's a UI for a cloneable timer where I wanted the timer/UI separate but also wanted 100th's of a second on the UI refreshing sub 200ms or so. I imagined that a dozen or so modules sending out the value to their cloneable module UIs would get crazy. I didn't test anything or think it through much further (which is a mistake as computers can be unintuitively quick at certain tasks and struggle at others you wouldn't think).

0 Kudos
Message 4 of 10
(1,632 Views)

A few notes regarding the benchmark VI:

 

  • Stephen Loftus-Mercer teaches us that when doing benchmarking, the VI containing the code under test should not have its front panel loaded and visible, to avoid UI thread related jitter
  • Clarification for people just starting out with LabVIEW: The fact that two nodes / VIs / etc are placed next to or underneath each other does not necessarily mean that those two pieces of code are executed in parallel or sequentially.
    I assume - and I'd be happy to be corrected if I'm wrong - that we cannot be 100% sure if the timing VIs in the screenshot are executed before, in parallel or after the DQMH request VIs in the same sequence frame

And as for the question why addressing all clones (id = -1) is so much faster? The answer can be found in the cloneable module's "Addressed to this module.vi".




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 5 of 10
(1,624 Views)

Benchmarking is an art. Darren has a whole presentation on it. You can probably find it on the LabVIEW Wiki somewhere. Worth reviewing before attempting any benchmarking as it is very easy to get it wrong.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 6 of 10
(1,618 Views)

@Taggart wrote:

Benchmarking is an art. Darren has a whole presentation on it. 


Not quite a whole presentation, but slides 13-16 of Brainless LabVIEW.

Message 7 of 10
(1,614 Views)

Thanks for supplying the link. I just realized that every time I benchmark stuff I waste a bunch of time looking for that. Now I created a shortcut!

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 8 of 10
(1,608 Views)

@joerg.hampel wrote:

And as for the question why addressing all clones (id = -1) is so much faster? The answer can be found in the cloneable module's "Addressed to this module.vi".


Hi Joerg,

 

But why does that make generating the events faster? Do the modules process the event so much faster that the event queue doesn't have to grow as much?

0 Kudos
Message 9 of 10
(1,604 Views)

I was quite confident that the difference is coming from the fact that for -1, there's no need to compare or look up the ID... But at second glance, that can't be it! I stand corrected it seems.

 

I tried with a Request (without reply) and can reproduce your results - without any explanation. Looking at the Event Inspector Window, I can't spot any differences between the two scenarios - but those are tiny timing values I'm looking at so I'm not sure how to quantify any of this.

 

Sorry!




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 10 of 10
(1,593 Views)