granola low overhead distributed transac9on coordina9on
play

Granola: LowOverhead Distributed Transac9on Coordina9on James - PowerPoint PPT Presentation

Granola: LowOverhead Distributed Transac9on Coordina9on James Cowling and Barbara Liskov MIT CSAIL Granola An infrastructure for building distributed storage applica<ons. A distributed transac9on coordina9on protocol, that provides strong


  1. Granola: Low‐Overhead Distributed Transac9on Coordina9on James Cowling and Barbara Liskov MIT CSAIL

  2. Granola An infrastructure for building distributed storage applica<ons. A distributed transac9on coordina9on protocol, that provides strong consistency without locking .

  3. Distributed Storage … Repository 1 Repository 2 Repository 3 … Client 1 Client 2

  4. Why Transac9ons? Atomic opera9ons allow users and developers to ignore concurrency Distributed atomic opera<ons allow data to span mul9ple repositories avoids inconsistency between repositories

  5. Distributed transac9ons are hard Tension between consistency and performance

  6. Op9ng for Consistency Two‐phase commit with strict two‐ phase locking Distributed databases, Sinfonia, etc.

  7. Op9ng for Consistency Two‐phase commit with strict two‐ phase locking High transac9on cost: mul<ple Distributed databases, Sinfonia, etc. message delays, forced log writes, locking/logging overhead (≈30‐40%*) * OLTP through the looking glass, and what we found there Harizopoulos et al, SIGMOD ‘08

  8. Op9ng for Performance No distributed transac<ons SimpleDB, Bigtable, CRAQ, etc. Weak consistency models Dynamo, Cassandra, MongoDB, Hbase, PNUTS, etc.

  9. Op9ng for Performance No distributed transac<ons SimpleDB, Bigtable, CRAQ, etc. Place the burden of consistency on the applica9on developer Weak consistency models Dynamo, Cassandra, MongoDB, Hbase, PNUTS, etc.

  10. Where we come in… Strong Consistency and High Performance (for a large class of transac<ons)

  11. Introduce a new transac9on class which lets us provide consistency without locking

  12. M OTIVATION T RANSACTION M ODEL P ROTOCOL E VALUATION

  13. One‐Round Transac9ons Expressed in one round of communica9on between clients and repositories Execute to comple9on at each par<cipant

  14. General Opera9ons Transac<ons are uninterpreted by Granola, and can execute arbitrary opera9ons

  15. Transac9on Classes Single‐Repository execute en<rely on one repository Distributed Transac<ons Coordinated • Independent •

  16. Coordinated Transac9ons Commit only if all par<cipants vote to commit Example: • Transfer $50 between accounts

  17. Independent Transac9ons Transac<ons where all par<cipants will make the same commit/abort decision Examples: • Add 1% interest to each bank balance. • Compute total amount of money in the bank.

  18. Independent Transac9ons Evidence these are common in OLTP workloads • Any read‐only distributed transac<on • Transac<ons that always commit • Atomically update replicated data • Where commit decision is determinis9c func9on of shared state

  19. Example: TPC‐C TPC‐C benchmark can be expressed en<rely using single repository and independent transac9ons e.g., new_order transac<on only aborts if invalid item number can be computed locally if we replicate Item table

  20. M OTIVATION T RANSACTION M ODEL P ROTOCOL E VALUATION

  21. Repository Server Applica<on run result Granola Repository Library transac<on coordina<on Client Granola Client Library invoke result Client Applica<on

  22. Replica9on Primary Backup Implemented Repository as Backup

  23. Repository Modes Primarily in Timestamp Mode • Single‐repository, Independent Occasionally in Locking Mode • When coordinated transac<ons are required

  24. Timestamps Each transac<on is assigned a <mestamp Each repository executes transac<ons in 9mestamp order Timestamps define global serial order

  25. Key Ques9ons How do we assign <mestamps in a scalable , fault‐tolerant way? How do we make sure we always execute in 9mestamp order ?

  26. Single‐Repository Protocol Clients present the highest 9mestamp they have observed Repository chooses <mestamp higher than the client 9mestamp , any previous transac<on, and its clock value Repository executes in 9mestamp order , sends response and <mestamp to client

  27. Assign Choose <mestamp higher than <mestamp previous transac<ons Log Transac<on Run

  28. Assign Choose <mestamp higher than <mestamp previous transac<ons Run replica<on protocol to Log record <mestamp Transac<on Run

  29. Assign Choose <mestamp higher than <mestamp previous transac<ons Run replica<on protocol to Log record <mestamp Transac<on Execute in <mestamp order Run Send result and <mestamp to the client

  30. Independent Protocol Clients present highest <mestamp they observed Repository chooses proposed 9mestamp higher than clock value and previous transac<ons Repositories vote to determine highest 9mestamp Repository executes in <mestamp order, sends <mestamp to client

  31. Propose Choose proposed 9mestamp higher than <mestamp previous transac<ons Log Run replica<on protocol to Transac<on record proposed <mestamp Send proposed 9mestamp Vote to the other par9cipants Pick final Highest 9mestamp from among votes <mestamp Execute in <mestamp order Run Send result and final <mestamp to client

  32. Timestamp Constraint Won’t execute transac<on un<l it has the lowest 9mestamp of all concurrent transac<ons Guarantees a global serial execu9on order

  33. Example 1: Queue : Queue : History: History: Repository 1 Repository 2 Alice Bob

  34. Queue : Queue : History: History: Repository 1 Repository 2 T1 T1 Alice Bob

  35. Queue : Queue : T1 [prop. ts: 9 ] T1 [prop. ts: 3 ] History: History: Repository 1 Repository 2 T1 T1 Alice Bob

  36. Queue : Queue : T1 [prop. ts: 9] T1 [prop. ts: 3] History: History: Vote T1 [9] … Repository 1 Repository 2 Vote T1 [3] Alice Bob

  37. Queue : Queue : T1 [prop. ts: 3] History: History: T1 [final ts: 9] Vote T1 [9] … Repository 1 Repository 2 T1 [final ts: 9] Alice Bob

  38. Queue : Queue : T1 [prop. ts: 3] History: History: T1 [final ts: 9] Vote T1 [9] … Repository 1 Repository 2 T2 Alice Bob

  39. Queue : Queue : T1 [prop. ts: 3], T2 [ts: 5 ] History: History: T1 [final ts: 9] Vote T1 [9] … Repository 1 Repository 2 T2 Alice Bob

  40. Queue : Queue : T1 [prop. ts: 3], T2 [ts: 5] History: History: T1 [final ts: 9] Vote T1 [9] … Repository 1 Repository 2 Alice Bob

  41. Queue : Queue : T1 [prop. ts: 3], T2 [ts: 5] History: History: T1 [final ts: 9] Vote T1 [9] Repository 1 Repository 2 Alice Bob

  42. Queue : Queue : T2 [ts: 5], T1 [final ts: 9] History: History: T1 [final ts: 9] Vote T1 [9] Repository 1 Repository 2 Alice Bob

  43. Queue : Queue : T1 [final ts: 9] History: History: T2 [ts: 5] T1 [final ts: 9] Repository 1 Repository 2 T2 [ts: 5] Alice Bob

  44. Queue : Queue : History: History: T2 [ts: 5], T1 [final ts: 9] T1 [final ts: 9] Repository 1 Repository 2 T1 [final ts: 9] Alice Bob

  45. Queue : Queue : History: History: T2 [ts: 5], T1 [final ts: 9] T1 [final ts: 9] Repository 1 Repository 2 Global serial order: T2 ‐> T1 Alice Bob

  46. Choosing 9mestamps Client‐provided <mestamp guarantees transac<on will be serialized aYer any transac9on it observed

  47. Example 2: Queue : Queue : T1 [prop. ts: 3] History: History: T1 [final ts: 9] Vote T1 [9] … Repository 1 Repository 2 Alice Bob

  48. Queue : Queue : T1 [prop. ts: 3] History: History: T1 [final ts: 9] Vote T1 [9] … Repository 1 Repository 2 T2 Alice Bob

  49. Queue : Queue : T1 [prop. ts: 3] History: History: T1 [final ts: 9], T2 [ts: 10] Vote T1 [9] … Repository 1 Repository 2 T2 [ts: 10 ] Alice Bob

  50. Queue : Queue : T1 [prop. ts: 3] History: History: T1 [final ts: 9] , T2 [ts: 10] Vote T1 [9] … Repository 1 Repository 2 T3 [latest ts: 10] Alice Bob

  51. Queue : Queue : T1 [prop. ts: 3], T3 [ts: 11 ] History: History: T1 [final ts: 9] , T2 [ts: 10] Vote T1 [9] … Repository 1 Repository 2 T3 [latest ts: 10] Alice Bob

  52. Queue : Queue : T1 [final. ts: 9], T3 [ts: 11] History: History: T1 [final ts: 9] , T2 [ts: 10] Vote T1 [9] Repository 1 Repository 2 Alice Bob

  53. Queue : Queue : History: History: T1 [final ts: 9], T3 [ts: 11] T1 [final ts: 9] , T2 [ts: 10] Repository 1 Repository 2 Global serial order: T1 ‐> T2 ‐> T3 Alice Bob

  54. Where are we now? Timestamp‐based transac<on coordina<on • Interoperability with coordinated transac9ons • Recovery from failures

  55. Coordinated Transac9ons Applica<on determines commit/abort vote Requires locking to ensure vote isn’t invalidated

  56. Protocol changes Prepare phase applica<on acquires locks and determines vote Timestamp vo<ng Repository can commit transac<ons out of 9mestamp order

  57. Protocol changes Prepare phase where applica<on acquires locks and determines vote Timestamp Constraint: Timestamps s&ll match the serial order, even if execu<on happens out of <mestamp order Repository can commit transac<ons out of <mestamp order

  58. Locking Mode Locking Mode Timestamp Mode Repository 1 Repository 2 Repository 3 coordinated independent transac<on transac<on Client 1 Client 2

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend