Suppose the following data synchronisation approach:
- Topic A publishes every 100ms a message containing
- an integer key
- a related complex data structure V - Topic B publishes every 1s a message containing an integer, referencing the key of one of the last 20 messages of topic A.
- 10 different processes listen for topics A and B.
- In a sence, topic B decides which value V from the A-topic everybody will use. When receiving a B, all processes should "consume" the topic A value referenced by the B message. They use that value V in their own work (e.g. compute something and publish some information).
The "easy" approach would be to for every process to:
- Listen on Topic A with a history of 20
- Listen on Topic B
- If B is received, read its desired key and look back in the history for a message that has the desired key.
- Use that message's value V.
Unfortunately this approach has quite some performance drawbacks:
- Each process needs to establish the history (memory issue if the size of V is significant)
- Each process has to search for the right message in the history (performance issue because of duplicated work)
Is there a better approach to centrally agree on which A from a fast moving stream everybody will work on?
Best regards,
Johan
Why isn't B sending the actual V to work on?
In such a case the consumers can simply listen for B instead of listening for A.
Only the "decider" needs to listen to A (which now no longer needs to have a key field)
Maybe I'm missing something?
Hi KickR, thanks for your quick feedback and sorry for the delay in my answer...
Your suggestion is possible and has been considered:
I was wondering whether there is an efficient way of referencing other published values without the inherent overhead that I described in my original post and without the requirement of "republishing" already sent information.
Moreover, this is linked to my question https://community.rti.com/forum-topic/forwarding-message-unknown-type.
Maybe I should just describe the situation in a bit more detail:
Depending on the size of the data, referencing could be more efficient.
On the other hand, referencing introduces the described inefficiency unless some better referencing mechanism exists.
I understand that this case might be difficult to follow, so I appreciate the time you're taking to understand it.
Thanks,
Johan