+ All Categories
Home > Documents > Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc...

Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc...

Date post: 29-Dec-2015
Category:
Upload: aubrey-watkins
View: 216 times
Download: 1 times
Share this document with a friend
Popular Tags:
48
Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project EMN/INRIA, France Julia L. Lawall DIKU University of Copenhagen, Denmark AOSD 2003
Transcript
Page 1: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

Web Cache Prefetching as an Aspect:Towards a Dynamic-Weaving Based

Solution

Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles MullerOBASCO Project EMN/INRIA, France

Julia L. LawallDIKU University of Copenhagen, Denmark

AOSD 2003

Page 2: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

2

Improving the Web Web cache:• Stores previously-accessed contents preparing for

later potential re-accesses• Advantageous if contents are accessed repeatedlyContent prefetching:• Stores contents that have not yet been accessed

preparing for later potential accesses• Advantageous if contents are accessed eventually

– Relies on the prediction of the access patterns of a Web application

Page 3: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

3

Prefetching

• A prefetching policy must anticipate access patterns:– Access patterns are application dependent– A Web cache is shared among many Web applications

• Consequence:– Policies should be deployed on demand in the cache

• Problem:– How to integrate dynamically new prefetching policies

within Web caches?

Page 4: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

4

Web Caches

Client Cache Server

Sto

rag

e s

pa

ce

3? 3?3 8

2 45

89 5

3

382

3

345

Storage space

3

394

855

Storage space

343

611

Storage space

3?3?

3

Cache in the neighborhood

Cache in the neighborhood

client request

cooperation request

Page 5: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

5

Typical flow of a cooperation request

Accept user request

Request analysis

File lookup

Send User Reply

Local Storage

Accept cooperation request

Replacement policy

Network module

Send cooperation request

Send Internet request

Send cooperation reply

Client Cache

Web cache

Typical flow of a user request

Network

neighborhood

Internet

Server

Page 6: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

6

Issues in integrating prefetching in Web caches

• Observation:– Prefetching crosscuts the cache structure– Execution paths: modules are not sufficient

• A “natural” solution: AOP

Page 7: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

7

AOP for prefetching in Web Caches Mapping

• Joinpoints

Where, within the cache, a policy is allowed to run

• The pointcut language

When a particular prefetching policy should be triggered

• Advice language

What the prefetching policy should do

• Weaving

Link a prefetching policy to the cache

Specifies where adaptation can take place

Specifies when to adapt

Specifies the behaviour of the adaptation code

Link the adaptation code to the base program

Page 8: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

8

AOP for prefetching in Web caches Steps

Base program development

Aspect developmentExecution of base program

Weaving time

Prefetching policy

Web cache development

Prefetching deployment time

Adapted development

Adaptation code

Adaptation code link time

Web cache execution

Adapted execution

time

Page 9: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

9

Constraints on the runtime system

• A cache processes every request to a subnet. – It must be efficient.

The aspect code must be efficient.– The cache service must always be available.

The base program must continuously run.• Web caches are written in C.

The aspect system must support the C language.• Prefetching policies should be deployed on demand

in the cache.The aspect system must allow dynamic weaving.

Page 10: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

10

• Strong performance requirements– Base program code preparation (hookable) – Aspect and base program

• Translated into C code by our tools• Can be compiled with compiler optimizations

– Weaving is performed with almost no interruption of the application

• Targeted for an audience of C developers– Advice as C code block– All pointcuts can be thought as « did the base program

execute this C construct ?»• Need to be able to perform the extension dynamically

– Weaving performed at runtime

Meeting the constraintsµDyner runtime system

Page 11: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

11

Meeting the constraintsµDyner language

• Need to be able to reason on execution paths– Pointcut on nested functions calls «did f() call g()call h()?»

• Need to be able to monitor some global variable– Last element in the pointcut sequence can test whether a

given global variable has been read or written

• In order to extend Web caches– The advice replaces the execution of the last element in the

sequence.• Can trigger execution of the original definition through continue.

Page 12: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

12

Ru

nti

me

Bu

ild a

nd

des

ign

tim

e

Lifecycle and tools support

Base

program

development

Aspect

development

Execution

Weaving

Page 13: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

13

Base code

maintainer

Pretreated base code

Adaptable cache

µDyner support library

Preprocessing

Compile - link (gcc)

Cache source code C with hookable

Postprocessing

Lifecycle and tools supportR

un

tim

eB

uild

an

d d

esig

n t

ime

Aspect

development

Execution

Weavinghookable int withdraw(float amount,BankAccount * account) {

assert(account!=NULL); account->debit = amount + account->debit ;

return SUCCESS;}

Page 14: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

14

Base code maintainer

Pretreated base code

Adaptable cache

µDyner support library

Pretreatment

Compile - link (gcc)

Cache source code C with hookable

Postprocessing

Lifecycle and tools support

C code Pointcut action as functions

Prefetching policies: aspectsources

Compiled aspects Shared library

Compilelink

(gcc)

Preprocessing

Aspect developer

Ru

nti

me

Bu

ild a

nd

des

ign

tim

e

Execution

Weaving

#include "../BaseProgram/BankAccount.h"#define MAX_WITHDRAWAL_AMOUNT 1000.0anAspect:[

int withdraw(float amount, BankAccount * account) :[ {

if(amount >= MAX_WITHDRAWAL_AMOUNT)return BANK_REFUSED;

return continue_withdraw(amount,account);}]

]

Page 15: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

15

Base code maintainer

Pretreated base code

Adaptable cache

µDyner support library

Ru

nti

me

Preprocessing

Bu

ild a

nd

des

ign

tim

e

Compile - link (gcc)

Cache source code C with hookable

Postprocessing

Lifecycle and tools support

C code Pointcut action as functions

Prefetching policies: aspectsources

Compiled aspects Shared library

Compilelink

(gcc)

Preprocessing

Aspect developer

Cache administratorExecute

µDyner instrumentation

threadCache threads

Cache (host process)

Page 16: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

16

Base code maintainer

Pretreated base code

Adaptable cache

µDyner support library

Ru

nti

me

Preprocessing

Bu

ild a

nd

des

ign

tim

e

Compile - link (gcc)

Cache source code C with hookable

Postprocessing

Lifecycle and tools support

C code Pointcut action as functions

Prefetching policies: aspectsources

Compiled aspects Shared library

Compilelink

(gcc)

Preprocessing

Aspect developer

Cache administratorExecute

µDyner instrumentation

threadCache threads

Prefetching policy deployed through

shell commands (weave - deweave)

Cache (host process)

Page 17: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

17

µDyner implementation

• Aspect as shared library

• Base program preparation

• Weave

Page 18: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

18

µDyner compiled aspects

Shared native library

Page 19: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

19

µDyner compiled aspects

aspect entry point

advice code

continue pointers

Page 20: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

20

µDyner compiled aspects

aspect entry point

advice code

continue pointers

Points to an address in the base program allowing to execute the last pointcut element

Page 21: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

21

µDyner compiled aspects

aspect entry point

advice code

continue pointers

Invoked each time the base program reaches the last joinpoint element

Page 22: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

22

µDyner compiled aspects

aspect entry point

advice code

continue pointers

Invoked each time the base program reaches the last join point element

Checks pointcut

Calls advice or

continue

Page 23: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

23

µDyner base code preparation

• Prepare the base program for analysis– Collect functions and variables addresses– Collect addresses of instructions accessing hookable variable

– Collect addresses of instructions calling functions

• Prepare the base program for alteration– Make potential rewriting sites big enough to contain

a jump instruction

Page 24: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

24

µDyner weaver

• Open the aspect shared library

• Overwrite the last joinpoint as a jump to the aspect entry point

• Set the continue pointers in the aspect library

Page 25: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

25

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

JUMP +3; NOP; NOP; NOP;

withdraw(100,account)

// code

Host process}

Weaving implementation

Page 26: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

26

#include "../BaseProgram/BankAccount.h"#define MAX_WITHDRAWAL_AMOUNT 1000.0anAspect:[

int withdraw(float amount, BankAccount * account) :[

{if(amount >= MAX_WITHDRAWAL_AMOUNT)

return BANK_REFUSED;return continue_withdraw(amount,

account);}]

]

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

JUMP +3; NOP; NO; NOP;

withdraw(100,account)

// code

Host process}

if(pointcut != TRUE) continue_withdraw(amount,account); else advice(amount,account);}

int advice(float amount,BankAccount * account) {

if(amount >= MAX_WITHDRAWAL_AMOUNT) return BANK_REFUSED; return continue_withdraw(amount,account);}

int anAspect(float amount, BankAccount * account) {

void * continue_withdraw = withdraw +5;

Aspect

Weaving implementationOverview of a compiled aspect

Generated at compilation of the base program

Generated at compilation of the aspect

Generated at weaving time

continue pointer

aspect entry point

aspect advice

Aspect

rewriting site

Page 27: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

27

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

JUMP +3; NOP; NO; NOP;

withdraw(100,account)

// code

Host process}Generated at compilation of

the base programGenerated at compilation of

the aspectGenerated at weaving time

if(pointcut != TRUE) continue_withdraw(amount,account); else advice(amount,account);}

int advice(float amount,BankAccount * account) {

if(amount >= MAX_WITHDRAWAL_AMOUNT) return BANK_REFUSED; return continue_withdraw(amount,account);}

int anAspect(float amount, BankAccount * account) {

} else {

JUMP anAspect

JUMP withdraw+5

}

Hook

if(aspect_loaded ==TRUE)

void * continue_withdraw = withdraw +5;

Aspect

1 load the aspect library – allocate the hook

2 rewriting the base code

3 set aspect_loaded to true

Weaving implementation

Hook:

Page 28: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

28

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

JMP 3; NOP; NOP; NOP;

withdraw(100,account)

// code

Host process}

if(pointcut != TRUE) continue_withdraw(amount,account); else advice(amount,account);}

int advice(float amount,BankAccount * account) {

if(amount >= MAX_WITHDRAWAL_AMOUNT) return BANK_REFUSED; return continue_withdraw(amount,account);}

int anAspect(float amount, BankAccount * account) {

} else {

JUMP anAspect

JUMP withdraw+5

}

Hook

if(aspect_loaded ==TRUE)

void * continue_withdraw = withdraw +5;

Aspect

1 load the aspect librairy – allocate the hook

2 rewriting the base code

3 set aspect_loaded to true

Weaving implementation

JUMP Hook

Hook:

Generated at compilation of the base program

Generated at compilation of the aspect

Generated at weaving time

Page 29: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

29

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

withdraw(100,account)

// code

Host process}

if(pointcut != TRUE) continue_withdraw(amount,account); else advice(amount,account);}

int advice(float amount,BankAccount * account) {

if(amount >= MAX_WITHDRAWAL_AMOUNT) return BANK_REFUSED; return continue_withdraw(amount,account);}

int anAspect(float amount, BankAccount * account) {

} else {

JUMP anAspect

JUMP withdraw+5

}

Hook

if(aspect_loaded ==TRUE)

void * continue_withdraw = withdraw +5;

Aspect

1 load the aspect librairy – allocate the hook

2 rewriting the base code

3 set aspect_loaded to true

Weaving implementation

JUMP Hook

Hook:

Generated at compilation of the base program

Generated at compilation of the aspect

Generated at weaving time

Page 30: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

30

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

withdraw(100,account)

// code

Host process}

if(pointcut != TRUE) continue_withdraw(amount,account); else advice(amount,account);}

int advice(float amount,BankAccount * account) {

if(amount >= MAX_WITHDRAWAL_AMOUNT) return BANK_REFUSED; return continue_withdraw(amount,account);}

int anAspect(float amount, BankAccount * account) {

} else {

JUMP anAspect

JUMP withdraw+5

}

Hook

if(aspect_loaded ==TRUE)

void * continue_withdraw = withdraw +5;

Aspect

Use case – advice execution

JUMP Hook

Weaving implementation

Hook:

Generated at compilation of the base program

Generated at compilation of the aspect

Generated at weaving time Jump

Function returnFunction call

Page 31: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

31

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

withdraw(100,account)

// code

Host process}

if(pointcut != TRUE) continue_withdraw(amount,account); else advice(amount,account);}

int advice(float amount,BankAccount * account) {

if(amount >= MAX_WITHDRAWAL_AMOUNT) return BANK_REFUSED; return continue_withdraw(amount,account);}

int anAspect(float amount, BankAccount * account) {

} else {

JUMP unAspect

JUMP withdraw+5

}

Hook

if(aspect_loaded ==TRUE)

void * continue_withdraw = withdraw +5;

Aspect

Use case – advice execution

JUMP Hook

Weaving implementation

Hook:

Generated at compilation of the base program

Generated at compilation of the aspect

Generated at weaving time Jump

Function returnFunction call

Page 32: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

32

Link performance evaluationMethods

Measure the runtime of a given application for a given input

Same measure with the same application with the same input but with woven aspects

The ratio gives a performance evaluation

• Micro evaluation :

• Macro evaluation :

Invoke an empty method

Invoke an empty method with an empty aspect

The ratio gives a performance evaluation

Page 33: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

33

Link performance evaluationResults

• Linux Pentium4 1.6 GHz

• Micro evaluation: 2.2 slower

• Macro evaluation: 1.015 slower (Tinyproxy – hit counting aspect)

Page 34: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

34

Related WorkDynamic weaving:

– PROSE Popovici A., Gross T., Alonso G. 2002

– JAC Pawlak R., Seinturier L., Duchien 2001

Native code instrumentation:– Dyninst Buck B., Hollingsworth J.K, 2000

AOP for C:– AspectC Y. Coady, G. Kiczales 2001

Page 35: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

35

Future Work

• Increase the expressivity of the pointcut language (designing static functions…)

• Remove all static preparation of the base program code

– Implies: suppression of hookable

– Exploit debugging information rather than relying on source code

• Design a set of prefetching policies

• Modify Squid (prepare it for aspectization)

– Build a dynamically adaptable web cache

– Experiment with prefetching policies

Page 36: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

36

Conclusion• Prefetching as a crosscutting concern

• A method to link the base program to the aspect

• Almost no service interruption during weaving

• Very fast, once woven

• Prototype: µDyner

– Within the implementation, links aspect and base program through dynamic code rewriting

– Running under GNU/Linux, Pentium

Page 37: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

Questions

Page 38: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

38

[BUC 00] BUCK B., Hollingsworth J. K., An API for Runtime Code Patching , The International Journal of High Performance Computing Applications, vol. 14, n 4, 2000, p. 317-329.

[CAH 02] Redmond B., Cahill V., Supporting unanticipated dynamic adaptation of application behaviour ECOOP 2002 – Object-Oriented Conference, 16th European Conference, vol. 2374 of Lectures Notes in Computer Sciences page 205-230, Malaga, Spain Juin 2002

[DOU 01] Douence R., Motelet O., Südholt M., A formal definition of crosscuts, Proceedings of the 3rd International Conference on Reflection and Crosscutting Concerns, vol. 2192 de Lecture Notes in Computer Science, Kyoto, Japan, 2001, Springer Verlag, p. 170-186.

[DOU 02] Douence R., Fradet P., Südholt M., A framework for the detection and resolution of aspect interactions , Proceedings of the ACM SIGPLAN/SIGSOFT Conference on Generative Programming and Component Engineering (GPCE’02), 2002, p. 173-188.

[KLE 96] Kleinoder J., Golm M. MetaJava : An efficient run-time meta architecture for Java. International Workshop on Object-Orientation In Operation Systems – IWOOS’96, p. 54-61, Seattle WA, octobre 1996.

[HOL 97] Hollingsworth J. K., Miller B. P., Goncalves M. J. R., Naim O., Xu Z., Zheng L., MDL : A Language and Compiler for Dynamic Program Instrumentation, IEEE PACT, 1997, p. 201-213.

[OLI 98] Oliva A., Buzato L.E. The implementation of Guaranà in Java. Techhnical report IC-98-32, Institute of of computing, University of Campinas, Brésil, septembre 1998.

[PAW 01] Pawlak R., Seinturier L., Duchien L., Florin G., JAC : A Flexible Solution for Aspect-Oriented Programming in Java , Proceedings of Reflection’01, vol. 2192 de Lecture Notes in Computer Science, Springer, 2001, p. 1-24.

[POP 02] Popovici A., Gross T., Alonso G., Dynamic weaving for aspect-oriented programming , Proceedings of the 1st international conference on Aspect-oriented software development, Enschede, The Netherlands, 2002, ACM Press, p. 141-147.

References

Page 39: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

39

AOP in a nutshell• Joinpoints

– The instrumentation sites within the base program.

• The pointcut language– A pattern on the execution trace of the base program.

• Action language– What to do when the pointcut matches the execution of

the base program

• Weaving– Link a base program and an aspect– At compile time, at load time, at runtime.

Page 40: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

40

Base code maintainer

Pretreated base code

Adaptable cache

µDyner support library

Ru

nti

me

Pretreatment

Bu

ild a

nd

des

ign

tim

e

Compile - link (gcc)

Cache source code C with hookable

Postreatement

Three actors for three steps

C code Pointcut action as functions

Prefetching policies: aspectsources

Compiled aspects Shared library

Compilelink

(gcc)

Pretreatment

Aspect developer

Cache administratorExecute

µDyner instrumentation

threadCache threads

Prefetching policy deployed through

shell commands (weave - deweave)

Cache (host process)

#include "../BaseProgram/BankAccount.h"#define MAX_WITHDRAWAL_AMOUNT 1000.0int (*continue_withdraw)(float amount,BankAccount * account)=NULL;int advice(float amount,BankAccount * account){

if(amount >= MAX_WITHDRAWAL_AMOUNT)return BANK_REFUSED;

return continue_withdraw(amount,account);}int anAspect(float amount,BankAccount * account) { return advice(amount,account);}

Page 41: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

41

Base code maintainer

Pretreated base code

Adaptable cache

µDyner support library

Ru

nti

me

Pretreatmentt

Bu

ild a

nd

des

ign

tim

e

Compile - link (gcc)

Cache source code C with hookable

Postreatement

Three actors for three steps

C code Pointcut action as functions

Prefetching policies: aspectsources

Compiled aspects Shared library

Compilelink

(gcc)

Pretreatment

Aspect developer

Cache administratorExecute

µDyner instrumentation

threadCache threads

Prefetching policy deployed through

shell commands (weave - deweave)

Cache (host process)

int withdraw(float amount,BankAccount * account) __attribute__ ((noinline));int withdraw(float amount,BankAccount * account) { __asm__ __volatile__ ( "jmp assert"); __asm__ __volatile__ ("nop");__asm__ __volatile__ ("nop"); __asm__ __volatile__ ("nop"); assert(account!=NULL); if((account->credit) <= OVERDRAFT_WITH_TRIAL) return BANK_REFUSED; account->debit = amount +account->debit ; return SUCCESS;}

Page 42: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

42

By Partial match By Popularity By Lifetime

Accept user request

Parse request

File lookup

Local storage

Accept ICP request

Send Internet request

Send ICP request

Send user reply

Send ICP reply

Replacement policy

InteractionInterface

appropriate

InteractionInterface

inadequate

No interaction

Page 43: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

43

Summary

• Difficult to anticipate the interaction of prefetching and the cache– Interaction depends heavily of the policy– Difficult for the cache to offer an API

supporting this interaction

• A generic API might even slow down the cache.

Page 44: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

44

Link performance evaluation• Micro evaluation :

ratio

– µDyner (AOP for C – dynamic native code rewriting ) : 2.2– IguanaJ [CAH 02] (MOP for Java – dynamic code rewriting of JIT code) : 24.0– MetaXa [KLE 96] (MOP for Java – modified JVM) : 28.0– Prose [POP 02] (AOP for Java – based on Java debugging API ) : 40.0– Guaranà [OLI 98] (MOP for Java - modified JVM modifiée) : 70.0

• Macro evaluation :ratio

– µDyner (AOP for C) with Tinyproxy : 1.015– Java Aspect Component [PAW 01] (AOP for Java) : 5.000

Page 45: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

45

• Joinpoint – an event embeds a partial description of the current

execution context• events are grouped in a single execution trace

• Pointcut– a sequence of events– a monitor inspects the trace

• continuously checks the different pointcuts• triggers the execution of aspect when needed

• The action language – access to the base program through the information

contained in the events

• Weaving– Registration on the monitor

The EAOP model [DOU 01, DOU 02]

Page 46: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

46

EAOP for Web Caches?

Well defined semantics but…• Issues with the model

– Not very well suited for concurrent applications– The duplication of execution context is relatively costly.

Events are big.

• Issues with the proposed prototype– Weaving for Java– The set of events are open

Everybody can use his own eventsLack of a clear distinction between action and pointcut

Page 47: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

47

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

withdraw(100,account)

// code

Host process}

if(pointcut != TRUE) continue_withdraw(amount,account); else advice(amount,account);}

int advice(float amount,BankAccount * account) {

if(amount >= MAX_WITHDRAWAL_AMOUNT) return BANK_REFUSED; return continue_withdraw(amount,account);}

int anAspect(float amount, BankAccount * account) {

} else {

JMP anAspect

JUMP withdraw+5

}

Hook

if(aspect_loaded ==TRUE)

void * continue_withdraw = withdraw +5;

Aspect

Use case – pointcut not verified

JUMP Hook

Weaving implementation

Hook:

Generated at compilation of the base program

Generated at compilation of the aspect

Generated at weaving time Jump

Function returnFunction call

Page 48: Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.

48

int transfer_money {

}

// original function code

int withdraw(float amount, BankAccount * account) {

withdraw(100,account)

// code

Host process}

if(pointcut != TRUE) continue_withdraw(amount,account); else advice(amount,account);}

int advice(float amount,BankAccount * account) {

if(amount >= MAX_WITHDRAWAL_AMOUNT) return BANK_REFUSED; return continue_withdraw(amount,account);}

int anAspect(float amount, BankAccount * account) {

} else {

JMP anAspect

JUMP withdraw+5

}

Hook

if(aspect_loaded ==TRUE)

void * continue_withdraw = withdraw +5;

Aspect

Use case – aspect not activated

JUMP Hook

Weaving implementation

Hook:

Generated at compilation of the base program

Generated at compilation of the aspect

Generated at weaving time Jump

Function returnFunction call


Recommended