Skip to content

Commit e284e8b

Browse files
New max_message_size property to limit output datagrams size (#770) (#774)
* 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 Co-authored-by: elianalf <62831776+elianalf@users.noreply.github.com>
1 parent 9798307 commit e284e8b

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
@@ -883,6 +883,28 @@ void dds_domain_examples()
883883
"unicast");
884884
//!--
885885
}
886+
887+
{
888+
// MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT
889+
DomainParticipantQos pqos;
890+
891+
// Set maximum number of bytes of the datagram to be sent
892+
pqos.properties().properties().emplace_back(
893+
"fastdds.max_message_size",
894+
"1200");
895+
//!--
896+
}
897+
898+
{
899+
// MAX_MESSAGE_SIZE_PROPERTY_WRITER
900+
DataWriterQos wqos;
901+
902+
// Set maximum number of bytes of the datagram to be sent
903+
wqos.properties().properties().emplace_back(
904+
"fastdds.max_message_size",
905+
"1200");
906+
//!--
907+
}
886908
}
887909

888910
//DOMAINPARTICIPANTLISTENER-DISCOVERY-CALLBACKS

code/XMLTester.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3229,6 +3229,42 @@
32293229
-->
32303230
<!--><-->
32313231

3232+
<!-->MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT<-->
3233+
<!--
3234+
<?xml version="1.0" encoding="UTF-8" ?>
3235+
-->
3236+
<participant profile_name="max_message_size_participant_xml_profile">
3237+
<rtps>
3238+
<propertiesPolicy>
3239+
<properties>
3240+
<!-- Set the maximum size in bytes for all RTPS datagrams sent by the participant -->
3241+
<property>
3242+
<name>fastdds.max_message_size</name>
3243+
<value>1200</value>
3244+
</property>
3245+
</properties>
3246+
</propertiesPolicy>
3247+
</rtps>
3248+
</participant>
3249+
<!--><-->
3250+
3251+
<!-->MAX_MESSAGE_SIZE_PROPERTY_WRITER<-->
3252+
<!--
3253+
<?xml version="1.0" encoding="UTF-8" ?>
3254+
-->
3255+
<data_writer profile_name="max_msg_size_datawriter_xml_profile">
3256+
<propertiesPolicy>
3257+
<properties>
3258+
<!-- Set the maximum size in bytes for all RTPS datagrams sent by the writer -->
3259+
<property>
3260+
<name>fastdds.max_message_size</name>
3261+
<value>1200</value>
3262+
</property>
3263+
</properties>
3264+
</propertiesPolicy>
3265+
</data_writer>
3266+
<!--><-->
3267+
32323268
<!-->FASTDDS_STATISTICS_MODULE<-->
32333269
<participant profile_name="statistics_domainparticipant_conf_xml_profile">
32343270
<rtps>

docs/fastdds/property_policies/non_consolidated_qos.rst

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,82 @@ The behavior regarding this can be configured using the property ``fastdds.shm.e
351351
:language: xml
352352
:start-after: <!-->XML-SHM-ENFORCE-META-TRAFFIC
353353
:end-before: <!--><-->
354+
355+
.. _property_max_message_size:
356+
357+
Maximum Message Size
358+
^^^^^^^^^^^^^^^^^^^^
359+
360+
One common requirement is the differentiation between the maximum size of received and sent datagrams.
361+
This capability is especially important in scenarios where a system might need to handle large incoming
362+
data sizes but should restrict the size of the data it sends to prevent overwhelming network resources
363+
or complying with network traffic policies.
364+
The primary attribute for controlling datagram size is `maxMessageSize`, which sets the upper limit
365+
for both the size of datagrams that can be received and those that can be sent.
366+
Property ``fastdds.max_message_size`` allows restricting the size of outgoing datagrams without
367+
changing the size of incoming ones.
368+
This property allows for the specific configuration of the maximum number of bytes for datagrams that
369+
are sent.
370+
By configuring this property to a value lower than the smallest `maxMessageSize` across all transports,
371+
applications can achieve a lower sending limit while maintaining the ability to receive larger datagrams.
372+
373+
.. list-table::
374+
:header-rows: 1
375+
:align: left
376+
377+
* - PropertyPolicyQos name
378+
- PropertyPolicyQos value
379+
- Default value
380+
* - ``"fastdds.max_message_size"``
381+
- ``uint32_t``
382+
- ``"4294967295"``
383+
384+
.. note::
385+
An invalid value of ``fastdds.max_message_size`` would log an error,
386+
and the default value will be used.
387+
388+
.. _setting_max_message_size_participant:
389+
390+
Setting ``fastdds.max_message_size`` At Participant Level
391+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
392+
393+
.. tabs::
394+
395+
.. tab:: C++
396+
397+
.. literalinclude:: /../code/DDSCodeTester.cpp
398+
:language: c++
399+
:start-after: // MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT
400+
:end-before: //!--
401+
:dedent: 6
402+
403+
.. tab:: XML
404+
405+
.. literalinclude:: /../code/XMLTester.xml
406+
:language: xml
407+
:start-after: <!-->MAX_MESSAGE_SIZE_PROPERTY_PARTICIPANT<-->
408+
:end-before: <!--><-->
409+
:lines: 2,4-16
410+
411+
.. _setting_max_message_size_writer:
412+
413+
Setting ``fastdds.max_message_size`` At Writer Level
414+
""""""""""""""""""""""""""""""""""""""""""""""""""""
415+
416+
.. tabs::
417+
418+
.. tab:: C++
419+
420+
.. literalinclude:: /../code/DDSCodeTester.cpp
421+
:language: c++
422+
:start-after: // MAX_MESSAGE_SIZE_PROPERTY_WRITER
423+
:end-before: //!--
424+
:dedent: 6
425+
426+
.. tab:: XML
427+
428+
.. literalinclude:: /../code/XMLTester.xml
429+
:language: xml
430+
:start-after: <!-->MAX_MESSAGE_SIZE_PROPERTY_WRITER<-->
431+
:end-before: <!--><-->
432+
:lines: 2,4-14

0 commit comments

Comments
 (0)