Asynchronous Writer
In DDS the term Asynchronous Write
is used to indicate that the process of writing a Data using a DDS DataWriter
is independent from the process of sending that data on the network. To accomplish this, Connext DDS uses a separate operating system Thread
owned by the Publisher
to send the data on the network.
By default when the application writes data using a DataWriter, the write operation is synchronous, that is, the same application Thread that calls the write operation is used to perform all the necessary tasks: data serialization, construction of the network (RTPS) message, encryption (if appropriate) and dispatch to the underlying transport(s) (e.g. UDP sockets, shared memory, etc.). This so-called synchronous write avoids a thread context switch and therefore uses less resources and has lower latency than an asynchronous write. However it delays the return of the write operation to the application.
Applications can configure a DataWriter
to write data asynchronously using the PUBLISH_MODE Qos Policy. When enabled, the application thread is only used to copy (serialize) the data into the DataWriter cache, the remaining operations are done by a separate thread managed by the Publisher
. The configuration of this Publisher thread can also be controlled via Qos. To do this use the ASYNCHRONOUS_PUBLISHER Qos Policy on the Publisher.
Asynchronous writing is required when the application wants to use a Flow Controller to regulate the rate at which the DataWriter sends data to the network.