2 min read

Word of the Day — Idempotency

A quick primer on idempotency: what this property of operations is, why it matters for system reliability, and where it shows up — from HTTP methods to databases and blockchain.

Word of the Day — Idempotency

Morning! How often do you run into this term? My guess is not much — outside of college, anyway). But when we caught a bug in Tarantool's basic CRUD module, idempotency came up more than once: for every operation we had to prove whether it was idempotent or not. Here's a short primer — hope it comes in handy.

Idempotency is a property of an operation where calling it again doesn't change the object's state compared to the first call. Run it once, run it ten times — same result. Sounds academic, but this is exactly what reliability and safety rest on across a lot of IT.

Origin and use

The term came from mathematics and took root in IT: programming, system administration, testing, data analysis — each has its own use for it.

Use for SAs, testers, developers, and DevOps

  • SA — when designing systems, especially distributed ones, where several operations hit the same data.
  • Tester — to make sure a rerun doesn't spring surprises: is it a bug or a feature))
  • Developer — for data integrity: so a retry doesn't break state.
  • DevOps — so a re-run of a playbook doesn't spawn extra changes (this is what all of Ansible stands on).

And so on — I won't ramble, I did promise a short piece.

Use in databases

In relational databases it's enforced by unique keys and ACID transactions. In NoSQL and caches like Redis — by commands that yield the same result on a repeated write: the same SET overwrites the value instead of multiplying duplicates.

Examples of technical implementations

  • Web services lean on idempotent HTTP methods: GET and PUT return one result no matter how many times you repeat the request.
  • In distributed systems, a unique request identifier (say, a UUID) helps process it exactly once — even if the client fired it off five times in a row.
  • In blockchain, the immutability of blocks is a kind of idempotency too: once data is added to the chain, it doesn't change anymore.

Takeaway

Idempotency is the foundation of reliable systems. It guarantees that repeating an operation won't break anything and that state stays predictable. That's why it's loved everywhere — from development to administration: fewer surprises, fewer late-night incidents.


Originally published on my Telegram channel @it_underside.

Yours, DPUPP

Related Articles