Increasing Concurrency in Databases using Program Analysis - PowerPoint PPT Presentation

About This Presentation
Title:

Increasing Concurrency in Databases using Program Analysis

Description:

Ecoop June 15-18 Oslo, Norway. 1. Increasing Concurrency in Databases using Program Analysis ... June 15-18 Oslo, Norway. 7. Overview of Prediction. Predict ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 42
Provided by: kri8
Category:

less

Transcript and Presenter's Notes

Title: Increasing Concurrency in Databases using Program Analysis


1
Increasing Concurrency in Databases using Program
Analysis
  • Roman Vitenberg, Kristian Kvilekval and Ambuj
    Singh
  • University of California, Santa Barbara

2
Outline
  • Motivation
  • Shape graphs and prediction
  • Predictive scheduler optimizations
  • Results
  • Conclusions

3
Transactional Schedulers
  • Most fundamental problem of concurrency control
    Pap86BHG87
  • Little has been done on predictive schedulers
  • Difficult to extract future usage
  • Difficult to use it (Optimal Scheduling
    NP-complete)

4
Program analysis for better concurrency
  • OODBs increasingly integrated (JDO)
  • Shape analysis makes predicting data accesses
    more feasible
  • Transactional code is known in advance
  • Rich type structure available to analysis
  • Enhance schedulers with specific optimizations
    based on the extracted info
  • Deadlock handling, early lock release, adaptive
    preclaiming

5
Previous and Related Work
  • Scheduling in object bases
  • GrahamBarker95
  • Shape analysis (pointer analysis)
  • Escape analysisBogda99Ruf00
  • ParallelizationCorbera99
  • Type SafetyGhiya96 Nurit98 Wilhem00
  • Others...

6
Outline
  • Motivation
  • Shape graphs and prediction
  • Predictive scheduler optimizations
  • Results
  • Conclusions

7
Overview of Prediction
  • Predict locking based on program code
  • Extract program summary in shape graph
  • Provide runtime system with future accesses
  • Advantages
  • Facilitates integration OODB
  • Supports complex pointer-based structures
  • Automatically derived from source code

8
Example shape
class Connector Part a,b class Part Con
nector left,right,up,down Material m Suppli
er s int volume() weight0 while
(part) weight(part.material.density
part.volume()) partpart.right.b
9
Basic Shape Analysis
  • Graph
  • Abstract locations (heap cells)
  • Edges labeled with with field names
  • Abstract interpretation
  • Extend graph through field references
  • Combine graphs when heap location is shared
  • Merge shapes bottom up through static call graph

10
Predicting with shape graphs
  • Compile Time
  • Generate shapes for method references
  • Self, arguments, and global variables
  • Label shape edges with earliest access
  • Annotate programs to pass visible references and
    shapes to transaction scheduler
  • Runtime
  • Interpret shape graph on the actual object graph
    generating expected object set

11
Predicting with Shape Graphs
Object Graph
N5
a1
N
N
o10
o45
o610
J10
F10
F
J
J
o210
o515
a2
a4
K
G5
K10
o320
a5
a3
Shape Graph
(o1,a1) (o4,a1) (o2,a2) (o6,a1) (o5,a4)
(o3,a5)
12
Outline
  • Motivation
  • Shape graphs and prediction
  • Predictive scheduler optimizations
  • Results
  • Conclusions

13
Deadlock Handling Background
  • Deadlock detection
  • Wait-for-graph (WFG)
  • Nodes are active transactions
  • Edge (ti,tj) indicates that ti waits for tj to
    release a lock
  • Maintaining throughout execution is expensive
  • Deadlock prevention
  • Heuristic-based techniques (wound-wait)
  • Cheaper but causing unnecessary transaction
    aborts
  • Resource allocation graph (infeasible w/o future
    knowledge)

14
Deadlock handling our approach
  • Shape analysis helps us prune parts of WFG and
    other graphs in all graph-based algorithms

15
Early lock release background
  • Strict 2PL all locks are held till the end of
    transaction
  • Non-strict 2PL read locks are released after the
    last access to the object
  • Non-strict allows greater concurrency but
  • Difficult to determine the last access
  • Allows non-serializable execution

16
Early lock release non-searializable execution
T1 Acq(o1) T2 read(o1) Rel (o1)
Acq(o1) write(o1) Acq(o2) write(
o2) Rel(o1,o2) Acq(o2) read(o2) Rel
(o2)
17
Early lock release our approach
  • Estimate the last access to an object in order to
    release early
  • Causality-aware scheduler
  • T1 causally precedes T2 (T1 ?c T2) if either
  • T2 is initiated after T1 by the same client, or
  • T2 acquires a lock that T1 has released, or
  • There is T3 such that T1 ?c T3 and T3 ?c T2
  • If T1 ?c T2 the scheduler blocks T2.A(O) if T1
    may access O in the future.

18
Early lock release Causality-aware scheduling
T1 Acq(o1) T2 read(o1) Rel (o1)
Acq(o1) write(o1) Acq(o2) locks write(o2) Rel(o1,o2) Acq(o2)
read(o2) Rel(o2)
19
Lock preclaiming background
  • Standard 2PL acquires locks gradually
  • Conservative 2PL preclaims all the locks
  • Fewer aborts upon high contention long
    transactions
  • Shorter wait-for chains
  • T1.A(O2)
  • T2.A(O1)T2.A(O2)
  • T3.A(O1)
  • Requires apriori knowledge of locks

20
Lock preclaiming our approach
  • Predict the set of objects to be preclaimed
    automatically
  • Adaptive hybrid schemes
  • Preclaim when expected contention level is high
    across executing transactions
  • Preclaim locks only for short transaction

21
Outline
  • Motivation
  • Shape graphs and prediction
  • Predictive scheduler optimizations
  • Results
  • Conclusions

22
Overview of performance measurements
  • Two applications OO7 Prototype reservation
    system
  • Mix of transaction types (lock sequence,
    short/long transactions)
  • Transaction rates, and transaction parameters
  • Compare Standard 2PL with our enhanced 2PL based
    on scheduling delay time

23
Evaluation OO7
  • Short Read
  • 2ms
  • 600/min
  • Short Update
  • 2ms
  • 10/min
  • Long Reorg
  • 2000ms
  • 3/min

Comp Parts
24
OO7 Results
Relative delay by scheduler
25
Delays in short query
Predictive
Strict 2-Phase
26
Conclusions future directions
  • Runtime use of shape graph can generate object
    use prediction (even without prior statistics)
  • Transaction scheduler improved by
  • Better deadlock handling (smaller WFG)
  • Early read lock release
  • Lock preclaiming
  • Future lease prediction

27
End
  • Questions?

28
Evaluation Car Reservation
29
Evaluation car reservation
Query
Traversal
Starved
Starved
30
Construction of Shape Graphs
x
31
Construction of Shape Graphs
x.f s
F
32
Construction of Shape Graphs
x.f s t x.f.g
F
G
33
Construction of Shape Graphs
x.f s x.f.g t x x.n
N
F
?
G
34
Construction of Shape Graphs
x.f s x.f.g t if (x ! null) x x.n


35
Combining Shape Graphs
x y
36
Combining Shape Graphs
  • Unify graphs recursively

37
Unification of Shape Graphs
  • Unify graphs recursively

N
F
J
G
K
38
Shape Analysis Algorithm
  • ? methods Interpret basic blocks
  • Create shapes for basic blocks
  • Run until fixed-point is reached
  • Propagate in static callgraph

39
Static Call Graphs
main
Static representation of calls
m2
m3
m4
m3 a.f s o.m4(a) Class C m4(F f)


Unify(a,f)
f
40
Call Graphs
m1
  • Propagate bottom up
  • Merge polymorphic calls
  • Recursive Calls
  • Fixed point
  • Merge SCCRuf00

m2
B.m4
m3
m4
D1.m4
D2.m4
m1
m2
m1
41
Overview of scheduler enhancements
  • Better Deadlock handling
  • Smaller WFG based on type information
  • Conservative Resource Allocation Graph
  • Early Lock Release
  • Read locks released after last use
  • Lock Preclaiming
  • Better throughput in high contention
Write a Comment
User Comments (0)
About PowerShow.com