1 / 21

Distributed Dynamic Weaving is a Crosscutting Concern

Distributed Dynamic Weaving is a Crosscutting Concern. Michihiro Horie , Satoshi Morita, Shigeru Chiba Tokyo Institute of Technology, Japan. Aspect Oriented Programming (AOP). AOP languages enable to modularize crosscutting concerns into aspects Distributed dynamic AOP languages

ulf
Download Presentation

Distributed Dynamic Weaving is a Crosscutting Concern

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Distributed Dynamic Weaving is a Crosscutting Concern MichihiroHorie, Satoshi Morita, Shigeru Chiba Tokyo Institute of Technology, Japan

  2. Aspect Oriented Programming (AOP) • AOP languages enable to modularize crosscutting concerns into aspects • Distributed dynamic AOP languages • Extended for a distributed and running program • Weaving encryption/decryption aspects to a running program • Crosscutting concerns • Must be woven simultaneously Client Server messages Encrypt Decrypt Client Server encrypted messages

  3. An example of woven aspects Advice Pointcut Aspect publicaspectEncrypter { void around (String msg): call(void Client.send(String))&&args(msg){ String cipher = encrypt(msg);// encryption proceed(cipher); // original method invocation } } 号 description class Client { void send (String msg) { … }} Joinpoint Server Encryption

  4. Weaving fails without a consistency mechanism • An experiment in InTrigger grid computing platform • Encryption/decryption with a message serviceapplication • Sending 1 message/ms • Chiba to Hakodate • The network latency was 27 msec. • Results • 10 times failure in Java-based language • 1 failure in CaesarJ [Mezini et.al. 03]

  5. Existing approaches: Barrier synchronization Client Server • Which tick do we suspend the program at? • Needs another aspect to control weaving • Difficult to define • This aspect should be also woven dynamically… message Client Server suspend decrypt encrypt Client Server restart Client Server Encrypted message

  6. Existing approaches:Atomic weaving[Truyen et.al. 06] deploy Client Server • An aspect weaving is split into two phases • Deploy • An aspect is delivered to a remote host • Activate • Only when it is explicitly activated • No language support • No single atomic weaving mechanism for all applications • Decreases reusability of control aspects STOP message decrypt encrypt Client Server message deploy Client Server message activate Client Server Encrypted message activate

  7. DandyJ • New distributed Dynamic AOP language • Distributed dynamic weaving can be written by aspects • Control weaving depends on each application • An aspect to control weaving can be independent • Reusable • Three language constructs • First-class aspects with two-phase weaving • Remote pointcuts • One-time aspects

  8. First-class and two-phase weaving • First-class • Dynamic aspect • Can be woven during runtime • dynamicmodifier • A subtype of DAspect • It has to be explicitly instantiated • Can be assigned to a variable andpassed as a method parameter • Reusable library code • Two-phase weaving • Deploy and activate dynamic aspect Encrypter{ …. } Encrypter enc = new Encrypter (); enc.deploy(); enc.activate(); ... enc.undeploy();

  9. Methods available on dynamic aspects • The asynchronousdeploy and synchronous activate • Allows us to minimize the duration of the “stop the world” time for dynamic weaving

  10. Remote pointcut [Nishizawaet.al. 04] • Selects execution events on a remote machine • Method calls etc. • local modifier for locally deploying aspects • Useful to implement an action that has to be performed on the same machine node00: ... send (); node00 Aspect

  11. Onetime aspect Client Server message • Automatically undeployed after all its advices are executed • Useful to implement a program for controlling distributed weaving • Need not write undeployexplicitly • onetime modifier Control weaving encrypt decrypt Server Client Encrypted message undeploy Client Server Encrypted message

  12. Encryption aspects in DandyJ publicdynamicaspectEncrypter { localvoid around (String msg): client() && args(msg) { // encrypt the message proceed (msg); }} public abstractdynamic onetime aspectServerClient { … before (): server() && if (openPort.isDeployed() && server.isDeployed()) { openPort.activate(); server.activate(); } before (): client() && if(server.isActivated() && changePort.isDeployed() && client.isWoven()) { changePort.activate(); client.activate(); }} publicdynamicaspectDecrypter { local voidaround (String msg, Server s): server() && args(msg) && this(s){ if ( /* */ ) { // decrypt the message proceed (msg); } else { proceed(msg); }}}

  13. Another example: a logging aspect with a n-body problem solver • Weaving along the barrier synchronization • Deploys two aspects • One for the preparation • Another for logging deploy Join point Calculation Data sending node00 node01 node02 t = 101 sync t = 102 sync activation t = 103 Do not activate

  14. A reusable aspect for barrier synchronization public abstractaspectBarrierSync { … abstract pointcut sync(); before(String host): sync() && hostName(host) { map.put(host, true); } after(String host): sync() && hostName(host) && if(dAspect.isDeployed()) { synchronized(this) { if (!map.containsValue(false)) { dAspect.activate(); this.undeploy(); } map.put(host, false); }}}

  15. Experiment • Encryption/decryption aspects for a message service application • Uses two remote clusters • Chiba • Sending messages • Control weaving • Mirai: • Receiving messages • Four scenarios • (A) Deploy and activate aspects without any consideration of atomicity • (B) Suspend the application, weave aspects, and then restart it • (C) Deploy and activate aspects by our DandyJ aspect • (D) The same as (C) but the aspect is not one-time • Environment • InTriggerchiba & mirai • OS: Debian • Chiba CPU: Core2Duo 2.13GHz, memory: 4GB • Mirai CPU: Xeon 2.33GHz, memory: 16GB

  16. Results Delay for barrier sync. Weave an aspect • Onetime aspect contributes to response time and consistency Response time ◎ Consistency × Response time × Consistency ○ Response (ms) Max: 69 Ave: 45.4 Max: 133 Ave: 47.5 Message sent(times) Response time ○ Consistency ○ Response time △(7%) Consistency ○ Max: 71 Ave: 46.6 Max: 75 Ave: 49.6

  17. Concluding remarks • Illustrates that distributed dynamic weaving is a crosscutting concern • DandyJ • New distributed dynamic AOP language • Three language constructs • First-class aspect with two-phase weaving • Remote pointcut • Onetime-aspect • Experiment with the InTriggergrid computing platform

  18. Related work • DyReS [Truyen et.al. 08] • Uses XML script to describe activation of aspects • Difficult to understand procedures in remote hosts • Scripts tend to be complicated • CaesarJ [Mezini et.al. 03] • Activates an aspect through deploy instruction • Cannot control procedures in remote hosts • DJAsCo [Navarro et.al. 06] • Available for remote pointcut • Cannot describe an activation code by an advice • Lasagne [truyen et.al. 06] • Atomic weaving

  19. Implementation of DandyJ • ddjc: Compiler based on JastAdd-version of Aspect-Bench Compiler • Extended by aspects • Added 5,000 Lines of codes • ddj: Runtime system • Executes dynamic weaving • Uses Javassist • 3,000 Lines of codes

  20. The port changes • Deploy encryption/decryption aspects by the deploy method in the control aspect • Confirm deployment by the isDeployed method • Activate deployed aspects • Uses the different port

More Related