Disciplined Inconsistency with Consistency Types

Brandon Holt, James Bornholt, Irene Zhang, Dan Ports, Mark Oskin, Luis Ceze
2016 Proceedings of the Seventh ACM Symposium on Cloud Computing - SoCC '16  
Distributed applications and web services, such as online stores or social networks, are expected to be scalable, available, responsive, and fault-tolerant. To meet these steep requirements in the face of high round-trip latencies, network partitions, server failures, and load spikes, applications use eventually consistent datastores that allow them to weaken the consistency of some data. However, making this transition is highly error-prone because relaxed consistency models are notoriously
more » ... ficult to understand and test. In this work, we propose a new programming model for distributed data that makes consistency properties explicit and uses a type system to enforce consistency safety. With the Inconsistent, Performance-bound, Approximate (IPA) storage system, programmers specify performance targets and correctness requirements as constraints on persistent data structures and handle uncertainty about the result of datastore reads using new consistency types. We implement a prototype of this model in Scala on top of an existing datastore, Cassandra, and use it to make performance/correctness tradeoffs in two applications: a ticket sales service and a Twitter clone. Our evaluation shows that IPA prevents consistencybased programming errors and adapts consistency automatically in response to changing network conditions, performing comparably to weak consistency and 2-10× faster than strong consistency. Showings Grand Theater Star Wars 7pm Remaining: STAR WARS 7pm 5 Purchase Star Wars 9pm Spectre 6:30pm // adjust price based on number of tickets left def computePrice(ticketsRemaining: Int): Float // called from purchaseTicket & displayEvent def getTicketCount(event: UUID): Int = // use weak consistency for performance readWeak(event+"ticket_count") def purchaseTicket(event: UUID) = { val ticket = reserveTicket(event) val remaining = getTicketCount(event) // compute price based on inconsistent read val price = computePrice(remaining) display("Enter payment info. Price: ", price) } STAR WARS 7pm Enter payment info. Price: $15 ADT / Method Consistency(Strong) Consistency(Weak) LatencyBound(_) ErrorTolerance(_) Counter.read() Consistent[Int] Inconsistent[Int] Rushed[Int] Interval[Int] Set.size() Consistent[Int] Inconsistent[Int] Rushed[Int] Interval[Int] Set.contains(x) Consistent[Bool] Inconsistent[Bool] Rushed[Bool] N/A List[T].range(x,y) Consistent[List[T]] Inconsistent[List[T]] Rushed[List[T]] N/A UUIDPool.take() Consistent[UUID] Inconsistent[UUID] Rushed[UUID] N/A UUIDPool.remain() Consistent[Int] Inconsistent[Int] Rushed[Int] Interval[Int]
doi:10.1145/2987550.2987559 dblp:conf/cloud/HoltBZPOC16 fatcat:sletb5wfazeqzhfjtpfnpkbtru