|
| 1 | +.. include:: ../../../03-exports/aliases.include |
| 2 | +.. include:: ../../../03-exports/aliases-api.include |
| 3 | + |
| 4 | +.. _use-case-large-data-options: |
| 5 | + |
| 6 | +Large Data with configuration options |
| 7 | +===================================== |
| 8 | + |
| 9 | +As it has been observed in :ref:`use-case-tcp-multicast`, ``LARGE_DATA`` builtin transports option offers an easy |
| 10 | +and efficient way to improve performance when working with large data. |
| 11 | +Nonetheless, custom configuration can help to enhance the performance even further. |
| 12 | + |
| 13 | +Fast DDS provides configuration options to adjust the behavior of the builtin transports. |
| 14 | +This becomes particularly relevant when using the ``LARGE_DATA`` mode, as it enables increasing the maximum message |
| 15 | +size beyond 65500 KB and prevents fragmentation, leveraging the TCP and SHM transports. |
| 16 | + |
| 17 | +All builtin transports can be configured by adjusting the following parameters: |
| 18 | + |
| 19 | ++ ``max_msg_size``: Message maximum size that can be sent over the transport. |
| 20 | + Sending messages larger than this size will result in fragmentation. |
| 21 | + Its maximum value is (2^32)-1 B for TCP and SHM and 65500 KB for UDP. |
| 22 | ++ ``sockets_size``: Size of the send and receive socket buffers. |
| 23 | + This value must be higher or equal than the ``max_msg_size`` to obtain a valid configuration. |
| 24 | + Its maximum value is (2^32)-1 B. |
| 25 | ++ ``non_blocking``: If set to true, the transport will use non-blocking sockets. |
| 26 | + This can be useful to avoid blocking the application if the socket buffers are full. |
| 27 | + However, some messages will be lost. Its default value is false. |
| 28 | ++ ``tcp_negotiation_timeout``: It specifies the timeout duration for logical port negotiation. |
| 29 | + This parameter is useful for ensuring the availability of the logical port before data transmission, |
| 30 | + thus preventing message loss during the negotiation process. |
| 31 | + Conversely, it can delay the discovery process. |
| 32 | + The default value is 0, implying that discovery will occur as soon as possible, but the initial messages |
| 33 | + might be lost if reliability is set to |BEST_EFFORT_RELIABILITY_QOS-api|. |
| 34 | + This parameter is only valid for the ``LARGE_DATA`` mode. |
| 35 | + |
| 36 | +Adjusting the maximum message size and the socket buffer sizes to a large enough value to accommodate the data to be |
| 37 | +sent can help improve the performance with large messages, as well as setting the transport to non-blocking mode. |
| 38 | + |
| 39 | +In this way, it is possible to take advantage of the TCP transport to avoid fragmentation and use the non-blocking |
| 40 | +mode to avoid blocking the application when the socket buffers are full. |
| 41 | +This configuration can be used, for example, when streaming video, which will result in a significant increase |
| 42 | +in fluidity. |
| 43 | + |
| 44 | +Note that even when using the ``LARGE_DATA`` mode within the same machine, the configuration options |
| 45 | +can prove useful for improving performance, as they affect the SHM transport. |
| 46 | +It is highly recommended to set a shared memory segment size large enough to accommodate the data to be sent. |
| 47 | +To achieve this, the ``sockets_size`` parameter must be set to a value at least half of the message size. |
| 48 | + |
| 49 | +The following snippets show how to configure the ``LARGE_DATA`` mode: |
| 50 | + |
| 51 | +.. tabs:: |
| 52 | + |
| 53 | + .. tab:: Environment Variable |
| 54 | + |
| 55 | + .. code-block:: bash |
| 56 | +
|
| 57 | + export FASTDDS_BUILTIN_TRANSPORTS=LARGE_DATA?max_msg_size=1MB&sockets_size=1MB&non_blocking=true&tcp_negotiation_timeout=50 |
| 58 | +
|
| 59 | + .. tab:: XML |
| 60 | + |
| 61 | + .. literalinclude:: /../code/XMLTester.xml |
| 62 | + :language: xml |
| 63 | + :start-after: <!-->LARGE_DATA_BUILTIN_TRANSPORTS_OPTIONS<--> |
| 64 | + :end-before: <!--><--> |
| 65 | + :lines: 2-4, 6-10, 12-13 |
| 66 | + |
| 67 | + .. tab:: C++ |
| 68 | + |
| 69 | + .. literalinclude:: ../../../../code/DDSCodeTester.cpp |
| 70 | + :language: c++ |
| 71 | + :dedent: 8 |
| 72 | + :start-after: //LARGE_DATA_BUILTIN_TRANSPORTS_OPTIONS |
| 73 | + :end-before: //! |
| 74 | + |
| 75 | +.. note:: |
| 76 | + |
| 77 | + To learn how to check and modify the default maximum system value for the socket buffers size, please refer to |
| 78 | + :ref:`finding-out-maximum-socket-values`. |
| 79 | + |
| 80 | +.. warning:: |
| 81 | + |
| 82 | + Setting a ``max_msg_size`` value higher than 65500 KB with the ``DEFAULT`` or ``UDP`` modes will result in an error |
| 83 | + and the participant creation will fail. |
| 84 | + |
0 commit comments