Most early engineers (in some cases even seniors) get confused

Arpit Bhayani

Arpit Bhayani

Aug 29, 2024 • 1 min read


Most early engineers (in some cases even seniors) get confused with the word “consistency”, but remember, Consistency in ACID is different from Consistency in CAP, here’s a quick write-up to understand the difference.

ACID consistency is about the logical correctness of data within a single database and is enforced at transaction boundaries. CAP consistency is about the agreement of data across distributed nodes is about how real-time is the agreement across nodes.

So, ensuring that there are no blogs in the database whose author does not exist is ACID consistency; while ensuring that all the blogs are present across all the database nodes across all regions is CAP consistency.

You use NOT NULL, UNIQUE, and CHECK constraints to implement ACID consistency. On the other hand, you use replication, gossip, locks, and consensus protocols to achieve strong or eventual consistency across nodes.

So, given that the same word is used to describe both, it is important to understand the context in which the word is used.

⚡ I keep writing and sharing my practical experience and learnings every day, so if you resonate then follow along. I keep it no fluff.

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses