360 likes | 508 Views
MIDDLEWARE SYSTEMS. RESEARCH GROUP. Tailoring Middleware. Hans-Arno Jacobsen Bell University Laboratory Chair in Software Middleware Systems Research Group University of Toronto. Joint work with Charles Zhang & Michael Gong. Agenda. Crosscutting concerns in middleware
E N D
MIDDLEWARE SYSTEMS RESEARCH GROUP Tailoring Middleware Hans-Arno Jacobsen Bell University Laboratory Chair in Software Middleware Systems Research Group University of Toronto Joint work with Charles Zhang & Michael Gong Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Agenda • Crosscutting concerns in middleware • The JiM approach: Just-in-time Middleware • ACC for boosting modularity in C-based systems Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
account.withdraw(100) Network Middleware is naturally layered! Begin transaction: Check-balance Withdraw End transaction Account Credit Loan Stub Generic Request Message Object Adapter Multiplexing Messaging Layer Application Frame Transport Layer OS Network Layer Network packets Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Non-modular interactions Normal method invocations Reflective programming Asynch call Stub Object Adaptor Same host optimization Generic Request Message Messaging Layer Application frames Transport Layer OS Network Layer Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Object/Procedures Application Adaptation Requests Problem: Implicit interactions in code public Downcall createPIDIIDowncall(String op, boolean resp, … ) throws FailureException { com.ooc.OCI.ProfileInfoHolder profile = new com.ooc.OCI.ProfileInfoHolder(); Client client = getClientProfilePair(profile); Assert._OB_assert(client != null); if(!policies_.interceptor) return new Downcall(orbInstance_, client, profile.value, policies_, op, resp); PIManager piManager = orbInstance_.getPIManager(); if(piManager.haveClientInterceptors()){ return new PIDIIDowncall(orbInstance_, client, profile.value, policies_, op, resp, IOR_, origIOR_, piManager, args, result, exceptions); } else{ return new Downcall(orbInstance_, client, profile.value, policies_, op, resp); } } DII PI Asyn Validation Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Dynamic request handling in ORBacus red shows lines of code that handle dynamic request not in just one place not even in a small number of places Problem: Non-modular features Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Problem: Losing modularity is harmful • Code is hard to understand, maintain & change • Runtime overhead • Evolution barrier with respect to infrastructure innovations Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
How real is this problem? • Quantification of contextual interactions (AOSD’03 & IEEE Trans. Parallel & Distributed Systems) • Three independent implementations of the same middleware specification • Moderate sizes (1500 – 1800 Java classes) • Different implementation styles • Six features: • Reflective programming model, runtime reflection, … • Over 50% of classes interact with 1 out 6 features. • Over 10% of classes interact with 3 or more features • Middleware architectures suffer from non-modularity Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Mining non-modular features (AOSD’03, AOSD’07) Features Users Restructure legacy systems (OOPSLA’04) Construct new systems (Middleware’05) Usage-aware synthesis (AOSD’05) Context Research program • Aspe • SE methods for improving the • Mining of non-modularized features • Separation of tangled features • Adaptive architecture • Future work Concurrency Aspect Library (ECOOP’08) Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Pre-postulated middleware architecture • Pre-postulated architecture: middleware platforms of which the architectural composition happens before that of its applications (traditional approach). • Problem: • Imperative “domainization”: middleware architectures conceived and designed based on “domain” assumptions. • Difficulty in cross-domain re-use: middleware built for one domain cannot readily and transparently fit another. • Pre-postulated customization: middleware customization is designed independent of applications. Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Mobile Desktop Embedded Server Domain pre-postulation: example • Middleware functionality • Target platforms • Middleware family • Enterprise / Desktop / Micro / Embedded / …. (The list goes on… …) remote invocation interface account{ account withdraw(...) } Teller network Account amount = 1000; account.withdraw(amount); Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
B B B N A A A A M N M C Pre-postulated product families • Where do I belong in the family? • What about feature N? MiddlewareX UserY My cell-phone app requires messaging passing of integers and file transfer. which one? Regular Mobile Enterprise A: Messaging passing, B: Integer C: String M: File transfer N: security UserY OK, I am developing a cell-phone app, but I don’t really need file transfer Mobile Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Pre-postulated customization • Costs associated with middleware features. (IDL Keywords). • 217 possible usages. • A application most likely only uses a subset. • Challenges: • Difficult to pre-postulate the specific subset for every given application. • Complex to use if user needs to manually determine the customized version. Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
The JiM approach • Post-postulated architecture: Middleware of which the architectural composition happens after that of its applications. • Goal: A given application and its domain imperatively and transparently determine the middleware composition. Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Middleware user applications B A N Tailored middleware instance JiM customization process JiM customization stages Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
JiM customization participants Middleware Vendor (Libraries/Dependencies) Middleware User (Declarations/Source code) Middleware Deployer (Contextual Constraints) Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Abacus: A refactoring-based JiM implementation • Aspect-oriented ORBacus isour long-term refactoring of ORBacus, an industry-strength, Java-based CORBA implementation. • Highly modular: Comprised of 26 features implemented as aspects. • Capable of automatic customization for applications ranging from embedded, to desktop, and to enterprise environments. Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Core requires either ‘synchrony’ or ‘asynchrony’ IR requires typecode with DII or DSI Abacus: Features and dependencies • Aspectual features: • Feature dependency specifications: Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Abacus: Inference tree and pruning with cost functions • Initial selections: IR and Any (Core, mandatory) • Objective: Small bytecode size (sync, any, wstring , IR, DII, pecode) (sync, any,,wstring) (sync, any, wstring, IR, DSI, Typecode) (sync) (sync, any, ulonglong, IR, DII, Typecode) (sync, any, ulonglong) (sync, any, ulonglong, IR, DSI, Typecode) Core = sync+async any = wstring+ulonglong IR = (DSI+DII)*Typecode ( ) (async, any, ulonglong, IR, DII, Typecode) (async, any, ulonglong) (async, any, ulonglong, IR, DSI, Typecode) (async) (async, any, wstring, IR, DII, Typecode) (async, any, wstring) (async, any, wstring, IR, DSI, Typecode) Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Object serialization / user garbage collection not allowed Abacus: Constraints • Indicates disallowed feature selections under specific conditions. • Invoked during the inference process to simplify the inference path. • Abacus constraints example: j2me { resource = ! valuetype * ! finalize; precision = ! double * ! fixed; infrastructure = ! applet; } Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
“double” interacts with “any” and “valuetype”, check if they are included. Abacus: Synthesis • Class schema: • Proper organization of aspect code space • Separation of implementation and interaction • Convolution descriptions • Capture convolution relationships among aspects. • Direct the synthesis process Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Evaluation: UMessanger Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Abacus quantification: UMessenger static • Static characteristics of UMessenger Efferent: how many classes do I depend upon? Afferent: the reverse – how many classes depend on me? • Comparison to baseline (Original) • Size reduction as much as 60% • Coupling reduction 16%-33% Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Abacus quantification: UMessenger runtime Response time (usec), memory, Cache misses L1-Instruction, L1-Data, L2 Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Abacus evaluation:Randomized synthesis • Each feature has equal probabilities of being selected (1), unselected(0), and unknown (X) • 5 Runs. 4 valid, 1 invalid. Each run consists of initial manifest (R) and inferred manifest (I) Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Abacus quantification:Randomized static properties • 25%-44% size reduction • 12%-26% efferent coupling reduction • 11%-27% afferent coupling reduction Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Payload transport Within 1% differences Response, memory, cache Memory usage reduction from 5%(RC4) to 24% (RC3) L1-instruction cache miss reduction 3%-8%. L1-data 1%-10%, L2 misses 4% on average Abacus quantification:Randomized runtime properties Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Summary on JiM • It is difficult for pre-postulated middleware architecture to balance between generality and specialty • Just-in-time architecture is a method towards solving this problem through fine granular modularity and a user-driven synthesis procedure • Demonstrated effectiveness through Abacus • General middleware architecture without losing specialty • User-driven composition leads to efficient sizing, memory usages, and performances • Cross-domain support is transparent Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
AspeCt-oriented C (ACC)for Systems Development with C ACCv0.8www.AspeCtC.net ~3.500 downloads MIDDLEWARE SYSTEMS RESEARCH GROUP
ACC Feature Overview • Join point • function call, function execution • Pointcut • call, callp , execution, args, result, infile, infunc, cflow • named pointcut, composite pointcut • wildcard matching in pointcut expression • Advice • before, after, around, and proceed() • execution context exposure, reflective info. about join point • Static crosscutting • introduce new member to struct/union via introduce() advice • Miscellaneous • thread-safe • support • ANSI-C • C99 • GCC C language extensions • support of debugging on original source files
ACC Example: Memory Profiling Aspect #include <stdio.h> #include <stdlib.h> size_t totalMem = 0; void print() { printf("total = %d \n", totalMem); } after():execution(int main()){ print(); } before(size_t s):call($ malloc(...)) && args(s){ totalMem += s; } pointcut advice Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
AspeCt-oriented C Overview Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008
Success Stories • Weave tracing aspect into GCC 4.0.1.2 • advise every function call of gcc • Integrate ACC into existing builds of complex software systems • ORBIT2 (GNOME IPC middleware) • NUT/OS (embedded real-time operating system) • Linux kernel & gcc • Case studies • Red-black tree product family from libavl tree library • use ACC for 3rd year introductory Operating Systems course assignments (add system calls, profiling etc.) Come and See - Go and Get It - http://www.AspeCtC.net
Q & A • Thank you ! Hans-Arno Jacobsen: Tailoring Middleware - Dagstuhl 2008