Idempotence and Race Conditions

From Izara Wiki
Revision as of 14:51, 19 June 2022 by Sven the Barbarian (talk | contribs) (Created page with "= Overview = When receiving messages in an distributed serverless system a single action might be called multiple times, eg: # If Lambda halts part way through execution it w...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

When receiving messages in an distributed serverless system a single action might be called multiple times, eg:

  1. If Lambda halts part way through execution it will retry
  2. SQS guarantees at least once delivery, meaning it might deliver a message multiple times
  3. Two requests from different sources might trigger the same function, but we only want to process one request
  4. I single source might send the same request multiple times, eg if a Lambda halts and is retried

Some of the solutions to idempotence can also be used to check for race conditions (eg storing timestamps).

Race conditions in a serverless system can include

  1. Two functions running at the same time making adjustments to the same data that overwrite each other
  2. Messages received out of the order they were sent