Inspirel banner

Programming Distributed Systems with YAMI4

1.2 Frame Format

In order to support message priorities, the sequence of bytes to be sent is divided into units called frames.

Each frame contains a short header that identifies its place in the complete message and the message itself. After the frame header, the message header and message body are placed in their serialized form, as described in the previous section.

Frames do not have to be of the same size and the last frame of any given message is usually shorter than earlier frames (frames are not padded).

As a special case, a single frame might be enough to contain the whole message - this is usually true for short messages, when the frame header, the serialized message header and serialized message body are together shorter than the recommended frame size for the given communication channel.

Each frame contains the following information:

Frame payloads together (when conceptually concatenated) contain serialized message header and message body - the cut point is defined by the message header size from the first frame header.

An important properties of this protocol are that:


At the wire level there is no distinction between messages and their replies - everything is just a message and its interpretation or association with other messages is up to the program that can use message header to convey appropriate meta-information. This is actually done by the general-purpose library.


It is not a problem if the message identifiers are reused by the sender, as long as the receiver can ``close'' the previous messages before their identifiers are reused - with 32 bits for the identifier the possibility to wrap around is not a practical problem.