A Case for "Piggyback" Runtime Monitoring

147
THE FOLLOWING HAS BEEN APPROVED FOR TALK OPEN-MINDED AUDIENCES THE FOLLOWING HAS BEEN APPROVED FOR TALK OPEN-MINDED AUDIENCES R R S SCIENTIFIC RESEARCH CONTENT CONTROVERSIAL IDEAS, CONJECTURES BACKED BY PRELIMINARY EXPERIMENTAL DATA S SCIENTIFIC RESEARCH CONTENT CONTROVERSIAL IDEAS, CONJECTURES BACKED BY PRELIMINARY EXPERIMENTAL DATA

description

A runtime monitor enforcing a constraint on sequences of method calls on an object must keep track of the state of the sequence by updating an appropriate state machine. The present paper stems from the observation that an object's member fields must already contain an encoding of that state machine, and that a monitor essentially duplicates operations that the object performs internally. Rather than maintain a state machine in parallel, the paper puts forward the concept of "piggyback" runtime monitoring, where the monitor relies as much as possible on the object's own state variables to perform its task. Experiments on real-world benchmarks show that this approach greatly simplifies the monitoring process and drastically reduces the incurred runtime overhead compared to classical solutions.

Transcript of A Case for "Piggyback" Runtime Monitoring

Page 1: A Case for "Piggyback" Runtime Monitoring

THE FOLLOWING HAS BEEN APPROVED FORTALKOPEN-MINDED AUDIENCES

THE FOLLOWING HAS BEEN APPROVED FORTALKOPEN-MINDED AUDIENCES

RR

S SCIENTIFIC RESEARCH CONTENT

CONTROVERSIAL IDEAS, CONJECTURESBACKED BY PRELIMINARY EXPERIMENTAL DATA

S SCIENTIFIC RESEARCH CONTENT

CONTROVERSIAL IDEAS, CONJECTURESBACKED BY PRELIMINARY EXPERIMENTAL DATA

Page 2: A Case for "Piggyback" Runtime Monitoring

PrologueWhat Plato taught us

Page 3: A Case for "Piggyback" Runtime Monitoring
Page 4: A Case for "Piggyback" Runtime Monitoring
Page 5: A Case for "Piggyback" Runtime Monitoring
Page 6: A Case for "Piggyback" Runtime Monitoring

A Case for "Piggyback"Runtime Monitoring

Raphaël Tremblay-Lessard and Sylvain Hallé

Laboratoire d'informatique formelleUniversité du Québec à Chicoutimi, Canada

Fonds de recherchesur la natureet les technologies

CRSNGNSERC

Page 7: A Case for "Piggyback" Runtime Monitoring
Page 8: A Case for "Piggyback" Runtime Monitoring

System

Page 9: A Case for "Piggyback" Runtime Monitoring

System

Page 10: A Case for "Piggyback" Runtime Monitoring

System

Instrumentation

Page 11: A Case for "Piggyback" Runtime Monitoring

System

Instrumentation

Page 12: A Case for "Piggyback" Runtime Monitoring

System

Instrumentation

Trace

Page 13: A Case for "Piggyback" Runtime Monitoring

System

Instrumentation

Trace

Events

Page 14: A Case for "Piggyback" Runtime Monitoring

System

Instrumentation

Trace

Events

Page 15: A Case for "Piggyback" Runtime Monitoring

System

Instrumentation

Trace

Events

Tracevalidation

Page 16: A Case for "Piggyback" Runtime Monitoring

System

Instrumentation

Page 17: A Case for "Piggyback" Runtime Monitoring

System

Runtime monitoringInstrumentation

Page 18: A Case for "Piggyback" Runtime Monitoring

System

Runtime monitoringInstrumentation

Page 19: A Case for "Piggyback" Runtime Monitoring

System

Runtime monitoring

Overhead

Instrumentation

Page 20: A Case for "Piggyback" Runtime Monitoring

We consider a set A of method calls on a

single instance of some class C

Page 21: A Case for "Piggyback" Runtime Monitoring

We consider a set A of method calls on a

single instance of some class C

C distinguishes between “valid” and

“invalid” sequences of method calls in A

Page 22: A Case for "Piggyback" Runtime Monitoring

We consider a set A of method calls on a

single instance of some class C

C distinguishes between “valid” and

“invalid” sequences of method calls in A

C is deterministic: for every sequence

m ∈ A*, m is either always valid or

always invalid

Page 23: A Case for "Piggyback" Runtime Monitoring
Page 24: A Case for "Piggyback" Runtime Monitoring
Page 25: A Case for "Piggyback" Runtime Monitoring
Page 26: A Case for "Piggyback" Runtime Monitoring

→∧( )

Page 27: A Case for "Piggyback" Runtime Monitoring

→∧( )

→∨( )∅ X

Page 28: A Case for "Piggyback" Runtime Monitoring
Page 29: A Case for "Piggyback" Runtime Monitoring
Page 30: A Case for "Piggyback" Runtime Monitoring

My car leaves

Page 31: A Case for "Piggyback" Runtime Monitoring

Mailman delivers mail

Page 32: A Case for "Piggyback" Runtime Monitoring

Neighbor picks mail

Page 33: A Case for "Piggyback" Runtime Monitoring

My car returns

Page 34: A Case for "Piggyback" Runtime Monitoring
Page 35: A Case for "Piggyback" Runtime Monitoring

*

*

*

Error

Page 36: A Case for "Piggyback" Runtime Monitoring

Iterator<T>

Page 37: A Case for "Piggyback" Runtime Monitoring

Iterator<T>

hasNext

next

Page 38: A Case for "Piggyback" Runtime Monitoring

Iterator<T>

hasNext

next

hasNext

next

hasNext

Page 39: A Case for "Piggyback" Runtime Monitoring
Page 40: A Case for "Piggyback" Runtime Monitoring

Open for read

CloseRead

WriteOpen for write

Close

Page 41: A Case for "Piggyback" Runtime Monitoring

class MyHouse {

boolean isHome = false; boolean hasMail = false;

public void carLeaves() { isHome = false; } public void carReturns() { isHome = true; } public void mailman() { hasMail = true; } public void pickMail() { if (hasMail && !isHome) hasMail = false; else Do Something Bad; }}

Page 42: A Case for "Piggyback" Runtime Monitoring

There exists a minimal DFA M = 〈Q,q₀,δ〉such that ℒ(M) = all valid sequences of

method calls in A

Page 43: A Case for "Piggyback" Runtime Monitoring

Let q = q₀Wait for method call m ∈ ALet q = δ(q, m)

If q = then raise error

Else goto 2

1

2

3

4

5

Page 44: A Case for "Piggyback" Runtime Monitoring

m1.carLeaves();

m2.mailman();

m1.pickMail();

MyProgram:

. . .

Page 45: A Case for "Piggyback" Runtime Monitoring

m1.carLeaves();

m2.mailman();

m1.pickMail();

MyProgram:

. . .

aspect Monitor (MyHouse m) { int state = 0;

pointcut before carLeaves() { if (state == 0) state = 1; } pointcut before carReturns() { if (state == 1) state = 0; } pointcut before mailman() { if (state == 1) state = 2; } pointcut before pickMail() { if (state == 2) state = 1; }

Page 46: A Case for "Piggyback" Runtime Monitoring

m1.carLeaves();

m2.mailman();

m1.pickMail();

MyProgram:

. . .

aspect Monitor (MyHouse m) { int state = 0;

pointcut before carLeaves() { if (state == 0) state = 1; } pointcut before carReturns() { if (state == 1) state = 0; } pointcut before mailman() { if (state == 1) state = 2; } pointcut before pickMail() { if (state == 2) state = 1; }

Page 47: A Case for "Piggyback" Runtime Monitoring

Non-intrusive...

...but "memoryful" (must persist q)

Lots of events to watch

Page 48: A Case for "Piggyback" Runtime Monitoring

OVERHEAD

Page 49: A Case for "Piggyback" Runtime Monitoring
Page 50: A Case for "Piggyback" Runtime Monitoring

Neighbor about to pick mail

Page 51: A Case for "Piggyback" Runtime Monitoring

?

Is there a car?

Page 52: A Case for "Piggyback" Runtime Monitoring

?

Is there mailin the box?

Page 53: A Case for "Piggyback" Runtime Monitoring

Key point

Page 54: A Case for "Piggyback" Runtime Monitoring

Key point

Don't observemethod calls...

Page 55: A Case for "Piggyback" Runtime Monitoring

Key point

Don't observemethod calls...

...query the object'sstate directly !

??

Page 56: A Case for "Piggyback" Runtime Monitoring

class MyHouse {

boolean isHome = false; boolean hasMail = false;

public void carLeaves() { isHome = false; } public void carReturns() { isHome = true; } public void mailman() { hasMail = true; } public void pickMail() { if (hasMail && !isHome) hasMail = false; else Do Something Bad; }}

aspect Monitor (MyHouse m) { int state = 0;

pointcut before carLeaves() { if (state == 0) state = 1; } pointcut before carReturns() { if (state == 1) state = 0; } pointcut before mailman() { if (state == 1) state = 2; } pointcut before pickMail() { if (state == 2) state = 1; }

Page 57: A Case for "Piggyback" Runtime Monitoring

class MyHouse {

boolean isHome = false; boolean hasMail = false;

public void carLeaves() { isHome = false; } public void carReturns() { isHome = true; } public void mailman() { hasMail = true; } public void pickMail() { if (hasMail && !isHome) hasMail = false; else Do Something Bad; }}

aspect Monitor (MyHouse m) {

pointcut before pickMail() { if (m.isHome || !m.hasMail) // Error }

Page 58: A Case for "Piggyback" Runtime Monitoring

class MyHouse {

boolean isHome = false; boolean hasMail = false;

public void carLeaves() { isHome = false; } public void carReturns() { isHome = true; } public void mailman() { hasMail = true; } public void pickMail() { if (hasMail && !isHome) hasMail = false; else Do Something Bad; }}

aspect Monitor (MyHouse m) {

pointcut before pickMail() { if (m.isHome || !m.hasMail) // Error }

No state to persist

Only one method to

watch

Same effect !

Page 59: A Case for "Piggyback" Runtime Monitoring

Key point (again)

The first monitor observes method calls to

deduce the object's current state

The second monitor rather "piggybacks"

on the object's own state

Page 60: A Case for "Piggyback" Runtime Monitoring

Key point (again)

The first monitor observes method calls to

deduce the object's current state

The second monitor rather "piggybacks"

on the object's own state

PIGGYBACK RUNTIMEMONITORING

Page 61: A Case for "Piggyback" Runtime Monitoring

On an Iterator i, method i.next() should

only be called...

Page 62: A Case for "Piggyback" Runtime Monitoring

On an Iterator i, method i.next() should

only be called...

if it immediately

follows i.hasNext()

Page 63: A Case for "Piggyback" Runtime Monitoring

On an Iterator i, method i.next() should

only be called...

if it immediately

follows i.hasNext()

if it has more elements

to enumerate

Page 64: A Case for "Piggyback" Runtime Monitoring

On an Iterator i, method i.next() should

only be called...

if it immediately

follows i.hasNext()

if it has more elements

to enumerate

history-based

Page 65: A Case for "Piggyback" Runtime Monitoring

On an Iterator i, method i.next() should

only be called...

if it immediately

follows i.hasNext()

if it has more elements

to enumerate

history-based state-based

Page 66: A Case for "Piggyback" Runtime Monitoring
Page 67: A Case for "Piggyback" Runtime Monitoring

Sequences ofmethod calls

Page 68: A Case for "Piggyback" Runtime Monitoring

Sequences ofmethod calls

Object'sstate

Page 69: A Case for "Piggyback" Runtime Monitoring

Wait a minute...

Page 70: A Case for "Piggyback" Runtime Monitoring

Does it work all

the time?

Wait a minute...

Page 71: A Case for "Piggyback" Runtime Monitoring

Let ~ be an equivalence relation between

two sequences m, m' ∈ A* of method

calls

Page 72: A Case for "Piggyback" Runtime Monitoring

Let ~ be an equivalence relation between

two sequences m, m' ∈ A* of method

calls

m ~ m' ⇔ for every m'' ∈ A*,

both mm'' and m'm'' are

either valid or invalid

[m] = equivalence class of m

Page 73: A Case for "Piggyback" Runtime Monitoring

Let S = { [m] : m ∈ A*}.

The relation ~ induces a transition

function ω : S × A → S ; namely

ω([m],m) = [mm]

C behaves like a deterministic

state machine O = 〈S,[ε],ω〉

Page 74: A Case for "Piggyback" Runtime Monitoring

a

b

b

ac

a

M

Page 75: A Case for "Piggyback" Runtime Monitoring

[m ]0

[m ]1

[m ]2[m ]4

[m ]3

[m ]5

[m ]6

[m ]7

[m ]8

[m ]9

[m ]10

[m ]11

[m ]12

[m ]12

a b

a

b

b

a

a

bc

b

c

ε

a

a

a

[m

a

a

b

b

ε

εO

a

b

b

ac

a

M

Page 76: A Case for "Piggyback" Runtime Monitoring

[m ]0

[m ]1

[m ]2[m ]4

[m ]3

[m ]5

[m ]6

[m ]7

[m ]8

[m ]9

[m ]10

[m ]11

[m ]12

[m ]12

a b

a

b

b

a

a

bc

b

c

ε

a

a

a

[m

a

a

b

b

ε

εO

a

b

b

ac

a

M

Page 77: A Case for "Piggyback" Runtime Monitoring

[m ]0

[m ]1

[m ]2[m ]4

[m ]3

[m ]5

[m ]6

[m ]7

[m ]8

[m ]9

[m ]10

[m ]11

[m ]12

[m ]12

a b

a

b

b

a

a

bc

b

c

ε

a

a

a

[m

a

a

b

b

ε

εO

a

b

b

ac

a

MAll states of Oare accounted for

No state of Ohas two colors

Page 78: A Case for "Piggyback" Runtime Monitoring

[m ]0

[m ]1

[m ]2[m ]4

[m ]3

[m ]5

[m ]6

[m ]7

[m ]8

[m ]9

[m ]10

[m ]11

[m ]12

[m ]12

a b

a

b

b

a

a

bc

b

c

ε

a

a

a

[m

a

a

b

b

ε

εO

a

b

b

ac

a

MAll states of Oare accounted for

No state of Ohas two colors

(δ is total)

(otherwise O and Mdisagree on some m)

Page 79: A Case for "Piggyback" Runtime Monitoring

[m ]0

[m ]1

[m ]2[m ]4

[m ]3

[m ]5

[m ]6

[m ]7

[m ]8

[m ]9

[m ]10

[m ]11

[m ]12

[m ]12

a b

a

b

b

a

a

bc

b

c

ε

a

a

a

[m

a

a

b

b

ε

εO

a

b

b

ac

a

MAll states of Oare accounted for

No state of Ohas two colors

(δ is total)

(otherwise O and Mdisagree on some m) (just take the color!)

There exists a mappingH : S→Q such that H is a graph homomorphism 〈S,ω〉 → 〈Q,δ〉

Page 80: A Case for "Piggyback" Runtime Monitoring

Wait for method call m ∈ AFetch s

Compute q = δ(H(s), m)

If q = then raise error

Else goto 1

1

2

3

4

5

Page 81: A Case for "Piggyback" Runtime Monitoring

Wait for method call m ∈ AFetch s

Compute q = δ(H(s), m)

If q = then raise error

Else goto 1

1

2

3

4

5

Memory-less (nothing to persist

between calls)

Only monitor calls that may

lead to

Page 82: A Case for "Piggyback" Runtime Monitoring

Collection of 13 different monitoring

properties in papers from 2001-2011

(java.util package: the “monitoring canon”)

Page 83: A Case for "Piggyback" Runtime Monitoring

Collection of 13 different monitoring

properties in papers from 2001-2011

(java.util package: the “monitoring canon”)

Given an Iterator i on a Collection c, i.next()

cannot follow any of c.add(), c.delete(), c.set()

Given an Iterator i, i.remove() should not be called

twice without a call to i.next() in between

Don’t use an InputStreamReader after its

InputStream was closed

. . .

Page 84: A Case for "Piggyback" Runtime Monitoring

Source code analysis of the OpenJDK 6

implementation of Java. Of the 13 properties

in the canon:

Page 85: A Case for "Piggyback" Runtime Monitoring

Source code analysis of the OpenJDK 6

implementation of Java. Of the 13 properties

in the canon:

10 can be piggyback-monitored

Page 86: A Case for "Piggyback" Runtime Monitoring

Source code analysis of the OpenJDK 6

implementation of Java. Of the 13 properties

in the canon:

10 can be piggyback-monitored

Remaining 3 either...

Page 87: A Case for "Piggyback" Runtime Monitoring

Source code analysis of the OpenJDK 6

implementation of Java. Of the 13 properties

in the canon:

10 can be piggyback-monitored

Remaining 3 either...

don't distinguish between

valid/invalid calls

Page 88: A Case for "Piggyback" Runtime Monitoring

Source code analysis of the OpenJDK 6

implementation of Java. Of the 13 properties

in the canon:

10 can be piggyback-monitored

Remaining 3 either...

don't distinguish between

valid/invalid calls

violate deterministic condition

Page 89: A Case for "Piggyback" Runtime Monitoring

Wait a minute...

Page 90: A Case for "Piggyback" Runtime Monitoring

How hard is it to

obtain H and s?

Wait a minute...

Page 91: A Case for "Piggyback" Runtime Monitoring

The graph homomorphismproblem

Page 92: A Case for "Piggyback" Runtime Monitoring

Finding an homomorphism H between

two directed graphs G and G' is NP-

complete.

The graph homomorphismproblem

Page 93: A Case for "Piggyback" Runtime Monitoring

Finding an homomorphism H between

two directed graphs G and G' is NP-

complete.

The graph homomorphismproblem

(Known result)

Page 94: A Case for "Piggyback" Runtime Monitoring

Finding an homomorphism H between

two directed graphs G and G' is NP-

complete.

The graph homomorphismproblem

(Known result)

Checking if a known H “works” is

polynomial⇒

Page 95: A Case for "Piggyback" Runtime Monitoring

Wait a minute...

Page 96: A Case for "Piggyback" Runtime Monitoring

class C int x; B b;...

Wait a minute...

Page 97: A Case for "Piggyback" Runtime Monitoring

class B float w; A a; int j; D d;

class C int x; B b;...

Wait a minute...

Page 98: A Case for "Piggyback" Runtime Monitoring

class A float z; int k;

class B float w; A a; int j; D d;

class C int x; B b;...

Wait a minute...

Page 99: A Case for "Piggyback" Runtime Monitoring

class D ...

class A float z; int k;

class B float w; A a; int j; D d;

class C int x; B b;...

Wait a minute...

Page 100: A Case for "Piggyback" Runtime Monitoring

class D ...

class A float z; int k;

class B float w; A a; int j; D d;

class C int x; B b;...

Wait a minute...

Page 101: A Case for "Piggyback" Runtime Monitoring

class D ...

class A float z; int k;

class B float w; A a; int j; D d;

class C int x; B b;...

How many fields are

involved?

Wait a minute...

Page 102: A Case for "Piggyback" Runtime Monitoring

Propert y REMOVE

Page 103: A Case for "Piggyback" Runtime Monitoring

Propert y REMOVE

Traditional version

Given an Iterator i, i.remove() should

not be called twice without a call to

i.next() in between

Page 104: A Case for "Piggyback" Runtime Monitoring

Propert y REMOVE

Traditional version

Given an Iterator i, i.remove() should

not be called twice without a call to

i.next() in between

Piggyback version

Given an Iterator i, in every call to

i.remove(), it must hold that i.lastRet

must not be equal to −1

Page 105: A Case for "Piggyback" Runtime Monitoring

Propert y REMOVE

Traditional version

Given an Iterator i, i.remove() should

not be called twice without a call to

i.next() in between

Piggyback version

Given an Iterator i, in every call to

i.remove(), it must hold that i.lastRet

must not be equal to −1

member fieldinvolved

1

Page 106: A Case for "Piggyback" Runtime Monitoring

Propert y SAFE NUME

Page 107: A Case for "Piggyback" Runtime Monitoring

Propert y SAFE NUME

Traditional version

Given an Iterator i on a Collection c,

i.next() cannot follow any of c.add(),

c.delete(), c.set(), etc.

Page 108: A Case for "Piggyback" Runtime Monitoring

Propert y SAFE NUME

Traditional version

Given an Iterator i on a Collection c,

i.next() cannot follow any of c.add(),

c.delete(), c.set(), etc.

Piggyback version

Given an Itr i, in every call to i.next(),

it must hold that i.expectedModCount is

equal to i$0.modCount

Page 109: A Case for "Piggyback" Runtime Monitoring

Propert y SAFE NUME

Traditional version

Given an Iterator i on a Collection c,

i.next() cannot follow any of c.add(),

c.delete(), c.set(), etc.

Piggyback version

Given an Itr i, in every call to i.next(),

it must hold that i.expectedModCount is

equal to i$0.modCount

member fieldsinvolved

2

Page 110: A Case for "Piggyback" Runtime Monitoring

With the OpenJDK 6, the 10 piggyback

properties involved at most _______

primitive member fields inside a class

Page 111: A Case for "Piggyback" Runtime Monitoring

With the OpenJDK 6, the 10 piggyback

properties involved at most _______

primitive member fields inside a class

2

Page 112: A Case for "Piggyback" Runtime Monitoring

With the OpenJDK 6, the 10 piggyback

properties involved at most _______

primitive member fields inside a class

at a level of nesting of at most _______

2

Page 113: A Case for "Piggyback" Runtime Monitoring

With the OpenJDK 6, the 10 piggyback

properties involved at most _______

primitive member fields inside a class

at a level of nesting of at most _______

2

1

Page 114: A Case for "Piggyback" Runtime Monitoring

With the OpenJDK 6, the 10 piggyback

properties involved at most _______

primitive member fields inside a class

at a level of nesting of at most _______

2

1

H is simple and shallow

Page 115: A Case for "Piggyback" Runtime Monitoring

With the OpenJDK 6, the 10 piggyback

properties involved at most _______

primitive member fields inside a class

at a level of nesting of at most _______

2

1

...but many fields are private and have

no accessor methods ☹

H is simple and shallow

Page 116: A Case for "Piggyback" Runtime Monitoring

Propert y SAFE ILE EADERF

Traditional version

Don’t use an InputStreamReader after its

InputStream was closed

Piggyback version

Given an InputStreamReader r, in every

call to r.read(), it must hold that

r.sd.isOpen is true

R

Page 117: A Case for "Piggyback" Runtime Monitoring

private

Propert y SAFE ILE EADERF

Traditional version

Don’t use an InputStreamReader after its

InputStream was closed

Piggyback version

Given an InputStreamReader r, in every

call to r.read(), it must hold that

r.sd.isOpen is true

R

Page 118: A Case for "Piggyback" Runtime Monitoring

class InputStreamReader {

private InputStream sd;

public boolean isStreamOpen() { return sd.isOpen(); }

...

}

class InputStream {

private boolean isOpen;

public boolean isOpen() { return isOpen; }

...

}

Page 119: A Case for "Piggyback" Runtime Monitoring

MISSING

class InputStreamReader {

private InputStream sd;

public boolean isStreamOpen() { return sd.isOpen(); }

...

}

class InputStream {

private boolean isOpen;

public boolean isOpen() { return isOpen; }

...

}

Page 120: A Case for "Piggyback" Runtime Monitoring

MISSING

MISSING

class InputStreamReader {

private InputStream sd;

public boolean isStreamOpen() { return sd.isOpen(); }

...

}

class InputStream {

private boolean isOpen;

public boolean isOpen() { return isOpen; }

...

}

Page 121: A Case for "Piggyback" Runtime Monitoring

class D ...

class A float z; int k;

class B float w; A a; int j; D d;

class C int x; B b;...

Wait a minute...

Page 122: A Case for "Piggyback" Runtime Monitoring

class D ...

class A float z; int k;

class B float w; A a; int j; D d;

class C int x; B b;...

private int x;

private int j;

private D d;

private

What about information

hiding?

Wait a minute...

Page 123: A Case for "Piggyback" Runtime Monitoring

“...one begins [to decompose a system] with a

list of difficult design decisions or design

decisions that are likely to change. Each

module is then designed to hide such a

decision from the others.”

― David Lodge Parnas, 1972

Page 124: A Case for "Piggyback" Runtime Monitoring

class InputStreamReader {

private InputStream sd;

public boolean isStreamOpen() { return sd.isOpen(); }

...

}

class InputStream {

private boolean isOpen;

public boolean isOpen() { return isOpen; }

...

}

Page 125: A Case for "Piggyback" Runtime Monitoring

Difficult design decision?

Likely to change?

class InputStreamReader {

private InputStream sd;

public boolean isStreamOpen() { return sd.isOpen(); }

...

}

class InputStream {

private boolean isOpen;

public boolean isOpen() { return isOpen; }

...

}

Page 126: A Case for "Piggyback" Runtime Monitoring

The member fields of C involved in

the homomorphism H should have

the same read access visibilit y as C

Page 127: A Case for "Piggyback" Runtime Monitoring

The member fields of C involved in

the homomorphism H should have

the same read access visibilit y as C

design for monitoring

Page 128: A Case for "Piggyback" Runtime Monitoring

The member fields of C involved in

the homomorphism H should have

the same read access visibilit y as C

design for monitoring (or just for correct use)

Page 129: A Case for "Piggyback" Runtime Monitoring

Wait a minute...

Page 130: A Case for "Piggyback" Runtime Monitoring

Is overhead actually

reduced ?

OVERHEAD

Wait a minute...

Page 131: A Case for "Piggyback" Runtime Monitoring

Runtime monitoring of the 10 piggyback

properties on the DaCapo benchmark

Set of open source, real world applications

with non-trivial memory load

Same benchmark used by past monitoring

papers

Page 132: A Case for "Piggyback" Runtime Monitoring

Benchmark error margin ≈ 3%

Page 133: A Case for "Piggyback" Runtime Monitoring

Benchmark error margin ≈ 3%

Piggyback memory overhead ≈ 0%

Page 134: A Case for "Piggyback" Runtime Monitoring

Benchmark error margin ≈ 3%

Piggyback memory overhead ≈ 0%

Piggyback runtime overhead ≈ 3%

Page 135: A Case for "Piggyback" Runtime Monitoring

Benchmark error margin ≈ 3%

Piggyback memory overhead ≈ 0%

Piggyback runtime overhead ≈ 3%

Benchmark

pmd

avrora

Runtime overhead (%)

Piggyback

≈ 0%

≈ 1%

Highlights:

Page 136: A Case for "Piggyback" Runtime Monitoring

Benchmark error margin ≈ 3%

Piggyback memory overhead ≈ 0%

Piggyback runtime overhead ≈ 3%

Benchmark

pmd

avrora

Runtime overhead (%)

Piggyback

≈ 0%

≈ 1%

Highlights:

Classical

≈ 123%

≈ 118%

Page 137: A Case for "Piggyback" Runtime Monitoring

EpilogueConclusion and future work

Page 138: A Case for "Piggyback" Runtime Monitoring

Piggyback runtime monitoring uses an

object's own, existing member fields as an

encoding of the monitor's state

Under some conditions, this encoding is

guaranteed to exist

Stateful properties become stateless

properties ; no data to persist between calls

Page 139: A Case for "Piggyback" Runtime Monitoring

Emprical evidence on real-world

benchmarks on the OpenJDK 6 reveal

that:

Page 140: A Case for "Piggyback" Runtime Monitoring

Emprical evidence on real-world

benchmarks on the OpenJDK 6 reveal

that:

Most properties are piggyback-

compatible

Page 141: A Case for "Piggyback" Runtime Monitoring

Emprical evidence on real-world

benchmarks on the OpenJDK 6 reveal

that:

Most properties are piggyback-

compatible

H involves few variables

Page 142: A Case for "Piggyback" Runtime Monitoring

Emprical evidence on real-world

benchmarks on the OpenJDK 6 reveal

that:

Most properties are piggyback-

compatible

H involves few variables

Runtime overhead is reduced over

classical monitors

Page 143: A Case for "Piggyback" Runtime Monitoring

Future work and open questions:

Use annotations instead of aspects

Find H automatically

Verify a given H statically

Extend to methods with arguments

Relax hypotheses

Page 144: A Case for "Piggyback" Runtime Monitoring

Piggyback and classical monitors are

complementary

Page 145: A Case for "Piggyback" Runtime Monitoring

Piggyback and classical monitors are

complementary

The choice of a classical monitor should be

justified, not taken for granted

Page 146: A Case for "Piggyback" Runtime Monitoring

Piggyback and classical monitors are

complementary

The choice of a classical monitor should be

justified, not taken for granted

Is overhead really what matters?

Page 147: A Case for "Piggyback" Runtime Monitoring

The EndThank you !