Warning: This is a development version. The latest stable version is Version 7.0.0.

Variable Payload Sizes

Rely supports encoding and decoding payloads of variable sizes. This feature has two explicit goals:

  1. Minimize overhead of encoding payloads with different sizes.
  2. Support a custom MTU (Maximum Transfer Unit), i.e., never produce packets larger than the specified value. This is controlled via the max_packet_bytes parameter in rely::encoder::configure() and rely::decoder::configure(). This may involve fragmenting payloads.

Note

In many cases there will be a one-to-one relationship between payloads and source symbols. However, if the size of a payload is larger than what can be contained in a packet (based on max_packet_bytes), the payload will be fragmented into multiple source symbols.

In the following we will explain what this means exactly and this is handled in the encoder and decoder.

Minimizing Overhead

In order to minimize overhead Rely uses two techniques:

  1. All source symbols are sent as-is without zero padding (note that the Rely header is always appended).
  2. All repair symbols will have the size of the largest source symbol in the in the associated coding window.

The following figure illustrates this approach:

../_images/minimize_overhead.svg

In the above source symbol s1, s2, s3 and s4 are sent as is, whereas the repair symbol Σs will have the size of the largest source symbol in the coding window (in this the size of s3, 9).

As the coding window moves old source symbols are dropped and new ones may be added. In this case the size of the repair symbols will increase and decrease accordingly.

Support for Custom MTU

In order to avoid exceeding the MTU of on a given network Rely will fragment payloads such that packets produced by the Rely encoder will be smaller than or equal to the max_packet_bytes configuration value.

This allows support for applications that generate payloads larger than the network MTU, but also provides space for the Rely header in situations where the incoming payloads already match the network MTU.

Note

Any fragmentation performed by the Rely encoder will be undone by the Rely decoder before forwarding the decoded payload.