high performance transactions via early write visibility
play

High Performance Transactions via Early Write Visibility Jose - PowerPoint PPT Presentation

High Performance Transactions via Early Write Visibility Jose Faleiro Daniel Abadi Joseph Hellerstein Serializability is our gold standard Developers focus on individual transaction correctness System ensures correctness under concurrency


  1. High Performance Transactions via Early Write Visibility Jose Faleiro Daniel Abadi Joseph Hellerstein

  2. Serializability is our gold standard Developers focus on individual transaction correctness System ensures correctness under concurrency Developers can focus on application logic

  3. Elephant in the room: Serializability is the exception Weak isolation is the norm

  4. Serializability in practice… is snapshot isolation is not the default

  5. Non-modular applications: changing anything changes everything

  6. Non-modular applications: changing anything changes everything Silent data corruption

  7. Non-modular applications: changing anything changes everything Silent data corruption Security bugs

  8. “The hacker discovered that if you place several withdrawals all in practically the same instant, they will get processed at more or less the same time. This will result in a negative balance, but valid insertions into the database… ’’

  9. (Second!) Elephant in the room: Very little progress towards addressing the gap

  10. The real hurdle is recoverability mechanism

  11. Recoverability + isolation Strong isolation mechanisms have limited mileage Due to: Recoverability mechanisms Isolation level specifications

  12. Recoverability + isolation Limitation is independent of isolation level implementation

  13. Recoverability + isolation Limitation is independent of isolation level implementation Includes all modern concurrency control protocols based on 2PL, OCC, MVCC, Timestamp ordering

  14. This talk State-of-the-art recoverability mechanisms fundamentally limit strong isolation levels New recoverability mechanism based on deterministic execution

  15. Recoverability Committed transactions must read committed data Required of popular isolation levels: Read committed, snapshot isolation, repeatable read, serializable

  16. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: Abort() item.count -= 1 bills.insert(cust_id, item_id, item.price) history.insert(cust_id, item_id)

  17. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl item = items_tbl[item_id item_id] if if item.count item.count == 0: == 0: Abort() Abort() item.count -= 1 bills.insert(cust_id, item_id, item.price) history.insert(cust_id, item_id)

  18. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: Abort() item.count item.count -= 1 = 1 bills.insert(cust_id, item_id, item.price) history.insert(cust_id, item_id)

  19. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: Abort() item.count -= 1 bills.insert bills.insert(cust_id cust_id, , item_id item_id, , item.price) item.price history.insert history.insert(cust_id cust_id, , item_id item_id)

  20. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: Abort()

  21. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: Abort() item.count -= 1

  22. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: Abort() Purchase(item_id, cust_id): item.count -= 1 item = items_tbl[item_id] if item.count == 0: Abort()

  23. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: Abort() Purchase(item_id, cust_id): item.count -= 1 item = items_tbl[item_id] if item.count == 0: Abort()

  24. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: Abort() Strawmen: item.count -= 1 Wait until commit Limited throughput bills.insert(cust_id, item_id, Expose writes immediately item.price) Cascaded rollbacks history.insert(cust_id, item_id)

  25. Recoverability Purchase(item_id, cust_id): mechanisms item = items_tbl[item_id] if item.count == 0: State-of-the-art: Group commit Abort() item.count -= 1 Wait until end of execution , not commit bills.insert(cust_id, Readers “share fate” with writers item_id, item.price) Durable write latency does not history.insert(cust_id, limit throughput item_id) Cascaded rollbacks restricted to failures

  26. State-of-the-art: Group commit

  27. Writes made visible at the Purchase(item_id, cust_id): item = items_tbl[item_id] end of txn’s execution if item.count == 0: Abort() item.count -= 1 bills.insert(cust_id, item_id, item.price) history.insert(cust_id, item_id)

  28. Purchase(item_id, cust_id): item = items_tbl[item_id] if item.count == 0: Abort() item.count -= 1 bills.insert(cust_id, item_id, item.price) Write visibility delay history.insert(cust_id, item_id)

  29. Serializability: Purchase(item_id, cust_id): Conflicting txns must wait item = items_tbl[item_id] if item.count == 0: Abort() Read Committed: Conflicting txns can read old values item.count -= 1 bills.insert(cust_id, item_id, item.price) Write visibility delay history.insert(cust_id, item_id)

  30. Serializable Purchase(item_id, cust_id): Purchase(item_id, cust_id): Purchase(item_id, cust_id): item = items_tbl[item_id] item = items_tbl[item_id] item = items_tbl[item_id] if item.count == 0: if item.count == 0: if item.count == 0: Abort() Abort() Abort() item.count -= 1 item.count -= 1 item.count -= 1 bills.insert(cust_id, bills.insert(cust_id, bills.insert(cust_id, item_id, item_id, item_id, item.price) item.price) item.price) history.insert(cust_id, history.insert(cust_id, history.insert(cust_id, item_id) item_id) item_id)

  31. Read committed Item Read Purchase(item_id, cust_id): Purchase(item_id, cust_id): Purchase(item_id, cust_id): item = items_tbl[item_id] item = items_tbl[item_id] item = items_tbl[item_id] if item.count == 0: if item.count == 0: if item.count == 0: Abort() Abort() Abort() item.count -= 1 item.count -= 1 item.count -= 1 bills.insert(cust_id, bills.insert(cust_id, bills.insert(cust_id, item_id, item_id, item_id, item.price) item.price) item.price) history.insert(cust_id, history.insert(cust_id, history.insert(cust_id, item_id) item_id) item_id)

  32. Impact of delayed write visibility

  33. Impact of delayed write visibility Workload: 10 read-modify-write txns 1 hot, 9 cold Vary position of hot update

  34. Impact of delayed write visibility Workload: 10 read-modify-write txns Cold update 1 hot, 9 cold Cold update Vary position of hot update . . . Cold update Cold update Hot update Hot update

  35. Impact of delayed write visibility Workload: 10 read-modify-write txns Cold update 1 hot, 9 cold Cold update Vary position of hot update . . . Cold update Cold update Write visibility delay: 0 Hot update Hot update

  36. Impact of delayed write visibility Workload: 10 read-modify-write txns Cold update 1 hot, 9 cold Cold update Vary position of hot update . . . Hot update Hot update Cold update Write visibility delay: 2 Cold update

  37. Impact of delayed write visibility Workload: 10 read-modify-write txns Hot Hot update update 1 hot, 9 cold Cold update Vary position of hot update Cold update . . . Write visibility delay: 9 Cold update Cold update

  38. Impact of delayed write visibility 400 K Read Committed Throughput (txns/sec) Serializable 300 K 200 K 100 K 0 K 0 1 2 3 4 5 6 7 8 9 Write visibility delay

  39. Impact of delayed write visibility 30% drop in Read committed vs 3x drop in Serializable

  40. Evolution of transaction processing Recoverability Concurrency control Metaphor credit: Bill Thies

  41. Evolution of transaction processing Recoverability Concurrency control Metaphor credit: Bill Thies

  42. Why delayed write visibility? Database systems have the flexibility to arbitrarily abort transactions

  43. Why delayed write visibility? Failures Deadlocks Abort statements Validation errors Constraint violations Resource constraints

  44. Why delayed write visibility? System induced State induced Failures Deadlocks Abort statements Validation errors Constraint violations Resource constraints

  45. Purchase(item_id, cust_id): item = items_tbl[item_id] if item.count == 0: Abort() item.count -= 1 bills.insert(cust_id, item_id, Write visibility delay item.price) history.insert(cust_id, item_id)

  46. Why delayed write visibility System induced State induced Failures Deadlocks Abort statements Validation errors Constraint violations Resource constraints

  47. Purchase(item_id, cust_id): Early write visibility item = items_tbl[item_id] if item.count == 0: Abort() item.count -= 1 bills.insert(cust_id, item_id, item.price) history.insert(cust_id, item_id)

  48. Purchase(item_id, cust_id): Early write visibility item = items_tbl[item_id] if item.count == 0: Abort() item.count -= 1 Item’s count update is visible here bills.insert(cust_id, item_id, item.price) history.insert(cust_id, item_id)

Recommend


More recommend