Skip to content

Commit 1d9cad3

Browse files
asorbiniclalancette
authored andcommitted
Replace reliability optimizations with built-in profile Optimization.ReliabilityProtocol.Common
Signed-off-by: Andrea Sorbini <[email protected]>
1 parent dfc2419 commit 1d9cad3

File tree

3 files changed

+22
-62
lines changed

3 files changed

+22
-62
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ its defaults.
210210
211211
### RMW_CONNEXT_DISABLE_RELIABILITY_OPTIMIZATIONS
212212
213-
By default, `rmw_connextdds` will modify the QoS of each realiable DataWriter
213+
By default, `rmw_connextdds` will modify the QoS of each reliable DataWriter
214214
and DataReader to improve the responsiveness of the RTPS [reliability protocol](https://community.rti.com/static/documentation/connext-dds/6.0.1/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/Content/UsersManual/Using_QosPolicies_to_Tune_the_Reliable_P.htm?tocpath=Part%203%3A%20Advanced%20Concepts%7C11.%20Reliable%20Communications%7C11.3%20Using%20QosPolicies%20to%20Tune%20the%20Reliable%20Protocol%7C_____0#reliable_1394042328_776265).
215215
216216
For example, the ["heartbeat period"](https://community.rti.com/static/documentation/connext-dds/6.0.1/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/Content/UsersManual/Controlling_Heartbeats_and_Retries.htm#reliable_1394042328_785637)

rmw_connextdds_common/include/rmw_connextdds/static_config.hpp

-45
Original file line numberDiff line numberDiff line change
@@ -238,51 +238,6 @@
238238
#define RMW_CONNEXT_DEFAULT_RELIABILITY_OPTIMIZATIONS 1
239239
#endif /* RMW_CONNEXT_DEFAULT_RELIABILITY_OPTIMIZATIONS */
240240

241-
/******************************************************************************
242-
* Regular hearbeat period used by any reliable RTPS Writer.
243-
* This is an initializer for an instance of type DDS_Duration_t.
244-
******************************************************************************/
245-
#ifndef RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD
246-
#define RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD {0, 100000000} /* 100ms */
247-
#endif /* RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD */
248-
249-
/******************************************************************************
250-
* Fast hearbeat period used by any reliable RTPS Writer to allow
251-
* late joiners and out of sync readers to catch up.
252-
* This is an initializer for an instance of type DDS_Duration_t.
253-
******************************************************************************/
254-
#ifndef RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD_FAST
255-
#define RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD_FAST {0, 20000000} /* 20ms */
256-
#endif /* RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD_FAST */
257-
258-
/******************************************************************************
259-
* When a DataWriter receives a request for missing DDS samples from a
260-
* DataReader and responds by resending the requested DDS samples, it will
261-
* ignore additional requests for the same DDS samples during the time period
262-
* max_nack_response_delay. We decrease this to be less than the HB period.
263-
******************************************************************************/
264-
#ifndef RMW_CONNEXT_DEFAULT_MAX_NACK_RESPONSE_DELAY
265-
#define RMW_CONNEXT_DEFAULT_MAX_NACK_RESPONSE_DELAY {0, 10000000} /* 10ms */
266-
#endif /* RMW_CONNEXT_DEFAULT_MAX_NACK_RESPONSE_DELAY */
267-
268-
/******************************************************************************
269-
* Maximum number of periodic heartbeats gone unanswered after which a
270-
* DataWriter will consider a DataReader as inactive.
271-
*
272-
******************************************************************************/
273-
#ifndef RMW_CONNEXT_DEFAULT_MAX_HEARTBEATS
274-
#define RMW_CONNEXT_DEFAULT_MAX_HEARTBEATS (10 * 60) /* 1m @ 10hz */
275-
#endif /* RMW_CONNEXT_DEFAULT_MAX_HEARTBEATS */
276-
277-
/******************************************************************************
278-
* When a reliable reader receives a heartbeat from a remote writer and finds
279-
* out that it needs to send back an ACK/NACK message, the reader can choose to
280-
* delay a while. We set this delay to be compatible with the HB period.
281-
******************************************************************************/
282-
#ifndef RMW_CONNEXT_DEFAULT_MAX_HEARTBEAT_RESPONSE_DELAY
283-
#define RMW_CONNEXT_DEFAULT_MAX_HEARTBEAT_RESPONSE_DELAY {0, 10000000} /* 10ms */
284-
#endif /* RMW_CONNEXT_DEFAULT_MAX_HEARTBEAT_RESPONSE_DELAY */
285-
286241
/******************************************************************************
287242
* Automatically tune DataWriterQos to better handle reliable "large data".
288243
******************************************************************************/

rmw_connextdds_common/src/ndds/dds_api_ndds.cpp

+21-16
Original file line numberDiff line numberDiff line change
@@ -504,21 +504,26 @@ rmw_connextdds_get_datawriter_qos(
504504
#if RMW_CONNEXT_DEFAULT_RELIABILITY_OPTIMIZATIONS
505505
// The default settings for the RTPS reliability protocol are not very
506506
// responsive, and they cause some unit tests to fail. These optimizations
507-
// increase the Heartbeat period from 3s (default) to 100ms. Other vendors
508-
// seem to be in a similar range. We also lower the period for "late joiners"
509-
// and the "fast" period (used to speed up recovery of readers that reached
510-
// the "high watermark" of unacked samples -- 1 by default) to 20ms.
507+
// have been derived from profile `Optimization.ReliabilityProtocol.Common`
508+
// available in Connext 6+. `Generic.StrictReliable` is the equivalent
509+
// profile in 5.3.1. Changes are limited to `DDS_RtpsReliableWriterProtocol_t`.
511510
if (ctx->optimize_reliability) {
512-
qos->protocol.rtps_reliable_writer.heartbeat_period =
513-
RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD;
514-
qos->protocol.rtps_reliable_writer.late_joiner_heartbeat_period =
515-
RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD_FAST;
516-
qos->protocol.rtps_reliable_writer.fast_heartbeat_period =
517-
RMW_CONNEXT_DEFAULT_HEARTBEAT_PERIOD_FAST;
518-
qos->protocol.rtps_reliable_writer.max_heartbeat_retries =
519-
RMW_CONNEXT_DEFAULT_MAX_HEARTBEATS;
520-
qos->protocol.rtps_reliable_writer.max_nack_response_delay =
521-
RMW_CONNEXT_DEFAULT_MAX_NACK_RESPONSE_DELAY;
511+
// All write() calls will block (for at most max_blocking_time) once the send_window
512+
// is filled with samples that haven't yet been acknowledged by all active readers.
513+
qos->protocol.rtps_reliable_writer.min_send_window_size = 40;
514+
qos->protocol.rtps_reliable_writer.max_send_window_size = 40; // fixed size window
515+
qos->protocol.rtps_reliable_writer.heartbeats_per_max_samples = 10; // 1 every 4
516+
qos->protocol.rtps_reliable_writer.heartbeat_period = {0, 200000000}; // 200ms
517+
qos->protocol.rtps_reliable_writer.late_joiner_heartbeat_period = {0, 20000000}; // 20ms
518+
qos->protocol.rtps_reliable_writer.fast_heartbeat_period = {0, 20000000}; // 20ms
519+
qos->protocol.rtps_reliable_writer.max_heartbeat_retries = 500; // 10s @ 50hz
520+
// Force the writer to reply immediately to ACKNACK's received from a writer.
521+
qos->protocol.rtps_reliable_writer.max_nack_response_delay = DDS_DURATION_ZERO;
522+
// When the number of unack'd samples reaches the high_watermark the fast_heartbeat_period
523+
// is used. When the number dips below the low_watermark, the heartbeat_period is used.
524+
// These numbers are tied to the send_window size.
525+
qos->protocol.rtps_reliable_writer.high_watermark = 25;
526+
qos->protocol.rtps_reliable_writer.low_watermark = 10;
522527
}
523528
#endif /* RMW_CONNEXT_DEFAULT_RELIABILITY_OPTIMIZATIONS */
524529

@@ -612,10 +617,10 @@ rmw_connextdds_get_datareader_qos(
612617
// The default settings for the RTPS reliability protocol are not very
613618
// responsive, and they cause some unit tests to fail. These optimizations
614619
// are dual to those applied in rmw_connextdds_get_datawriter_qos().
620+
// Changes are limited to `DDS_RtpsReliableReaderProtocol_t`.
615621
if (ctx->optimize_reliability) {
616622
qos->protocol.rtps_reliable_reader.min_heartbeat_response_delay = DDS_DURATION_ZERO;
617-
qos->protocol.rtps_reliable_reader.max_heartbeat_response_delay =
618-
RMW_CONNEXT_DEFAULT_MAX_HEARTBEAT_RESPONSE_DELAY;
623+
qos->protocol.rtps_reliable_reader.max_heartbeat_response_delay = DDS_DURATION_ZERO;
619624
}
620625
#endif /* RMW_CONNEXT_DEFAULT_RELIABILITY_OPTIMIZATIONS */
621626

0 commit comments

Comments
 (0)