SlideShare une entreprise Scribd logo
1  sur  73
Télécharger pour lire hors ligne
Crochet: Checkpoint and Rollback via
Lightweight Heap Traversal on Stock JVMs
Jonathan Bell and Luís Pina
{bellj / lpina2}@gmu.edu
George Mason University
European Conference on Object-Oriented Programming
July 20, 2018
Fuzzing a method
01
02 String cmd ;
03
04 ... // Lots of uninteresting code
05
06
07
08 methodToFuzz(cmd);
09
10
11
12
13
14
15
2
Fuzzing a method
01
02 String cmd ;
03
04 ... // Lots of uninteresting code
05 while (true) {
06 cmd = mutate(cmd);
07
08 methodToFuzz(cmd);
09
10
11
12 }
13
14
15
3
Fuzzing a method
01
02 String cmd ;
03
04 ... // Lots of uninteresting code
05 while (true) {
06 cmd = mutate(cmd);
07 try {
08 methodToFuzz(cmd);
09 } catch (Throwable t) {
10 generateTest(cmd);
11 }
12 }
13
14
15
4
Fuzzing a method
Example test
generateTest("SET key val")
5
Fuzzing a method
Example test
generateTest("SET key val")
methodToFuzz("SET key val")
6
Fuzzing a method
Example test
generateTest("SET key val")
methodToFuzz("SET key val")
3
7
Fuzzing a method
Example test
generateTest("SET key val")
methodToFuzz("SET key val")
3
8
Fuzzing a method
State is a problem
Bu er:
methodToFuzz("SET key val")
SET key val
9
Fuzzing a method
State is a problem
Bu er:
methodToFuzz("SET key val")
SET key val
methodToFuzz("SET key val")
SET key val
10
Fuzzing a method
State is a problem
Bu er:
methodToFuzz("SET key val")
SET key val
methodToFuzz("SET key val")
SET key val
methodToFuzz("SET key val")
SET key val
7
11
Fuzzing a method
State is a problem
Bu er:
methodToFuzz("SET key val")
SET key val
methodToFuzz("SET key val")
SET key val
methodToFuzz("SET key val")
SET key val
7
generateTest("SET key val")
12
Fuzzing a method
Restart with fresh state
Native Restart
0.0
10.0
20.0
30.0
40.0
50.0
60.0
70.0
80.0
90.0timetocomplete(sec)
41.52
78.33
Short fuzz run (110 FTP commands)
13
Checkpoint/Rollback
Bu er:
checkpoint
14
Checkpoint/Rollback
Bu er:
checkpoint
15
Checkpoint/Rollback
Bu er:
checkpoint
methodToFuzz("SET key val")
SET key val
16
Checkpoint/Rollback
Bu er:
checkpoint
methodToFuzz("SET key val")
SET key val
rollback
17
Checkpoint/Rollback
Bu er:
checkpoint
methodToFuzz("SET key val")
SET key val
rollback
18
Checkpoint/Rollback
Bu er:
checkpoint
methodToFuzz("SET key val")
rollback
19
Checkpoint/Rollback
Bu er:
checkpoint
methodToFuzz("SET key val")
rollback
methodToFuzz("SET key val")
20
Checkpoint/Rollback
Bu er:
Crochet.checkpoint()
methodToFuzz("SET key val")
Crochet.rollback()
methodToFuzz("SET key val")
Crochet
I No JVM changes (Excludes fork)
I Checkpoint/rollback dynamically
I E cient (Excludes CRIU)
I Low overhead (Excludes STMs)
21
Crochet
E cient
DeepClone CRIU CROCHET
Checkpoint Technique
1.0
1.1
1.2
1.3
1.4
1.5
1.6Timetocomplete(normalizedtonative)
Access percent of TreeMap after checkpoint
10% 25% 50% 100%
22
Checkpoint/Rollback
Bu er:
Crochet.checkpoint()
methodToFuzz("SET key val")
Crochet.rollback()
methodToFuzz("SET key val")
Crochet
I No JVM changes (Excludes fork)
I Checkpoint/rollback dynamically
I E cient (Excludes CRIU)
I Low overhead (Excludes STMs)
23
Crochet
Low overhead
Native Restart Crochet Crochet c/r
0.0
10.0
20.0
30.0
40.0
50.0
60.0
70.0
80.0
90.0timetocomplete(sec)
41.52
78.33
42.69 43.77
Short fuzz run (110 FTP commands)
24
Checkpoint/Rollback
Bu er:
Crochet.checkpoint()
methodToFuzz("SET key val")
Crochet.rollback()
methodToFuzz("SET key val")
Crochet
I No JVM changes (Excludes fork)
I Checkpoint/rollback dynamically
I E cient (Excludes CRIU)
I Low overhead (Excludes STMs)
25
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
26
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
27
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root.method()
28
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
v = 1
root.method()
29
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
v = 1
root.method()
v = 1 v = 1
v = 1
30
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
root.method()
v = 1 v = 1
v = 1
31
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
root.method()
v = 1 v = 1
v = 1 B.method()
32
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
v = 1
33
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
v = 1
F.method()
34
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
35
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
36
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
v = 2
37
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()v = 1
root
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
v = 2
root.method()
38
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
v = 2
root.method()
39
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
40
Lazy Heap Traversal
Tracked object information:
Version 0, 1, . . .
Snapshot Object state to-be-restored, if any
State normal or proxy (Checkpoint/Rollback)
Invariants:
1. Identity: Versions are unique
2. Total Order: Versions increase monotonically
3. Continuity: Proxies mediate access during traversal
41
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
42
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
43
Applications
I Checkpoint/Rollback
I Fuzz testing
I Code generation
I Debugging
I As application service
I Dynamic Software Update
I Proxies update objects lazily as reached after update
I Rubah
I Smalltalk become:
I a.become(b)
I All refs to a become refs to b, and vice-versa
I Proxies update refs lazily
I Dynamic AOP
I Proxies can add methods, enabling around advices
I Per object point-cuts
44
Goals
Crochet
I No JVM changes (Excludes fork)
I E cient (Excludes CRIU) 3
I Checkpoint/rollback dynamically
I Low overhead (Excludes STMs)
45
Implementation
Bytecode rewriting
01 class List {
02 List next; int i;
03
04 int sum()
05 { return i + next.sum(); }
06
07
08
09
10
11
12
13 }
46
Implementation
Bytecode rewriting
01 class List {
02 List next; int i;
03
04 int sum()
05 { return i + next.sum(); }
06
07 List $$snapshot; int $$version; // But no status!
08
09
10
11
12
13 }
47
Implementation
Bytecode rewriting
01 class List {
02 List next; int i;
03
04 int sum()
05 { return i + next.sum(); }
06
07 List $$snapshot; int $$version; // But no status!
08 void $$onReadWrite(); // Empty
09 void $$onCheckpoint(int version); // Turn into proxy
10 void $$onRollback(int version); // Turn into proxy
11
12 void $$copyFieldsTo(List dest);
13 }
48
Implementation
Bytecode rewriting
01 class List {
02 List next; int i;
03
04 int sum()
05 { next.$$onReadWrite(); return i + next.sum(); }
06
07 List $$snapshot; int $$version; // But no status!
08 void $$onReadWrite(); // Empty
09 void $$onCheckpoint(int version); // Turn into proxy
10 void $$onRollback(int version); // Turn into proxy
11
12 void $$copyFieldsTo(List dest);
13 }
49
Implementation
Proxies
01 class $$ListProxy extends List {
02 // No extra fields => Proxy has same size
03
04
05
06
07
08
09 void $$onReadWrite(); // Snap, propagate, revert proxy
10 void $$onCheckpoint(int version); // Update version
11 void $$onRollback(int version); // Update version
12
13
14 }
50
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
51
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
52
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
53
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
05 int proxy_mark = Unsafe.getInt(p, 0);
06 int proxy_klass = Unsafe.getInt(p, 4);
54
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
05 int proxy_mark = Unsafe.getInt(p, 0);
06 int proxy_klass = Unsafe.getInt(p, 4);
07 Unsafe.setInt( l , 4, proxy_klass );
08 assert(l instanceof $$ListProxy);
55
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
05 int proxy_mark = Unsafe.getInt(p, 0);
06 int proxy_klass = Unsafe.getInt(p, 4);
07 Unsafe.setInt( l , 4, proxy_klass );
08 assert(l instanceof $$ListProxy);
56
Goals
Crochet
I No JVM changes (Excludes fork) 3
I E cient (Excludes CRIU) 3
I Checkpoint/rollback dynamically
I Low overhead (Excludes STMs)
58
Root reference collection
I Static fields of loaded classes
I Instrument class loading
I Live thread objects
I Instrument thread creation
I Call stack (function args, local vars)
I Use standard debugger API
I Operand stack (bytecode instruction operands)
I Tricky, gets compiled away
I Instrument end of basic blocks to dump current stack when a
special flag is set
59
Multithreading
I Crochet is thread-safe
I Operations use Compare-And-Swap to synchronize
I Rollback not idempotent, needs locks
I Root collection must be done with threads stopped
I Barrier-sync to checkpoint/rollback whole heap
Thread 1
Thread 2
Thread 3
Checkpoint
Start
Crochet
Collect roots
Install proxies
Establish invariants
Checkpoint
Done
Thread 1
60
Goals
Crochet
I No JVM changes (Excludes fork) 3
I E cient (Excludes CRIU) 3
I Checkpoint/rollback dynamically 3
I Low overhead (Excludes STMs)
61
Crochet
Performance
avrora
batik
eclipse
fop h2 jython
luindex
lusearch
pmd
sunflow
tomcat
tradebeans
xalan
AVG
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
6.0
timetocomplete(normalizedtonative)
DaCapo Benchmark
Crochet Crochet C/R CRIU
62
Crochet
Performance
avrora
batik
eclipse
fop h2 jython
luindex
lusearch
pmd
sunflow
tomcat
tradebeans
xalan
AVG
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
6.0
timetocomplete(normalizedtonative)
DaCapo Benchmark
Crochet Crochet C/R CRIU
fast execution
(<300ms)
63
Crochet
Performance
avrora
batik
eclipse
fop h2 jython
luindex
lusearch
pmd
sunflow
tomcat
tradebeans
xalan
AVG
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
6.0
timetocomplete(normalizedtonative)
DaCapo Benchmark
Crochet Crochet C/R CRIU
fast execution (<1s)
large dump(>3GB)
64
Crochet
Performance
avrora
batik
eclipse
fop h2 jython
luindex
lusearch
pmd
sunflow
tomcat
tradebeans
xalan
AVG
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
6.0
timetocomplete(normalizedtonative)
DaCapo Benchmark
Crochet Crochet C/R CRIU
reflection
class loading
65
Goals
Crochet
I No JVM changes (Excludes fork) 3
I E cient (Excludes CRIU) 3
I Checkpoint/rollback dynamically 3
I Low overhead (Excludes STMs) 3
66
Crochet
Limitations
I Not checkpointed/rolled-back:
I Native code and references only held inside native code
I Class loaders
I State kept outside of the JVM (e.g., files, sockets)
I Reliance on “unsupported” sun.misc.Unsafe
I Eager checkpoint/rollback of arrays and some classes (e.g.,
java.lang.Exception)
67
Conclusion
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
41
E cient
lazy heap traversal
68
Conclusion
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
41
E cient
lazy heap traversal
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
05 int proxy_mark = Unsafe.getLong(p, 0);
06 int proxy_klass = Unsafe.getLong(p, 4);
07 Unsafe.setLong( l , 4, proxy_klass );
08 assert(l instanceof $$ListProxy);
57
Stock JVM
69
Conclusion
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
41
E cient
lazy heap traversal
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
05 int proxy_mark = Unsafe.getLong(p, 0);
06 int proxy_klass = Unsafe.getLong(p, 4);
07 Unsafe.setLong( l , 4, proxy_klass );
08 assert(l instanceof $$ListProxy);
57
Stock JVM
Multithreading
I Crochet is thread-safe
I Operations use Compare-And-Swap to synchronize
I Rollback uses locks due to non-idempotent
I Root collection must be done with threads stopped
I Barrier-sync to checkpoint/rollback whole heap
Thread 1
Thread 2
Thread 3
Checkpoint
Start
Crochet
Collect roots
Install proxies
Establish invariants
Checkpoint
Done
Thread 1
61
Dynamic checkpoint/rollback
70
Conclusion
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
41
E cient
lazy heap traversal
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
05 int proxy_mark = Unsafe.getLong(p, 0);
06 int proxy_klass = Unsafe.getLong(p, 4);
07 Unsafe.setLong( l , 4, proxy_klass );
08 assert(l instanceof $$ListProxy);
57
Stock JVM
Multithreading
I Crochet is thread-safe
I Operations use Compare-And-Swap to synchronize
I Rollback uses locks due to non-idempotent
I Root collection must be done with threads stopped
I Barrier-sync to checkpoint/rollback whole heap
Thread 1
Thread 2
Thread 3
Checkpoint
Start
Crochet
Collect roots
Install proxies
Establish invariants
Checkpoint
Done
Thread 1
61
Dynamic checkpoint/rollback
Crochet
Performance
avrora
batik
eclipse
fop h2 jython
luindex
lusearch
pmd
sunflow
tomcat
tradebeans
xalan
AVG
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
6.0
timetocomplete(normalizedtonative)
DaCapo Benchmark
Crochet Crochet C/R CRIU
63
Low overhead
71
Conclusion
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
41
E cient
lazy heap traversal
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
05 int proxy_mark = Unsafe.getLong(p, 0);
06 int proxy_klass = Unsafe.getLong(p, 4);
07 Unsafe.setLong( l , 4, proxy_klass );
08 assert(l instanceof $$ListProxy);
57
Stock JVM
Multithreading
I Crochet is thread-safe
I Operations use Compare-And-Swap to synchronize
I Rollback uses locks due to non-idempotent
I Root collection must be done with threads stopped
I Barrier-sync to checkpoint/rollback whole heap
Thread 1
Thread 2
Thread 3
Checkpoint
Start
Crochet
Collect roots
Install proxies
Establish invariants
Checkpoint
Done
Thread 1
61
Dynamic checkpoint/rollback
Crochet
Performance
avrora
batik
eclipse
fop h2 jython
luindex
lusearch
pmd
sunflow
tomcat
tradebeans
xalan
AVG
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
6.0
timetocomplete(normalizedtonative)
DaCapo Benchmark
Crochet Crochet C/R CRIU
63
Low overhead
Applications
I Checkpoint/Rollback
I Fuzz testing
I Code generation
I As application service
I etc
I Dynamic Software Update
I Proxies update objects lazily as reached after update
I Rubah
I Smalltalk become:
I a.become(b)
I All refs to a become refs to b, and vice-versa
I Proxies update refs lazily
I Dynamic AOP
I Proxies can add methods, enabling around advices
45
Many applications
72
Conclusion
Lazy Heap Traversal
v = 0
root
v = 0
A
v = 0
B
v = 0
C
v = 0
E
v = 0
F
v = 0
G
v = 0
H
v = 0
I
v = 0
J
Crochet.checkpoint()
root.method()
v = 1 v = 1
B.method()v = 1
B
v = 1
F.method()
v = 1
v = 1
F
Crochet.rollback()
root.method()
v = 2
v = 2
v = 2
v = 2
root
41
E cient
lazy heap traversal
Implementation
Proxy on/o
01 List l = new List ();
02 $$ListProxy p = new $$ListProxy ();
_mark _klass i next
_mark _klass i next
03 Field f = List.class.getField("i");
04 int off_i = Unsafe.getOffset(f); // 8
05 int proxy_mark = Unsafe.getLong(p, 0);
06 int proxy_klass = Unsafe.getLong(p, 4);
07 Unsafe.setLong( l , 4, proxy_klass );
08 assert(l instanceof $$ListProxy);
57
Stock JVM
Multithreading
I Crochet is thread-safe
I Operations use Compare-And-Swap to synchronize
I Rollback uses locks due to non-idempotent
I Root collection must be done with threads stopped
I Barrier-sync to checkpoint/rollback whole heap
Thread 1
Thread 2
Thread 3
Checkpoint
Start
Crochet
Collect roots
Install proxies
Establish invariants
Checkpoint
Done
Thread 1
61
Dynamic checkpoint/rollback
Crochet
Performance
avrora
batik
eclipse
fop h2 jython
luindex
lusearch
pmd
sunflow
tomcat
tradebeans
xalan
AVG
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
6.0
timetocomplete(normalizedtonative)
DaCapo Benchmark
Crochet Crochet C/R CRIU
63
Low overhead
Applications
I Checkpoint/Rollback
I Fuzz testing
I Code generation
I As application service
I etc
I Dynamic Software Update
I Proxies update objects lazily as reached after update
I Rubah
I Smalltalk become:
I a.become(b)
I All refs to a become refs to b, and vice-versa
I Proxies update refs lazily
I Dynamic AOP
I Proxies can add methods, enabling around advices
45
Many applications
Fork
us
on
G
itH
ub
73
Conclusion
Fork
us
on
G
itH
ub
Crochet
I No JVM changes
I Use bytecode rewriting and standard debug API
I E cient
I Copy-on-access through thread-safe lazy heap traversal
I Checkpoint/rollback dynamically
I Just barrier-sync threads
I Low overhead
I 6% when not using checkpoint/rollback, 49% otherwise
I Beats alternative approaches (CRIU, STM, DeepClone)
I Many applications
I Checkpoint/rollback in itself and to enable other techniques
I Specalized proxies for: become:, per-object dynamic AOP, etc.
I Get Crochet: https://github.com/gmu-swe/crochet
74

Contenu connexe

Tendances

Rust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineRust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineMatt Provost
 
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуdelimitry
 
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...Iosif Itkin
 
为什么 rust-lang 吸引我?
为什么 rust-lang 吸引我?为什么 rust-lang 吸引我?
为什么 rust-lang 吸引我?勇浩 赖
 
DIGITAL SIGNAL PROCESSING BASED ON MATLAB
DIGITAL SIGNAL PROCESSING BASED ON MATLABDIGITAL SIGNAL PROCESSING BASED ON MATLAB
DIGITAL SIGNAL PROCESSING BASED ON MATLABPrashant Srivastav
 
PyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutinePyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutineDaehee Kim
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...akaptur
 
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートIIopenFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートIIAtsushi Tadokoro
 
Антон Бикинеев, Writing good std::future&lt; C++ >
Антон Бикинеев, Writing good std::future&lt; C++ >Антон Бикинеев, Writing good std::future&lt; C++ >
Антон Бикинеев, Writing good std::future&lt; C++ >Sergey Platonov
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterakaptur
 
DDAA FPGA - Multiplexor De Numeros en Display 7 Segmentos En Tiempo
DDAA   FPGA - Multiplexor De Numeros en Display 7 Segmentos En TiempoDDAA   FPGA - Multiplexor De Numeros en Display 7 Segmentos En Tiempo
DDAA FPGA - Multiplexor De Numeros en Display 7 Segmentos En TiempoFernando Marcos Marcos
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++Seok-joon Yun
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
 
Anomalies in X-Ray Engine
Anomalies in X-Ray EngineAnomalies in X-Ray Engine
Anomalies in X-Ray EnginePVS-Studio
 
Easily mockingdependenciesinc++ 2
Easily mockingdependenciesinc++ 2Easily mockingdependenciesinc++ 2
Easily mockingdependenciesinc++ 2drewz lin
 
Unbearable Test Code Smell
Unbearable Test Code SmellUnbearable Test Code Smell
Unbearable Test Code SmellSteven Mak
 
Flashback, el primer malware masivo de sistemas Mac
Flashback, el primer malware masivo de sistemas MacFlashback, el primer malware masivo de sistemas Mac
Flashback, el primer malware masivo de sistemas MacESET Latinoamérica
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...akaptur
 

Tendances (20)

Rust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineRust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command Line
 
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
 
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
 
为什么 rust-lang 吸引我?
为什么 rust-lang 吸引我?为什么 rust-lang 吸引我?
为什么 rust-lang 吸引我?
 
DIGITAL SIGNAL PROCESSING BASED ON MATLAB
DIGITAL SIGNAL PROCESSING BASED ON MATLABDIGITAL SIGNAL PROCESSING BASED ON MATLAB
DIGITAL SIGNAL PROCESSING BASED ON MATLAB
 
PyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutinePyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into Coroutine
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
 
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートIIopenFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
 
Антон Бикинеев, Writing good std::future&lt; C++ >
Антон Бикинеев, Writing good std::future&lt; C++ >Антон Бикинеев, Writing good std::future&lt; C++ >
Антон Бикинеев, Writing good std::future&lt; C++ >
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
 
Lisp
LispLisp
Lisp
 
DDAA FPGA - Multiplexor De Numeros en Display 7 Segmentos En Tiempo
DDAA   FPGA - Multiplexor De Numeros en Display 7 Segmentos En TiempoDDAA   FPGA - Multiplexor De Numeros en Display 7 Segmentos En Tiempo
DDAA FPGA - Multiplexor De Numeros en Display 7 Segmentos En Tiempo
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++
 
OpenGL Starter L02
OpenGL Starter L02OpenGL Starter L02
OpenGL Starter L02
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScript
 
Anomalies in X-Ray Engine
Anomalies in X-Ray EngineAnomalies in X-Ray Engine
Anomalies in X-Ray Engine
 
Easily mockingdependenciesinc++ 2
Easily mockingdependenciesinc++ 2Easily mockingdependenciesinc++ 2
Easily mockingdependenciesinc++ 2
 
Unbearable Test Code Smell
Unbearable Test Code SmellUnbearable Test Code Smell
Unbearable Test Code Smell
 
Flashback, el primer malware masivo de sistemas Mac
Flashback, el primer malware masivo de sistemas MacFlashback, el primer malware masivo de sistemas Mac
Flashback, el primer malware masivo de sistemas Mac
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
 

Similaire à CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)

How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITEgor Bogatov
 
Kotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKirill Rozov
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesAndrey Karpov
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerJAX London
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Michael Barker
 
Coroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewCoroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewDmytro Zaitsev
 
Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.UA Mobile
 
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...DevGAMM Conference
 
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019corehard_by
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For GoogleEleanor McHugh
 
How do I modify this code in order to create a rotating pyramid instea.pdf
How do I modify this code in order to create a rotating pyramid instea.pdfHow do I modify this code in order to create a rotating pyramid instea.pdf
How do I modify this code in order to create a rotating pyramid instea.pdfkrishnac481
 
The TclQuadcode Compiler
The TclQuadcode CompilerThe TclQuadcode Compiler
The TclQuadcode CompilerDonal Fellows
 
Hypercritical C++ Code Review
Hypercritical C++ Code ReviewHypercritical C++ Code Review
Hypercritical C++ Code ReviewAndrey Karpov
 
Introduction to Verilog & code coverage
Introduction to Verilog & code coverageIntroduction to Verilog & code coverage
Introduction to Verilog & code coverageJyun-Kai Hu
 
clegoues-pwlconf-sept16-asPDF.pdf
clegoues-pwlconf-sept16-asPDF.pdfclegoues-pwlconf-sept16-asPDF.pdf
clegoues-pwlconf-sept16-asPDF.pdfaoecmtin
 
Virtual machines - how they work
Virtual machines - how they workVirtual machines - how they work
Virtual machines - how they workBartosz Sypytkowski
 
Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...
Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...
Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...Security Session
 

Similaire à CROCHET - Checkpoint Rollback in JVM (ECOOP 2018) (20)

How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJIT
 
Kotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is coming
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
 
Marat-Slides
Marat-SlidesMarat-Slides
Marat-Slides
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael Barker
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!
 
Coroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewCoroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth review
 
Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.
 
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
 
Vcs8
Vcs8Vcs8
Vcs8
 
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
 
How do I modify this code in order to create a rotating pyramid instea.pdf
How do I modify this code in order to create a rotating pyramid instea.pdfHow do I modify this code in order to create a rotating pyramid instea.pdf
How do I modify this code in order to create a rotating pyramid instea.pdf
 
The TclQuadcode Compiler
The TclQuadcode CompilerThe TclQuadcode Compiler
The TclQuadcode Compiler
 
Hypercritical C++ Code Review
Hypercritical C++ Code ReviewHypercritical C++ Code Review
Hypercritical C++ Code Review
 
Introduction to Verilog & code coverage
Introduction to Verilog & code coverageIntroduction to Verilog & code coverage
Introduction to Verilog & code coverage
 
clegoues-pwlconf-sept16-asPDF.pdf
clegoues-pwlconf-sept16-asPDF.pdfclegoues-pwlconf-sept16-asPDF.pdf
clegoues-pwlconf-sept16-asPDF.pdf
 
Virtual machines - how they work
Virtual machines - how they workVirtual machines - how they work
Virtual machines - how they work
 
Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...
Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...
Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...
 
hw-sol.pdf
hw-sol.pdfhw-sol.pdf
hw-sol.pdf
 

Plus de jon_bell

Replay without Recording of Production Bugs for Service Oriented Applications
Replay without Recording of Production Bugs for Service Oriented ApplicationsReplay without Recording of Production Bugs for Service Oriented Applications
Replay without Recording of Production Bugs for Service Oriented Applicationsjon_bell
 
A Large-Scale Study of Test Coverage Evolution
A Large-Scale Study of Test Coverage EvolutionA Large-Scale Study of Test Coverage Evolution
A Large-Scale Study of Test Coverage Evolutionjon_bell
 
Efficient Dependency Detection for Safe Java Test Acceleration
Efficient Dependency Detection for Safe Java Test AccelerationEfficient Dependency Detection for Safe Java Test Acceleration
Efficient Dependency Detection for Safe Java Test Accelerationjon_bell
 
Phosphor: Illuminating Dynamic Data Flow in Commodity JVMs
Phosphor: Illuminating Dynamic Data Flow in Commodity JVMsPhosphor: Illuminating Dynamic Data Flow in Commodity JVMs
Phosphor: Illuminating Dynamic Data Flow in Commodity JVMsjon_bell
 
ICSE 2014: Unit Test Virtualization with VMVM
ICSE 2014: Unit Test Virtualization with VMVMICSE 2014: Unit Test Virtualization with VMVM
ICSE 2014: Unit Test Virtualization with VMVMjon_bell
 
Unit Test Virtualization: Optimizing Testing Time
Unit Test Virtualization: Optimizing Testing TimeUnit Test Virtualization: Optimizing Testing Time
Unit Test Virtualization: Optimizing Testing Timejon_bell
 
Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...
Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...
Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...jon_bell
 
A Large-Scale, Longitudinal Study of User Profiles in World of Warcraft
A Large-Scale, Longitudinal Study of User Profiles in World of WarcraftA Large-Scale, Longitudinal Study of User Profiles in World of Warcraft
A Large-Scale, Longitudinal Study of User Profiles in World of Warcraftjon_bell
 

Plus de jon_bell (8)

Replay without Recording of Production Bugs for Service Oriented Applications
Replay without Recording of Production Bugs for Service Oriented ApplicationsReplay without Recording of Production Bugs for Service Oriented Applications
Replay without Recording of Production Bugs for Service Oriented Applications
 
A Large-Scale Study of Test Coverage Evolution
A Large-Scale Study of Test Coverage EvolutionA Large-Scale Study of Test Coverage Evolution
A Large-Scale Study of Test Coverage Evolution
 
Efficient Dependency Detection for Safe Java Test Acceleration
Efficient Dependency Detection for Safe Java Test AccelerationEfficient Dependency Detection for Safe Java Test Acceleration
Efficient Dependency Detection for Safe Java Test Acceleration
 
Phosphor: Illuminating Dynamic Data Flow in Commodity JVMs
Phosphor: Illuminating Dynamic Data Flow in Commodity JVMsPhosphor: Illuminating Dynamic Data Flow in Commodity JVMs
Phosphor: Illuminating Dynamic Data Flow in Commodity JVMs
 
ICSE 2014: Unit Test Virtualization with VMVM
ICSE 2014: Unit Test Virtualization with VMVMICSE 2014: Unit Test Virtualization with VMVM
ICSE 2014: Unit Test Virtualization with VMVM
 
Unit Test Virtualization: Optimizing Testing Time
Unit Test Virtualization: Optimizing Testing TimeUnit Test Virtualization: Optimizing Testing Time
Unit Test Virtualization: Optimizing Testing Time
 
Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...
Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...
Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...
 
A Large-Scale, Longitudinal Study of User Profiles in World of Warcraft
A Large-Scale, Longitudinal Study of User Profiles in World of WarcraftA Large-Scale, Longitudinal Study of User Profiles in World of Warcraft
A Large-Scale, Longitudinal Study of User Profiles in World of Warcraft
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 

Dernier (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)

  • 1. Crochet: Checkpoint and Rollback via Lightweight Heap Traversal on Stock JVMs Jonathan Bell and Luís Pina {bellj / lpina2}@gmu.edu George Mason University European Conference on Object-Oriented Programming July 20, 2018
  • 2. Fuzzing a method 01 02 String cmd ; 03 04 ... // Lots of uninteresting code 05 06 07 08 methodToFuzz(cmd); 09 10 11 12 13 14 15 2
  • 3. Fuzzing a method 01 02 String cmd ; 03 04 ... // Lots of uninteresting code 05 while (true) { 06 cmd = mutate(cmd); 07 08 methodToFuzz(cmd); 09 10 11 12 } 13 14 15 3
  • 4. Fuzzing a method 01 02 String cmd ; 03 04 ... // Lots of uninteresting code 05 while (true) { 06 cmd = mutate(cmd); 07 try { 08 methodToFuzz(cmd); 09 } catch (Throwable t) { 10 generateTest(cmd); 11 } 12 } 13 14 15 4
  • 5. Fuzzing a method Example test generateTest("SET key val") 5
  • 6. Fuzzing a method Example test generateTest("SET key val") methodToFuzz("SET key val") 6
  • 7. Fuzzing a method Example test generateTest("SET key val") methodToFuzz("SET key val") 3 7
  • 8. Fuzzing a method Example test generateTest("SET key val") methodToFuzz("SET key val") 3 8
  • 9. Fuzzing a method State is a problem Bu er: methodToFuzz("SET key val") SET key val 9
  • 10. Fuzzing a method State is a problem Bu er: methodToFuzz("SET key val") SET key val methodToFuzz("SET key val") SET key val 10
  • 11. Fuzzing a method State is a problem Bu er: methodToFuzz("SET key val") SET key val methodToFuzz("SET key val") SET key val methodToFuzz("SET key val") SET key val 7 11
  • 12. Fuzzing a method State is a problem Bu er: methodToFuzz("SET key val") SET key val methodToFuzz("SET key val") SET key val methodToFuzz("SET key val") SET key val 7 generateTest("SET key val") 12
  • 13. Fuzzing a method Restart with fresh state Native Restart 0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0timetocomplete(sec) 41.52 78.33 Short fuzz run (110 FTP commands) 13
  • 20. Checkpoint/Rollback Bu er: checkpoint methodToFuzz("SET key val") rollback methodToFuzz("SET key val") 20
  • 21. Checkpoint/Rollback Bu er: Crochet.checkpoint() methodToFuzz("SET key val") Crochet.rollback() methodToFuzz("SET key val") Crochet I No JVM changes (Excludes fork) I Checkpoint/rollback dynamically I E cient (Excludes CRIU) I Low overhead (Excludes STMs) 21
  • 22. Crochet E cient DeepClone CRIU CROCHET Checkpoint Technique 1.0 1.1 1.2 1.3 1.4 1.5 1.6Timetocomplete(normalizedtonative) Access percent of TreeMap after checkpoint 10% 25% 50% 100% 22
  • 23. Checkpoint/Rollback Bu er: Crochet.checkpoint() methodToFuzz("SET key val") Crochet.rollback() methodToFuzz("SET key val") Crochet I No JVM changes (Excludes fork) I Checkpoint/rollback dynamically I E cient (Excludes CRIU) I Low overhead (Excludes STMs) 23
  • 24. Crochet Low overhead Native Restart Crochet Crochet c/r 0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0timetocomplete(sec) 41.52 78.33 42.69 43.77 Short fuzz run (110 FTP commands) 24
  • 25. Checkpoint/Rollback Bu er: Crochet.checkpoint() methodToFuzz("SET key val") Crochet.rollback() methodToFuzz("SET key val") Crochet I No JVM changes (Excludes fork) I Checkpoint/rollback dynamically I E cient (Excludes CRIU) I Low overhead (Excludes STMs) 25
  • 26. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() 26
  • 27. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 27
  • 28. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root.method() 28
  • 29. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root v = 1 root.method() 29
  • 30. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root v = 1 root.method() v = 1 v = 1 v = 1 30
  • 31. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root root.method() v = 1 v = 1 v = 1 31
  • 32. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root root.method() v = 1 v = 1 v = 1 B.method() 32
  • 33. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root root.method() v = 1 v = 1 B.method()v = 1 B v = 1 v = 1 33
  • 34. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root root.method() v = 1 v = 1 B.method()v = 1 B v = 1 v = 1 F.method() 34
  • 35. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F 35
  • 36. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() 36
  • 37. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() v = 2 37
  • 38. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint()v = 1 root root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() v = 2 root.method() 38
  • 39. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() v = 2 root.method() 39
  • 40. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 40
  • 41. Lazy Heap Traversal Tracked object information: Version 0, 1, . . . Snapshot Object state to-be-restored, if any State normal or proxy (Checkpoint/Rollback) Invariants: 1. Identity: Versions are unique 2. Total Order: Versions increase monotonically 3. Continuity: Proxies mediate access during traversal 41
  • 42. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 42
  • 43. Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 43
  • 44. Applications I Checkpoint/Rollback I Fuzz testing I Code generation I Debugging I As application service I Dynamic Software Update I Proxies update objects lazily as reached after update I Rubah I Smalltalk become: I a.become(b) I All refs to a become refs to b, and vice-versa I Proxies update refs lazily I Dynamic AOP I Proxies can add methods, enabling around advices I Per object point-cuts 44
  • 45. Goals Crochet I No JVM changes (Excludes fork) I E cient (Excludes CRIU) 3 I Checkpoint/rollback dynamically I Low overhead (Excludes STMs) 45
  • 46. Implementation Bytecode rewriting 01 class List { 02 List next; int i; 03 04 int sum() 05 { return i + next.sum(); } 06 07 08 09 10 11 12 13 } 46
  • 47. Implementation Bytecode rewriting 01 class List { 02 List next; int i; 03 04 int sum() 05 { return i + next.sum(); } 06 07 List $$snapshot; int $$version; // But no status! 08 09 10 11 12 13 } 47
  • 48. Implementation Bytecode rewriting 01 class List { 02 List next; int i; 03 04 int sum() 05 { return i + next.sum(); } 06 07 List $$snapshot; int $$version; // But no status! 08 void $$onReadWrite(); // Empty 09 void $$onCheckpoint(int version); // Turn into proxy 10 void $$onRollback(int version); // Turn into proxy 11 12 void $$copyFieldsTo(List dest); 13 } 48
  • 49. Implementation Bytecode rewriting 01 class List { 02 List next; int i; 03 04 int sum() 05 { next.$$onReadWrite(); return i + next.sum(); } 06 07 List $$snapshot; int $$version; // But no status! 08 void $$onReadWrite(); // Empty 09 void $$onCheckpoint(int version); // Turn into proxy 10 void $$onRollback(int version); // Turn into proxy 11 12 void $$copyFieldsTo(List dest); 13 } 49
  • 50. Implementation Proxies 01 class $$ListProxy extends List { 02 // No extra fields => Proxy has same size 03 04 05 06 07 08 09 void $$onReadWrite(); // Snap, propagate, revert proxy 10 void $$onCheckpoint(int version); // Update version 11 void $$onRollback(int version); // Update version 12 13 14 } 50
  • 51. Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); 51
  • 52. Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 52
  • 53. Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 53
  • 54. Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 05 int proxy_mark = Unsafe.getInt(p, 0); 06 int proxy_klass = Unsafe.getInt(p, 4); 54
  • 55. Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 05 int proxy_mark = Unsafe.getInt(p, 0); 06 int proxy_klass = Unsafe.getInt(p, 4); 07 Unsafe.setInt( l , 4, proxy_klass ); 08 assert(l instanceof $$ListProxy); 55
  • 56. Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 05 int proxy_mark = Unsafe.getInt(p, 0); 06 int proxy_klass = Unsafe.getInt(p, 4); 07 Unsafe.setInt( l , 4, proxy_klass ); 08 assert(l instanceof $$ListProxy); 56
  • 57. Goals Crochet I No JVM changes (Excludes fork) 3 I E cient (Excludes CRIU) 3 I Checkpoint/rollback dynamically I Low overhead (Excludes STMs) 58
  • 58. Root reference collection I Static fields of loaded classes I Instrument class loading I Live thread objects I Instrument thread creation I Call stack (function args, local vars) I Use standard debugger API I Operand stack (bytecode instruction operands) I Tricky, gets compiled away I Instrument end of basic blocks to dump current stack when a special flag is set 59
  • 59. Multithreading I Crochet is thread-safe I Operations use Compare-And-Swap to synchronize I Rollback not idempotent, needs locks I Root collection must be done with threads stopped I Barrier-sync to checkpoint/rollback whole heap Thread 1 Thread 2 Thread 3 Checkpoint Start Crochet Collect roots Install proxies Establish invariants Checkpoint Done Thread 1 60
  • 60. Goals Crochet I No JVM changes (Excludes fork) 3 I E cient (Excludes CRIU) 3 I Checkpoint/rollback dynamically 3 I Low overhead (Excludes STMs) 61
  • 65. Goals Crochet I No JVM changes (Excludes fork) 3 I E cient (Excludes CRIU) 3 I Checkpoint/rollback dynamically 3 I Low overhead (Excludes STMs) 3 66
  • 66. Crochet Limitations I Not checkpointed/rolled-back: I Native code and references only held inside native code I Class loaders I State kept outside of the JVM (e.g., files, sockets) I Reliance on “unsupported” sun.misc.Unsafe I Eager checkpoint/rollback of arrays and some classes (e.g., java.lang.Exception) 67
  • 67. Conclusion Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 41 E cient lazy heap traversal 68
  • 68. Conclusion Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 41 E cient lazy heap traversal Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 05 int proxy_mark = Unsafe.getLong(p, 0); 06 int proxy_klass = Unsafe.getLong(p, 4); 07 Unsafe.setLong( l , 4, proxy_klass ); 08 assert(l instanceof $$ListProxy); 57 Stock JVM 69
  • 69. Conclusion Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 41 E cient lazy heap traversal Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 05 int proxy_mark = Unsafe.getLong(p, 0); 06 int proxy_klass = Unsafe.getLong(p, 4); 07 Unsafe.setLong( l , 4, proxy_klass ); 08 assert(l instanceof $$ListProxy); 57 Stock JVM Multithreading I Crochet is thread-safe I Operations use Compare-And-Swap to synchronize I Rollback uses locks due to non-idempotent I Root collection must be done with threads stopped I Barrier-sync to checkpoint/rollback whole heap Thread 1 Thread 2 Thread 3 Checkpoint Start Crochet Collect roots Install proxies Establish invariants Checkpoint Done Thread 1 61 Dynamic checkpoint/rollback 70
  • 70. Conclusion Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 41 E cient lazy heap traversal Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 05 int proxy_mark = Unsafe.getLong(p, 0); 06 int proxy_klass = Unsafe.getLong(p, 4); 07 Unsafe.setLong( l , 4, proxy_klass ); 08 assert(l instanceof $$ListProxy); 57 Stock JVM Multithreading I Crochet is thread-safe I Operations use Compare-And-Swap to synchronize I Rollback uses locks due to non-idempotent I Root collection must be done with threads stopped I Barrier-sync to checkpoint/rollback whole heap Thread 1 Thread 2 Thread 3 Checkpoint Start Crochet Collect roots Install proxies Establish invariants Checkpoint Done Thread 1 61 Dynamic checkpoint/rollback Crochet Performance avrora batik eclipse fop h2 jython luindex lusearch pmd sunflow tomcat tradebeans xalan AVG 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 timetocomplete(normalizedtonative) DaCapo Benchmark Crochet Crochet C/R CRIU 63 Low overhead 71
  • 71. Conclusion Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 41 E cient lazy heap traversal Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 05 int proxy_mark = Unsafe.getLong(p, 0); 06 int proxy_klass = Unsafe.getLong(p, 4); 07 Unsafe.setLong( l , 4, proxy_klass ); 08 assert(l instanceof $$ListProxy); 57 Stock JVM Multithreading I Crochet is thread-safe I Operations use Compare-And-Swap to synchronize I Rollback uses locks due to non-idempotent I Root collection must be done with threads stopped I Barrier-sync to checkpoint/rollback whole heap Thread 1 Thread 2 Thread 3 Checkpoint Start Crochet Collect roots Install proxies Establish invariants Checkpoint Done Thread 1 61 Dynamic checkpoint/rollback Crochet Performance avrora batik eclipse fop h2 jython luindex lusearch pmd sunflow tomcat tradebeans xalan AVG 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 timetocomplete(normalizedtonative) DaCapo Benchmark Crochet Crochet C/R CRIU 63 Low overhead Applications I Checkpoint/Rollback I Fuzz testing I Code generation I As application service I etc I Dynamic Software Update I Proxies update objects lazily as reached after update I Rubah I Smalltalk become: I a.become(b) I All refs to a become refs to b, and vice-versa I Proxies update refs lazily I Dynamic AOP I Proxies can add methods, enabling around advices 45 Many applications 72
  • 72. Conclusion Lazy Heap Traversal v = 0 root v = 0 A v = 0 B v = 0 C v = 0 E v = 0 F v = 0 G v = 0 H v = 0 I v = 0 J Crochet.checkpoint() root.method() v = 1 v = 1 B.method()v = 1 B v = 1 F.method() v = 1 v = 1 F Crochet.rollback() root.method() v = 2 v = 2 v = 2 v = 2 root 41 E cient lazy heap traversal Implementation Proxy on/o 01 List l = new List (); 02 $$ListProxy p = new $$ListProxy (); _mark _klass i next _mark _klass i next 03 Field f = List.class.getField("i"); 04 int off_i = Unsafe.getOffset(f); // 8 05 int proxy_mark = Unsafe.getLong(p, 0); 06 int proxy_klass = Unsafe.getLong(p, 4); 07 Unsafe.setLong( l , 4, proxy_klass ); 08 assert(l instanceof $$ListProxy); 57 Stock JVM Multithreading I Crochet is thread-safe I Operations use Compare-And-Swap to synchronize I Rollback uses locks due to non-idempotent I Root collection must be done with threads stopped I Barrier-sync to checkpoint/rollback whole heap Thread 1 Thread 2 Thread 3 Checkpoint Start Crochet Collect roots Install proxies Establish invariants Checkpoint Done Thread 1 61 Dynamic checkpoint/rollback Crochet Performance avrora batik eclipse fop h2 jython luindex lusearch pmd sunflow tomcat tradebeans xalan AVG 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 timetocomplete(normalizedtonative) DaCapo Benchmark Crochet Crochet C/R CRIU 63 Low overhead Applications I Checkpoint/Rollback I Fuzz testing I Code generation I As application service I etc I Dynamic Software Update I Proxies update objects lazily as reached after update I Rubah I Smalltalk become: I a.become(b) I All refs to a become refs to b, and vice-versa I Proxies update refs lazily I Dynamic AOP I Proxies can add methods, enabling around advices 45 Many applications Fork us on G itH ub 73
  • 73. Conclusion Fork us on G itH ub Crochet I No JVM changes I Use bytecode rewriting and standard debug API I E cient I Copy-on-access through thread-safe lazy heap traversal I Checkpoint/rollback dynamically I Just barrier-sync threads I Low overhead I 6% when not using checkpoint/rollback, 49% otherwise I Beats alternative approaches (CRIU, STM, DeepClone) I Many applications I Checkpoint/rollback in itself and to enable other techniques I Specalized proxies for: become:, per-object dynamic AOP, etc. I Get Crochet: https://github.com/gmu-swe/crochet 74