Consistency models بیان کرتے ہیں کہ ڈیٹا کی تبدیلیاں کب اور کیسے ایک تقسیم شدہ نظام میں نظر آتی ہیں — strong consistency سے لے کر (ہر ایک فوری طور پر تازہ ترین ڈیٹا دیکھتا ہے) eventual consistency تک (تبدیلیاں وقت کے ساتھ پھیلتی ہیں)۔ یہ انتخاب دستیاب ہونے اور کارکردگی کے ساتھ موازنہ میں آتا ہے۔
Strong vs eventual consistency
STRONG CONSISTENCY → every read returns the MOST RECENT write (all nodes agree immediately):
✓ simple to reason about; always correct/current data
✗ requires coordination → higher latency, lower availability (especially during partitions)
→ for: data that must be correct/current (financial balances, inventory, bookings)
EVENTUAL CONSISTENCY → updates propagate over time; reads MAY return stale data briefly,
but all nodes CONVERGE eventually:
✓ high availability, low latency, scalable
✗ reads can be stale temporarily (must tolerate this)
→ for: data where brief staleness is OK (social feeds, likes, view counts, caches)
