Inspirel banner

Programming Distributed Systems with YAMI4

8.2 Message Ordering

The subject of message ordering is of particular importance in many systems and the complete understanding of what factors can influence the ordering of messages is necessary for proper system design at the high level.

A simple client-server system where the client sends a single message and waits for server response (note that the calculator example belongs to this category) need not be concerned with message ordering issues - at any given point in time there is at most one outgoing message being handled by the agent, so the ordering is obvious. Things become more complicated when there are many messages being processed at the same time.

The following are important facts that influence the ordering of messages:

Taking into account the above factors, the following conditions can be used to define the ordering guarantees for messages in YAMI4:

If all conditions above are met, then the sender and the receiver will see messages in the same order. Any form of concurrency or processing or transport parallelism can introduce hazards that might make the relative message ordering impossible to predict. In particular, multithreading on any side or the use of several communication paths can introduce opportunities for the messages to lose their original or intended ordering.