15-721 DATABASE SYSTEMS Lecture #04 Optimistic Concurrency - - PowerPoint PPT Presentation

15 721
SMART_READER_LITE
LIVE PREVIEW

15-721 DATABASE SYSTEMS Lecture #04 Optimistic Concurrency - - PowerPoint PPT Presentation

15-721 DATABASE SYSTEMS Lecture #04 Optimistic Concurrency Control Andy Pavlo / / Carnegie Mellon University / / Spring 2016 @Andy_Pavlo // Carnegie Mellon University // Spring 2017 ADMINISTRATIVE Project #1 is due Tuesday Jan 31 st @


slide-1
SLIDE 1

Andy Pavlo / / Carnegie Mellon University / / Spring 2016

DATABASE SYSTEMS

Lecture #04 – Optimistic Concurrency Control

15-721

@Andy_Pavlo // Carnegie Mellon University // Spring 2017

slide-2
SLIDE 2

CMU 15-721 (Spring 2017)

ADMINISTRATIVE

Project #1 is due Tuesday Jan 31st @ 11:59pm Project #2 will be released on Tuesday too. →You need a group of three people. →I will send out a sign-up sheet.

slide-3
SLIDE 3

CMU 15-721 (Spring 2017)

TODAY’S AGENDA

Isolation Levels Stored Procedures Optimistic Concurrency Control

3

slide-4
SLIDE 4

CMU 15-721 (Spring 2017)

OBSERVATION

Serializability is useful because it allows programmers to ignore concurrency issues but enforcing it may allow too little parallelism and limit performance. We may want to use a weaker level of consistency to improve scalability.

4

slide-5
SLIDE 5

CMU 15-721 (Spring 2017)

ISOLATION LEVELS

Controls the extent that a txn is exposed to the actions of other concurrent txns. Provides for greater concurrency at the cost of exposing txns to uncommitted changes:

→ Dirty Read Anomaly → Unrepeatable Reads Anomaly → Phantom Reads Anomaly

5

slide-6
SLIDE 6

CMU 15-721 (Spring 2017)

ANSI ISOLATION LEVELS

SERIALIZABLE

→ No phantoms, all reads repeatable, no dirty reads.

REPEATABLE READS

→ Phantoms may happen.

READ COMMITTED

→ Phantoms and unrepeatable reads may happen.

READ UNCOMMITTED

→ All of them may happen.

6

Isolation (High→Low)

slide-7
SLIDE 7

CMU 15-721 (Spring 2017)

ISOLATION LEVEL HIERARCHY

7

REPEATABLE READS READ UNCOMMITTED SERIALIZABLE READ COMMITTED

slide-8
SLIDE 8

CMU 15-721 (Spring 2017)

ANSI ISOLATION LEVELS

8

Default Maximum

Actian Ingres SERIALIZABLE SERIALIZABLE Greenplum READ COMMITTED SERIALIZABLE IBM DB2 CURSOR STABILITY SERIALIZABLE MySQL REPEATABLE READS SERIALIZABLE MemSQL READ COMMITTED READ COMMITTED MS SQL Server READ COMMITTED SERIALIZABLE Oracle READ COMMITTED SNAPSHOT ISOLATION Postgres READ COMMITTED SERIALIZABLE SAP HANA READ COMMITTED SERIALIZABLE VoltDB SERIALIZABLE SERIALIZABLE

Source: Peter Bailis

slide-9
SLIDE 9

CMU 15-721 (Spring 2017)

CRITICISM OF ISOLATION LEVELS

The isolation levels defined as part of SQL-92 standard only focused on anomalies that can occur in a 2PL-based DBMS. Two additional isolation levels:

→ CURSOR STABILITY → SNAPSHOT ISOLATION

9

A CRITIQUE OF ANSI SQL ISOLATION LEVELS SIGMOD 1995

slide-10
SLIDE 10

CMU 15-721 (Spring 2017)

CURSOR STABILITY (CS)

The DBMS’s internal cursor maintains a lock on a item in the database until it moves on to the next item. CS is a stronger isolation level in between REPEATABLE READS and READ COMMITTED that can (sometimes) prevent the Lost Update Anomaly.

10

slide-11
SLIDE 11

CMU 15-721 (Spring 2017)

LOST UPDATE ANOMALY

11

Txn #2

BEGIN COMMIT

WRITE(A)

Txn #1

BEGIN COMMIT

READ(A) WRITE(A)

  • • •
  • • •
  • • • • •
slide-12
SLIDE 12

CMU 15-721 (Spring 2017)

LOST UPDATE ANOMALY

11

Txn #2

BEGIN COMMIT

WRITE(A)

Txn #1

BEGIN COMMIT

READ(A) WRITE(A)

  • • •
  • • •
  • • • • •
slide-13
SLIDE 13

CMU 15-721 (Spring 2017)

LOST UPDATE ANOMALY

11

Txn #2

BEGIN COMMIT

WRITE(A)

Txn #1

BEGIN COMMIT

READ(A) WRITE(A)

  • • •
  • • •
  • • • • •
slide-14
SLIDE 14

CMU 15-721 (Spring 2017)

LOST UPDATE ANOMALY

11

Txn #2

BEGIN COMMIT

WRITE(A)

Txn #1

BEGIN COMMIT

READ(A) WRITE(A)

  • • •
  • • •
  • • • • •
slide-15
SLIDE 15

CMU 15-721 (Spring 2017)

LOST UPDATE ANOMALY

11

Txn #2

BEGIN COMMIT

WRITE(A)

Txn #1

BEGIN COMMIT

READ(A) WRITE(A)

  • • •
  • • •
  • • • • •
slide-16
SLIDE 16

CMU 15-721 (Spring 2017)

LOST UPDATE ANOMALY

11

Txn #2

BEGIN COMMIT

WRITE(A)

Txn #1

BEGIN COMMIT

READ(A) WRITE(A)

  • • •
  • • •
  • • • • •
slide-17
SLIDE 17

CMU 15-721 (Spring 2017)

LOST UPDATE ANOMALY

Txn #2’s write to A will be lost even though it commits after Txn #1.

11

Txn #2

BEGIN COMMIT

WRITE(A)

Txn #1

BEGIN COMMIT

READ(A) WRITE(A)

  • • •
  • • •
  • • • • •

A cursor lock on A would prevent this problem (but not always).

slide-18
SLIDE 18

CMU 15-721 (Spring 2017)

SNAPSHOT ISOLATION (SI)

Guarantees that all reads made in a txn see a consistent snapshot of the database that existed at the time the txn started.

→ A txn will commit under SI only if its writes do not conflict with any concurrent updates made since that snapshot.

SI is susceptible to the Write Skew Anomaly

12

slide-19
SLIDE 19

CMU 15-721 (Spring 2017)

WRITE SKEW ANOMALY

13

Txn #1

Change white marbles to black.

Txn #2

Change black marbles to white.

slide-20
SLIDE 20

CMU 15-721 (Spring 2017)

WRITE SKEW ANOMALY

13

Txn #1

Change white marbles to black.

Txn #2

Change black marbles to white.

slide-21
SLIDE 21

CMU 15-721 (Spring 2017)

WRITE SKEW ANOMALY

13

Txn #1

Change white marbles to black.

Txn #2

Change black marbles to white.

slide-22
SLIDE 22

CMU 15-721 (Spring 2017)

ISOLATION LEVEL HIERARCHY

14

REPEATABLE READS SNAPSHOT ISOLATION READ UNCOMMITTED CURSOR STABILITY SERIALIZABLE READ COMMITTED

slide-23
SLIDE 23

CMU 15-721 (Spring 2017)

ISOLATION LEVEL HIERARCHY

14

REPEATABLE READS SNAPSHOT ISOLATION READ UNCOMMITTED CURSOR STABILITY SERIALIZABLE READ COMMITTED

slide-24
SLIDE 24

CMU 15-721 (Spring 2017)

OBSERVATION

Disk stalls are (almost) gone when executing txns in an in-memory DBMS. There are still other stalls when an app uses conversational API to execute queries on DBMS

→ ODBC/JDBC → DBMS-specific wire protocols

15

slide-25
SLIDE 25

CMU 15-721 (Spring 2017)

CONVERSATIONAL DATABASE API

16

Application BEGIN SQL Program Logic SQL Program Logic ⋮ COMMIT

slide-26
SLIDE 26

CMU 15-721 (Spring 2017)

CONVERSATIONAL DATABASE API

16

Application BEGIN SQL Program Logic SQL Program Logic ⋮ COMMIT Parser Planner Optimizer Query Execution

slide-27
SLIDE 27

CMU 15-721 (Spring 2017)

CONVERSATIONAL DATABASE API

16

Application BEGIN SQL Program Logic SQL Program Logic ⋮ COMMIT Parser Planner Optimizer Query Execution

slide-28
SLIDE 28

CMU 15-721 (Spring 2017)

CONVERSATIONAL DATABASE API

16

Application BEGIN SQL Program Logic SQL Program Logic ⋮ COMMIT Parser Planner Optimizer Query Execution

slide-29
SLIDE 29

CMU 15-721 (Spring 2017)

CONVERSATIONAL DATABASE API

16

Application BEGIN SQL Program Logic SQL Program Logic ⋮ COMMIT Parser Planner Optimizer Query Execution

slide-30
SLIDE 30

CMU 15-721 (Spring 2017)

SOLUTIONS

Prepared Statements

→ Removes query preparation overhead.

Query Batches

→ Reduces the number of network roundtrips.

Stored Procedures

→ Removes both preparation and network stalls.

17

slide-31
SLIDE 31

CMU 15-721 (Spring 2017)

STORED PROCEDURES

A stored procedure is a group of queries that form a logical unit and perform a particular task

  • n behalf of an application directly inside of the

DBMS. Programming languages:

→ SQL/PSM (standard) → PL/SQL (Oracle / IBM / MySQL) → PL/pgSQL (Postgres) → Transact-SQL (Microsoft / Sybase)

18

slide-32
SLIDE 32

CMU 15-721 (Spring 2017)

STORED PROCEDURES

19

Application BEGIN SQL Program Logic SQL Program Logic ⋮ COMMIT

slide-33
SLIDE 33

CMU 15-721 (Spring 2017)

STORED PROCEDURES

19

Application CALL PROC(x=99) PROC(x)

slide-34
SLIDE 34

CMU 15-721 (Spring 2017)

STORED PROCEDURE EXAMPLE

20

CREATE PROCEDURE testProc (num INT, name VARCHAR) RETURNS INT BEGIN DECLARE cnt INT DEFAULT 0; LOOP INSERT INTO student VALUES (cnt, name); SET cnt := cnt + 1; IF (cnt > 15) THEN RETURN cnt; END IF; END LOOP; END;

slide-35
SLIDE 35

CMU 15-721 (Spring 2017)

ADVANTAGES

Reduce the number of round trips between application and database servers. Increased performance because queris are pre- compiled and stored in DBMS. Procedure reuse across applications. Server-side txn restarts on conflicts.

21

slide-36
SLIDE 36

CMU 15-721 (Spring 2017)

DISADVANTAGES

Not as many developers know how to write SQL/PSM code.

→ Safe Languages vs. Sandbox Languages

Outside the scope of the application so it is difficult to manage versions and hard to debug. Probably not be portable to other DBMSs. DBAs usually don’t give permissions out freely…

22

slide-37
SLIDE 37

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

Timestamp-ordering scheme where txns copy data read/write into a private workspace that is not visible to other active txns. When a txn commits, the DBMS verifies that there are no conflicts. First proposed in 1981 at CMU by H.T. Kung.

23

slide-38
SLIDE 38

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B)

Read Phase

Record Value Write Timestamp

B 456 10000 123 A 10000 COMMIT

slide-39
SLIDE 39

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B)

Workspace

Record Value Write Timestamp

123 A 10000

Record Value Write Timestamp

B 456 10000 123 A 10000 COMMIT

slide-40
SLIDE 40

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B)

Workspace

Record Value Write Timestamp

123 A 10000

Record Value Write Timestamp

B 456 10000 123 A 10000 COMMIT

slide-41
SLIDE 41

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B)

Workspace

Record Value Write Timestamp

123 A 10000

Record Value Write Timestamp

B 456 10000 123 A 10000 888

COMMIT

slide-42
SLIDE 42

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B)

Workspace

Record Value Write Timestamp

B 456 10000 123 A 10000

Record Value Write Timestamp

B 456 10000 123 A 10000 888

COMMIT

slide-43
SLIDE 43

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B)

Workspace

Record Value Write Timestamp

B 456 10000 123 A 10000

Record Value Write Timestamp

B 456 10000 123 A 10000 888

999

COMMIT

slide-44
SLIDE 44

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B) VALIDATE PHASE WRITE PHASE

Workspace

Record Value Write Timestamp

B 456 10000 123 A 10000

Record Value Write Timestamp

B 456 10000 123 A 10000 888

999

COMMIT

slide-45
SLIDE 45

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B) VALIDATE PHASE WRITE PHASE

Workspace

Record Value Write Timestamp

B 456 10000 123 A 10000

Record Value Write Timestamp

B 456 10000 123 A 10000 888

999

COMMIT

slide-46
SLIDE 46

CMU 15-721 (Spring 2017)

OPTIMISTIC CONCURRENCY CONTROL

24

Txn #1

BEGIN

READ(A) WRITE(A) WRITE(B) VALIDATE PHASE WRITE PHASE

10001

Workspace

Record Value Write Timestamp

B 456 10000 123 A 10000

Record Value Write Timestamp

B 456 10000 123 A 10000 888

999

COMMIT 888 999 10001 10001

slide-47
SLIDE 47

CMU 15-721 (Spring 2017)

READ PHASE

Track the read/write sets of txns and store their writes in a private workspace. The DBMS copies every tuple that the txn accesses from the shared database to its workspace ensure repeatable reads.

25

slide-48
SLIDE 48

CMU 15-721 (Spring 2017)

VALIDATION PHASE

When the txn invokes COMMIT, the DBMS checks if it conflicts with other txns. Two methods for this phase:

→ Backward Validation → Forward Validation

26

slide-49
SLIDE 49

CMU 15-721 (Spring 2017)

BACKWARD VALIDATION

Check whether the committing txn intersects its read/write sets with those of any txns that have already committed.

27

Txn #1 Txn #2 Txn #3

TIME

COMMIT COMMIT COMMIT

slide-50
SLIDE 50

CMU 15-721 (Spring 2017)

BACKWARD VALIDATION

Check whether the committing txn intersects its read/write sets with those of any txns that have already committed.

27

Txn #1 Txn #2 Txn #3

TIME

COMMIT COMMIT COMMIT

Validation Scope

slide-51
SLIDE 51

CMU 15-721 (Spring 2017)

FORWARD VALIDATION

Check whether the committing txn intersects its read/write sets with any active txns that have not yet committed.

28

Txn #1 Txn #2 Txn #3

TIME

COMMIT COMMIT COMMIT

slide-52
SLIDE 52

CMU 15-721 (Spring 2017)

FORWARD VALIDATION

Check whether the committing txn intersects its read/write sets with any active txns that have not yet committed.

28

Txn #1 Txn #2 Txn #3

TIME

COMMIT COMMIT COMMIT

Validation Scope

slide-53
SLIDE 53

CMU 15-721 (Spring 2017)

VALIDATION PHASE

Original OCC uses serial validation. Parallel validation means that each txn must check the read/write sets of other txns that are trying to validate at the same time.

→ Each txn has to acquire locks for its write set records in some global order. → The txn does not need locks for read set records.

29

slide-54
SLIDE 54

CMU 15-721 (Spring 2017)

WRITE PHASE

The DBMS propagates the changes in the txn’s write set to the database and makes them visible to

  • ther txns.

As each record is updated, the txn releases the lock acquired during the Validation Phase.

30

slide-55
SLIDE 55

CMU 15-721 (Spring 2017)

MODERN OCC

Harvard/MIT Silo MIT/CMU TicToc

31

slide-56
SLIDE 56

CMU 15-721 (Spring 2017)

SILO

Single-node, in-memory OLTP DBMS.

→ Serializable OCC with parallel backward validation. → Stored procedure-only API.

No writes to shared-memory for read txns. Batched timestamp allocation using epochs. Pure awesomeness from Eddie Kohler.

32

SPEEDY TRANSACTIONS IN MULTICORE IN-MEMORY DATABASES SOSP 2013

slide-57
SLIDE 57

CMU 15-721 (Spring 2017)

SILO: EPOCHS

Time is sliced into fixed-length epochs (40ms). All txns that start in the same epoch will be committed together at the end of the epoch.

→ Txns that span an epoch have to refresh themselves to be carried over into the next epoch.

Worker threads only need to synchronize at the beginning of each epoch.

33

slide-58
SLIDE 58

CMU 15-721 (Spring 2017)

SILO: TRANSACTION IDS

Each worker thread generates a unique txn id based on the current epoch number and the next value in its assigned batch.

34

Worker Worker Worker Worker Epoch Thread

Epoch=100 [0,10] [11,20] [31,40] [21,30]

slide-59
SLIDE 59

CMU 15-721 (Spring 2017)

SILO: COMMIT PROTOCOL

35

POINTER ATTR1 ATTR2 #-###-#

¤

John $100 #-###-#

¤

Tupac $999 #-###-#

¤

Wiz $67 #-###-#

¤

O.D.B. $13

BATCH TIMESTAMP EPOCH EXTRA

TID Word

Write Lock Bit Latest Version Bit Absent Bit

slide-60
SLIDE 60

CMU 15-721 (Spring 2017)

SILO: COMMIT PROTOCOL

35

POINTER ATTR1 ATTR2 #-###-#

¤

John $100 #-###-#

¤

Tupac $999 #-###-#

¤

Wiz $67 #-###-#

¤

O.D.B. $13

Step #1: Lock Write Set Workspace

Read Set Write Set #-###-# O.D.B. $13 Tupac $777 #-###-# Tupac $999 TID Word

slide-61
SLIDE 61

CMU 15-721 (Spring 2017)

SILO: COMMIT PROTOCOL

35

POINTER ATTR1 ATTR2 #-###-#

¤

John $100 #-###-#

¤

Tupac $999 #-###-#

¤

Wiz $67 #-###-#

¤

O.D.B. $13

Step #1: Lock Write Set Workspace

Read Set Write Set #-###-# O.D.B. $13 Tupac $777 #-###-# Tupac $999

Step #2: Examine Read Set

???

TID Word

slide-62
SLIDE 62

CMU 15-721 (Spring 2017)

SILO: COMMIT PROTOCOL

35

POINTER ATTR1 ATTR2 #-###-#

¤

John $100 #-###-#

¤

Tupac $999 #-###-#

¤

Wiz $67 #-###-#

¤

O.D.B. $13

Step #1: Lock Write Set Workspace

Read Set Write Set #-###-# O.D.B. $13 Tupac $777 #-###-# Tupac $999

Step #2: Examine Read Set

???

TID Word

slide-63
SLIDE 63

CMU 15-721 (Spring 2017)

SILO: COMMIT PROTOCOL

35

POINTER ATTR1 ATTR2 #-###-#

¤

John $100 #-###-#

¤

Tupac $999 #-###-#

¤

Wiz $67 #-###-#

¤

O.D.B. $13

Step #1: Lock Write Set Workspace

Read Set Write Set #-###-# O.D.B. $13 Tupac $777 #-###-# Tupac $999

Step #2: Examine Read Set

TID Word

slide-64
SLIDE 64

CMU 15-721 (Spring 2017)

SILO: COMMIT PROTOCOL

35

POINTER ATTR1 ATTR2 #-###-#

¤

John $100 #-###-#

¤

Tupac $999 #-###-#

¤

Wiz $67 #-###-#

¤

O.D.B. $13

Step #1: Lock Write Set Workspace

Read Set Write Set #-###-# O.D.B. $13 Tupac $777 #-###-# Tupac $999

Step #2: Examine Read Set Step #3: Install Write Set

TID Word $777 #-###-#

slide-65
SLIDE 65

CMU 15-721 (Spring 2017)

SILO: GARBAGE COLLECTION

Cooperative threads GC. Each worker thread marks a deleted object with a reclamation epoch.

→ This is the epoch after which no thread could access the

  • bject again, and thus can be safely removed.

→ Object references are maintained in thread-local storage to avoid unnecessary data movement.

36

slide-66
SLIDE 66

CMU 15-721 (Spring 2017)

SILO: RANGE QUERIES

DBMS handles phantoms by tracking the txn’s scan set (node set) on indexes.

→ Have to include “virtual” entries for keys that do not exist in the index.

We will discuss key-range and index gap locking next week…

37

slide-67
SLIDE 67

CMU 15-721 (Spring 2017)

SILO: PERFORMANCE

38

Source: Eddie Kohler

Database: TPC-C with 28 Warehouses Processor: 4 sockets, 8 cores per socket

slide-68
SLIDE 68

CMU 15-721 (Spring 2017)

TICTOC

Serializable OCC implemented in DBx1000.

→ Parallel backward validation → Stored procedure-only API

No global timestamp allocation. Txn timestamps are derived from records.

39

TICTOC: TIME-TRAVELING OPTIMISTIC CONCURRENCY CONTROL SIGMOD 2016

slide-69
SLIDE 69

CMU 15-721 (Spring 2017)

TICTOC: RECORD TIMESTAMPS

Write Timestamp (W-TS):

→ The logical timestamp of the last committed txn that wrote to the record.

Read Timestamp (R-TS):

→ The logical timestamp of the last txn that read the record.

A record is considered valid from W-TS to R-TS

40

slide-70
SLIDE 70

CMU 15-721 (Spring 2017)

Txn

TICTOC: VALIDATION PHASE

41 READ(B) WRITE(A) READ(C)

1 2 3 4 LOGICAL TIME W-TS R-TS

A B C

slide-71
SLIDE 71

CMU 15-721 (Spring 2017)

Txn

TICTOC: VALIDATION PHASE

41 READ(B) WRITE(A) READ(C)

1 2 3 4 LOGICAL TIME

Step #1: Lock Write Set

slide-72
SLIDE 72

CMU 15-721 (Spring 2017)

Txn

TICTOC: VALIDATION PHASE

41 READ(B) WRITE(A) READ(C)

1 2 3 4 LOGICAL TIME

Step #1: Lock Write Set Step #2: Compute CommitTS

CommitTS

slide-73
SLIDE 73

CMU 15-721 (Spring 2017)

Txn

TICTOC: VALIDATION PHASE

41 READ(B) WRITE(A) READ(C)

1 2 3 4 LOGICAL TIME

Step #1: Lock Write Set Step #2: Compute CommitTS Step #3: Validate Read Set

CommitTS

slide-74
SLIDE 74

CMU 15-721 (Spring 2017)

Txn

TICTOC: VALIDATION PHASE

41 READ(B) WRITE(A) READ(C)

1 2 3 4 LOGICAL TIME

Step #1: Lock Write Set Step #2: Compute CommitTS Step #3: Validate Read Set

CommitTS

???

slide-75
SLIDE 75

CMU 15-721 (Spring 2017)

Txn

TICTOC: VALIDATION PHASE

41 READ(B) WRITE(A) READ(C)

1 2 3 4 LOGICAL TIME

Step #1: Lock Write Set Step #2: Compute CommitTS Step #3: Validate Read Set

Case 1: Latest Version CommitTS

slide-76
SLIDE 76

CMU 15-721 (Spring 2017)

Txn

TICTOC: VALIDATION PHASE

41 READ(B) WRITE(A) READ(C)

1 2 3 4 LOGICAL TIME

Step #1: Lock Write Set Step #2: Compute CommitTS Step #3: Validate Read Set

Case 1: Latest Version Case 2: Updated Before CommitTS CommitTS

slide-77
SLIDE 77

CMU 15-721 (Spring 2017)

Txn

TICTOC: VALIDATION PHASE

41 READ(B) WRITE(A) READ(C)

1 2 3 4 LOGICAL TIME

Step #1: Lock Write Set Step #2: Compute CommitTS Step #3: Validate Read Set

Case 1: Latest Version Case 2: Updated Before CommitTS Case 3: Updated After CommitTS CommitTS

slide-78
SLIDE 78

CMU 15-721 (Spring 2017)

TICTOC: PERFORMANCE

42

0.0 1.0 2.0 3.0 10 20 30 40

Throughput (txn/sec) Thread Count

0.0 0.2 0.4 0.6 0.8 1.0 10 20 30 40

Throughput (txn/sec) Thread Count TICTOC HEKATON DL_DETECT NO_WAIT SILO

millions millions

Database: 10GB YCSB Processor: 4 sockets, 10 cores per socket

Medium Contention 90% Reads / 10% Writes High Contention 50% Reads / 50% Writes

slide-79
SLIDE 79

CMU 15-721 (Spring 2017)

PARTING THOUGHTS

Trade-off between aborting txns early or later.

→ Early: Avoid wasted work for txns that will eventually abort, but has checking overhead. → Later: No runtime overhead but lots of wasted work under high contention.

Silo is a very influential system.

43

slide-80
SLIDE 80

CMU 15-721 (Spring 2017)

PARTING THOUGHTS

Trade-off between aborting txns early or later.

→ Early: Avoid wasted work for txns that will eventually abort, but has checking overhead. → Later: No runtime overhead but lots of wasted work under high contention.

Silo is a very influential system.

43

slide-81
SLIDE 81

CMU 15-721 (Spring 2017)

NEXT CLASS

Multi-Version Concurrency Control

44