Thursday, December 24, 2020

Isolation & Locks

The CAP theorem states that two out three of Consistency, Availability & Partition Tolerance may be achieved.

RDBMS systems allow for ACID: Atomicity (support for all or non transactions), Consistency (Referential integrity handled by local dbs), Isolation (concurrent/sequential won't matter) & Durability (handled by local dbs).

Issues without Isolation:

  • Lost updates (Update without realizing a prior update)
  • Dirty reads (reading before a prior operation has fully succeeded)
  • Nonrepeatable/fuzzy reads (Subsequent reads in the same operation returns different data)
Locking strategies:
  • Semantic lock: app level lock
  • Commutative updates: Update executable in any order
  • Pessimistic lock/view: Reorder steps
  • Reread value: Avoid dirty writes by reading data prior to write
  • Version file: Record updates
  • By value: Each request chooses concurrency mechanism as required

Source: Microservices Patterns by Chris Richardson

No comments:

Post a Comment

Why is Go fast?

Why is Go fast? Go has become popular for microprocesses & for scaling. What are the design decisions that make Go fast? Summary: 1. Cle...