Search code examples
distributed-systemfifo

Is this FIFO Ordering or Causal Ordering?


I'm trying to understand an exercise about message ordering and where I need to know if the messages sent from a frontend to the Replica Manager are using FIFO ordering or Causal ordering. I've read a lot of posts on this subject, but I can't seem to find the right answer.

This is the exercise we have 2 FE and each sends 3 messages (mx) where x is the order of the messages: Exercise

From what I understand, since FIFO ordering focuses on a frontend each time, the messages received by the RM (m2, m3, m4, m1, m5, m7) are focused on each FE, so the answer should be Yes, it is using FIFO ordering. But if this is right, what would be the correct order of the received packets to use Causal ordering?

Thank you


Solution

  • Generally speaking, Causal is a subset of FIFO. For example, if one client sends causally related messages (X and Y - X happened before Y) and the other client sends (W and Z - W happened before Z) then in causal ordered stream the only to invariants are that X comes before Y and W before Z; all other messages can come in any order; eg. XWYZ or XYWZ and so on.

    Getting back to your picture:

    Who defines the order X? When two customers send messages (m1,m5,m7) and (m2,m3,m4) - it is hard to say what is the relation between these two groups. Could it be that client one sends all messages first (m2,m3,m4) and then the other client sends (m1,m5,m7)? This eliminates FIFO option as a relationship in between messages in different groups.

    So the only thing we can conclude, is that the order of messages is set when each customer sends events, which will make it a FIFO order of every customer and causal order for the combined stream.