Skip to content

Commit dd317a7

Browse files
New max_message_size property to limit output datagrams size (#770) (#775)
* Refs #20849: Add max_message_size property policy docs Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs 20849: Apply suggestions Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #20849: Apply suggestions Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --------- Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> (cherry picked from commit 91d96b8) # Conflicts: # code/DDSCodeTester.cpp # docs/fastdds/property_policies/non_consolidated_qos.rst Co-authored-by: elianalf <62831776+elianalf@users.noreply.github.com>
1 parent c543809 commit dd317a7

3 files changed

Lines changed: 137 additions & 0 deletions

File tree

code/DDSCodeTester.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,28 @@ void dds_domain_examples()
890890
"fastdds.tcp_transport.non_blocking_send",
891891
"true");
892892
//!--
893+
}
894+
895+
{
896+
// MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT
897+
DomainParticipantQos pqos;
898+
899+
// Set maximum number of bytes of the datagram to be sent
900+
pqos.properties().properties().emplace_back(
901+
"fastdds.max_message_size",
902+
"1200");
903+
//!--
904+
}
905+
906+
{
907+
// MAX_MESSAGE_SIZE_PROPERTY_WRITER
908+
DataWriterQos wqos;
909+
910+
// Set maximum number of bytes of the datagram to be sent
911+
wqos.properties().properties().emplace_back(
912+
"fastdds.max_message_size",
913+
"1200");
914+
//!--
893915
}
894916
}
895917

code/XMLTester.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3110,6 +3110,42 @@
31103110
-->
31113111
<!--><-->
31123112

3113+
<!-->MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT<-->
3114+
<!--
3115+
<?xml version="1.0" encoding="UTF-8" ?>
3116+
-->
3117+
<participant profile_name="max_message_size_participant_xml_profile">
3118+
<rtps>
3119+
<propertiesPolicy>
3120+
<properties>
3121+
<!-- Set the maximum size in bytes for all RTPS datagrams sent by the participant -->
3122+
<property>
3123+
<name>fastdds.max_message_size</name>
3124+
<value>1200</value>
3125+
</property>
3126+
</properties>
3127+
</propertiesPolicy>
3128+
</rtps>
3129+
</participant>
3130+
<!--><-->
3131+
3132+
<!-->MAX_MESSAGE_SIZE_PROPERTY_WRITER<-->
3133+
<!--
3134+
<?xml version="1.0" encoding="UTF-8" ?>
3135+
-->
3136+
<data_writer profile_name="max_msg_size_datawriter_xml_profile">
3137+
<propertiesPolicy>
3138+
<properties>
3139+
<!-- Set the maximum size in bytes for all RTPS datagrams sent by the writer -->
3140+
<property>
3141+
<name>fastdds.max_message_size</name>
3142+
<value>1200</value>
3143+
</property>
3144+
</properties>
3145+
</propertiesPolicy>
3146+
</data_writer>
3147+
<!--><-->
3148+
31133149
<!-->FASTDDS_STATISTICS_MODULE<-->
31143150
<participant profile_name="statistics_domainparticipant_conf_xml_profile">
31153151
<rtps>

docs/fastdds/property_policies/non_consolidated_qos.rst

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,82 @@ packet.
395395
:language: xml
396396
:start-after: <!-->XML-TCP-NON-BLOCKING-SEND
397397
:end-before: <!--><-->
398+
399+
.. _property_max_message_size:
400+
401+
Maximum Message Size
402+
^^^^^^^^^^^^^^^^^^^^
403+
404+
One common requirement is the differentiation between the maximum size of received and sent datagrams.
405+
This capability is especially important in scenarios where a system might need to handle large incoming
406+
data sizes but should restrict the size of the data it sends to prevent overwhelming network resources
407+
or complying with network traffic policies.
408+
The primary attribute for controlling datagram size is `maxMessageSize`, which sets the upper limit
409+
for both the size of datagrams that can be received and those that can be sent.
410+
Property ``fastdds.max_message_size`` allows restricting the size of outgoing datagrams without
411+
changing the size of incoming ones.
412+
This property allows for the specific configuration of the maximum number of bytes for datagrams that
413+
are sent.
414+
By configuring this property to a value lower than the smallest `maxMessageSize` across all transports,
415+
applications can achieve a lower sending limit while maintaining the ability to receive larger datagrams.
416+
417+
.. list-table::
418+
:header-rows: 1
419+
:align: left
420+
421+
* - PropertyPolicyQos name
422+
- PropertyPolicyQos value
423+
- Default value
424+
* - ``"fastdds.max_message_size"``
425+
- ``uint32_t``
426+
- ``"4294967295"``
427+
428+
.. note::
429+
An invalid value of ``fastdds.max_message_size`` would log an error,
430+
and the default value will be used.
431+
432+
.. _setting_max_message_size_participant:
433+
434+
Setting ``fastdds.max_message_size`` At Participant Level
435+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
436+
437+
.. tabs::
438+
439+
.. tab:: C++
440+
441+
.. literalinclude:: /../code/DDSCodeTester.cpp
442+
:language: c++
443+
:start-after: // MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT
444+
:end-before: //!--
445+
:dedent: 6
446+
447+
.. tab:: XML
448+
449+
.. literalinclude:: /../code/XMLTester.xml
450+
:language: xml
451+
:start-after: <!-->MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT<-->
452+
:end-before: <!--><-->
453+
:lines: 2,4-16
454+
455+
.. _setting_max_message_size_writer:
456+
457+
Setting ``fastdds.max_message_size`` At Writer Level
458+
""""""""""""""""""""""""""""""""""""""""""""""""""""
459+
460+
.. tabs::
461+
462+
.. tab:: C++
463+
464+
.. literalinclude:: /../code/DDSCodeTester.cpp
465+
:language: c++
466+
:start-after: // MAX_MESSAGE_SIZE_PROPERTY_WRITER
467+
:end-before: //!--
468+
:dedent: 6
469+
470+
.. tab:: XML
471+
472+
.. literalinclude:: /../code/XMLTester.xml
473+
:language: xml
474+
:start-after: <!-->MAX_MESSAGE_SIZE_PROPERTY_WRITER<-->
475+
:end-before: <!--><-->
476+
:lines: 2,4-14

0 commit comments

Comments
 (0)