Webcal: A Domain-specific Language for Web Caching Sumit Gulvani, Asha Tarachandani, Deepak Gupta, Dheeraj Sanghi Indian Institute of Technology, Kanpur, India Luciano Porto Barreto, Gilles Muller, Charles Consel INRIA/IRISA - Compose group, Rennes, France 1 Outline • Limitations in existing web caches • A DSL-based approach • Language abstractions and Execution Model • Status and on-going work 2 Limited Flexibility of Web Caches • Existing caches provide too limited customization – Fixed policies – Do not consider changes in the execution environment 3 Reasons for Extensibility • Why should caches be extensible ? – Universal solutions do not exist – Customized policies tend to provide better results – Caches should adapt to new users and applications 4 Problems in extending existing Cache Systems • Not structured for extension purposes – COTS, parameters... • Development time – Code hacking • Error-prone – Safety Can we do better ? 5 A DSL-based Approach • Why a DSL is useful for web caching ? – (-) Development time: • Provides powerful abstractions to the programmer improving productivity – (+) Layer decomposition: • Clear separation of functional components which eases code re-use – (+) Safety/robustness: • Improves safety via program verification • Ex: message loop detection and matching, program termination 6 What do we want to program ? • Policy => Program family – Removal – Prefetching – Placement – Inter-cache protocols – Others... 7 Language Abstractions Feature Abstraction Cache Policy execution control Cache storage management Cache Communication Event-action model SQL-like Messages 8 Event-action Model • Events – Temporal events – Transition events – Message arrival • Actions • • • • Cache storehouse management: SQL-like Communication - send Cache statements - remove, prefetch, etc. Event-action statements: jump, return, end • Others: definitions, assignments, if-then-else, etc. 9 Programming in WebCal • Define cache policies as a Finite State Machine (FSM) – Intercache protocol • Define policy events and their predicates – Timeouts • Write actions to be executed when an event is triggered Examples 10 Removal Policy define MAX_CACHE_SIZE 128Mb; FSM removal [ start { entrycode { event E1 = cacheSize > 0.8*MAX_CACHE_SIZE; } E1 -> ( remove from DOC_INFO_TABLE where contentType == "gif" until cachesize < 0.5*MAX_CACHE_SIZE; ) } 11 ] Prefetching Policy FSM prefetch [ start { entrycode { event E1 = at 00:00:00 hours; } E1 -> ( if cacheSize < 0.7*MAX_CACHE_SIZE { prefetch ("http://www.Mysite.Com"); ) } ] 12 Webcal Execution Model DSL Compiler WebCal Program Caching Policy in Java Event-action Backbone Policies Jigsaw Library Web Cache 13 Status and on-going Work • Webcal: – Working prototype using Jigsaw – Event-action backbone / Compiler – Tested policies: prefetching, removal, placement • Experiments – Inter-cache protocols 14