Simplify the PubSub architecture
(see internal notes for more details)
The goal of this ticket is to simplify the threads of the PubSub part of S2OPC, then test its performances (targetting sub-millisecond publications), and merge if successful.
The goal is not to refactor more than necessary.
Moreover, the new architecture will only be available on Linux for now, as it relies on clock_nanosleep
and FIFO scheduling (see man 7 sched
).
The new architecture is based on two threads, one per role. The Publisher wakes up only when it should send a message. The Subscriber wakes up only when it has received data.
The interface GetSourceVariable
and SetTargetVariable
are kept.
The first is called when the Publisher wakes up to obtain fresh values.
It should be as quick as possible.
A cache implemented with a SOPC_Dict
demonstrates such quick implementation (see samples/PubSub/pubsub
),
which enables publications at around 100µs on a RaspberryPi.
The cache in this sample application is protected by a mutex, which is quick enough for our first tests (subscriber and publisher both share the cache access @ 100µs).
The goal is to also have a cache in the pubsub_server
application:
We then have to decide how the cache and the OPC UA server share data (either red or green path).