ld.← ALL FIELD NOTESSELECTED WORK ↗
FIELD NOTES / 20ORDERING & RETRIES   ·   DISTRIBUTED SYSTEMS

Ordering is more than the order a queue returns.

Processing a batch sequentially is not the same as guaranteeing the order of every event for a knowledge graph.

The batch boundary

Our graph-sync consumers use SQS Standard queues, which can deliver duplicate or out-of-order messages. We group records by knowledge graph ID and process each group sequentially inside a batch, while different groups can run concurrently.

That grouping alone does not coordinate concurrent Lambda invocations or repair out-of-order delivery. We also use per-graph coordination and make updates safe against retries and duplicate deliveries; the application must account for stale or out-of-order changes.

Failure changes what is safe

If one event fails, we stop processing the remaining events in that graph group and retry the failed and unprocessed work safely. Otherwise a later update could succeed before an earlier one is retried.

For merge operations that require strict per-graph ordering, we use SQS FIFO. Message groups preserve order within a group while allowing different graphs to make progress concurrently. Coordination and idempotency are important, but neither turns a Standard queue into a FIFO queue.

Continue the conversation

Further reading

KEEP READING / 19Why put a queue between SNS and Lambda?

Another note from the notebook.