Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Designing Resource-Aware Applications for the Cloud with ABS

8,732 views

Published on

We discuss how to use models to make and compare deployment decisions for services deployed on the Cloud.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Designing Resource-Aware Applications for the Cloud with ABS

  1. 1. Designing Resource-Aware Applications for the Cloud with ABS Einar Broch Johnsen University of Oslo, Norway einarj@ifi.uio.no 1st Intl. Workshop on Formal Methods for and on the Cloud (iFMCloud) Reykjavik, Iceland, 04 June 2016 http://www.envisage-project.eu Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 0 / 22
  2. 2. We want to make e↵ective use of cloud computing to meet service requirements Cloud API Application Service I Virtualization makes elastic amounts of resources available to application-level services I Metered resources: Resources on the Cloud are pay-on-demand I Services need to share and scale resources I Digitalization: new services need to share resources with old services Discovering bad resource management after deployment on the Cloud can be a very costly (wasting both time and money!) Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 1 / 22
  3. 3. Services deployed on the cloud: Predicting behavior from models ApplicationServer DC4 DC3 CalcServerDC2 CalcServer DC1 CalcServer AppWorkflow CloudProvider Invoke task # of VM Total Cost Application Server = Application Workflow + Application Resource Management (load balancing, scalability) CalcServer = Independent tasks (can be parallelized) AppRM I Resource-aware design: Build software that can dynamically modify its own deployment to improve perfor- mance and/or reduce cost I Model-based deployment decisions at design time using service models I Formal semantics: Architects and developers can simulate and analyze at design time how an application runs on the cloud H¨ahnle, Johnsen. Designing Resource-Aware Cloud Applications. IEEE Computer 48(6), 2015 Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 2 / 22
  4. 4. What kind of questions can we answer using models? Berndnaut Smilde: Nimbus II, 2012 Model-based analysis of performance vs. cost 1 How will the response time and cost of running my system change if I double the number of servers? 2 Can I meet my performance requirements with my current deployment strategy? What about fluctuations in client tra c? 3 Can I control the performance of my system better by using a custom resource manager? Use the model to predict behavior Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 3 / 22
  5. 5. Conceptual Parts of a Deployed Cloud Service Provisioning Layer Legal Contract Layer Formal Service Contract Executable Model of Client Layer Cloud API Simulation “early modeling” Formal Methods “early analysis” Provisioning “runtime monitoring” Combine techniques based on abstract executable models I Formal modeling using Abstract Behavioral Specifications (ABS) I Formal methods: Verification, Performance Analysis, Cost Analysis, Advanced Type Systems, Code Generation, Test-Case Generation I Monitoring: Framework to generate monitors for SLA-compliance Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 4 / 22
  6. 6. Example: Phone Services - Abstract Behavioral Model Telephone Service interface TelephoneService { Unit call(Int calltime); } class TelephoneServer implements TelephoneService { Int callcount = 0; Unit call(Int calltime){ while (calltime > 0) { [Cost: 1] calltime = calltime 1; await duration(1, 1); } callcount = callcount + 1; } } SMS Service interface SMSService { Unit sendSMS(); } class SMSServer implements SMSService { Int smscount = 0; Unit sendSMS() {[Cost: 1] smscount = smscount + 1;} } Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 5 / 22
  7. 7. Example: The New Year’s Eve Client Behavior 50 70 Alternate sms and call Huge number of sms per time interval time Alternate sms and call Midnight Window class NYEclient(Int frequency,TelephoneService ts,SMSService smss){ Time created=now(); Bool call=false; Unit normalBehavior(){ ... } Unit midnightWindow(){ ... } // Switch at appropriate time... } {// Main block: DC smscomp = new DeploymentComponent(”smscomp”, Speed(50)); DC telcomp = new DeploymentComponent(”telcomp”, Speed(50)); [DC: smscomp] SMSService sms = new SMSServer(); [DC: telcomp] TelephoneService tel = new TelephoneServer(); Client c = new NYEbehavior(1,tel,sms); ... // Clients } How to deploy the services? Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 6 / 22
  8. 8. Example: Simulation Results Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 7 / 22
  9. 9. Load Balancing in Deployment Scenarios smscomp telcomp Client Client sms() call(n) sms() call(n) tel sms telb smsb request() Resource awareness: resource reallocation, object mobility, job distribution I dc.load(e): average load on dc during the last e time intervals I dc.total(): currently allocated resources on dc I dc.transfer(dc2, r): transfer r resources to dc2 Load Balancing Strategy for the Phone Services Example: Reallocate 1/2⇥total resources upon request from partner Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 8 / 22
  10. 10. Example: Simulation Results Johnsen, Owe, Schlatte, Tapia Tarifa: Dynamic Resource Reallocation between Deployment Components. Proc. ICFEM 2010 Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 9 / 22
  11. 11. ABS: Abstract Behavioral Specification ABS: Between design-oriented and implementation-oriented specification I State-of-the-art modeling language: actors + OO I Models follow the execution flow of OO programs, but abstract from implementation details using ADTs I ABS allows time modeling and deployment modeling I Java-like syntax: intuitive to the programmer ABS is a formal, tool-supported modelling language I Operational semantics allows advanced analysis techniques I Simulation tool for rapid prototyping I Automated worst-case resource and deadlock analysis I Automated optimization of static deployment I Semi-automated scalable verification of functional correctness (KeY) I Code generation into Java and Haskell (preserves cost bounds) Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 10 / 22
  12. 12. Deployment Components Deployment components are abstract execution locations I Each deployment component has a given resource capacity I Objects execute in the context of a deployment component Server ... ... objectEnv [cost] Task1 [cost] Task2 object 1 [cost] Task1 [cost] Task2 object n [cost] Task1 [cost] Task2 I The resources are shared between the component’s objects I Object execution uses resources in a deployment component (via Cost annotations) I How resources are assigned and consumed, depends on the kind of resource Johnsen, Schlatte, Tapia Tarifa. Integrating deployment architectures and resource consumption in timed object-oriented models. J. Log. Algebr. Meth. Program. 84(1), 2015 Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 11 / 22
  13. 13. A Resource-Aware Application in ABS interface CalcServer { Unit process(Int cost); DC getDC(); } class Server implements CalcServer { Unit process(Int cost) { [Cost: cost] skip; } DC getDC() { return thisDC(); } } interface ApplicationServer { Bool request(Int cost); } ApplicationServer DC4 DC3 CalcServerDC2 CalcServer DC1 CalcServer AppWorkflow CloudProvider Invoke task # of VM Total Cost Application Server = Application Workflow + Application Resource Management (load balancing, scalability) CalcServer = Independent tasks (can be parallelized) AppRM class ConstantBalancer(CloudProvider provider, Int serverSize) implements ApplicationServer { Server server; DC dc; Bool initialized = False; Unit run() { Fut<DC> f = provider!createMachine(serverSize); await f?; dc = f.get; [DC: dc] server = new Server(); initialized = True; } Bool request (Int cost) { await initialized; Fut<Unit> r = server!process(cost); await r?; return (durationValue(deadline()) > 0); } } Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 12 / 22
  14. 14. A Resource-Aware Application in ABS interface CalcServer { Unit process(Int cost); DC getDC(); } class Server implements CalcServer { Unit process(Int cost) { [Cost: cost] skip; } DC getDC() { return thisDC(); } } interface ApplicationServer { Bool request(Int cost); } ApplicationServer DC4 DC3 CalcServerDC2 CalcServer DC1 CalcServer AppWorkflow CloudProvider Invoke task # of VM Total Cost Application Server = Application Workflow + Application Resource Management (load balancing, scalability) CalcServer = Independent tasks (can be parallelized) AppRM class DynamicBalancer(CloudProvider provider) implements ApplicationServer { Map<Int, Set<Server>> sleepingMachines = EmptyMap; Int machineStartTime = ... // a constant representing the time it takes to start a machine; Bool request (Int cost) { Int requiredResources = (cost / durationValue(deadline())) + 1 + machineStartTime; Server server = this.getMachine(requiredResources); Fut<Unit> r = server!process(cost); await r?; this.dropMachine(server); return durationValue(deadline()) > 0; } Server getMachine(Int size) { ... } // take machine of size if it exists, otherwise create one Unit dropMachine(Server server) { ...} } Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 12 / 22
  15. 15. Rapid Prototyping: Simulation Results I Define client behavior to model a load spike time Increase the # of requests I Simulate the di↵erent scenarios with ABS simulator User scenario Load spike Strategy QoS Total Cost Constant balancer 53% 200 As-needed balancer 100% 128 I QoS: measure the successful requests (i.e., requests completed within the deadline) divided by the total number of requests I Total Cost: measures the accumulated sum of CPU resources made available by the cloud provider. Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 13 / 22
  16. 16. Case Study: Montage (1) Montage is a toolkit for assembling astronomical images into customized mosaics mProject mProjExec mImgtbl mOverlaps mDiffExec mDiff mFitExec mFitplane mBgModel mBackground mBgExec mAdd Re-project Image Background modeling Background matching Final mosaic Partly ordered workflow and highly parallelizable tasks. Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 14 / 22
  17. 17. Case Study: Montage (2) DC4 DC3 CalcServerDC2 CalcServer DC1 CalcServer CloudProvider Invoke task ApplicationServer = AppWorkflow + AppRM CalcServer = Independent tasks # of VM Total Cost ApplicationServer AppWorkflow AppRM Model the Montage toolkit using the Cloud Provider API, run simulations varying the di↵erent deployment scenario and compare the results. Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 15 / 22
  18. 18. Case Study: Montage (3) Cost vs. Time Tradeo↵: can we reproduce the results of other informal cloud simulation tools (GridSim)? !" !#" !##" !###" !####" !" $" %" &" !'" ($" '%" !$&" !" #$" $!" %$" &!!" &" #" '" (" &)" *#" )'" &#(" Logarithmicscale 60 cents for 1 processor Logarithmicscale approx 4 $ for 128 processors approx 5.5 hrs for 1 processor approx 18 min for 128 processors 432 270 1152 CPUCost 89 2 8 Time The cost of doing science on the cloud: The Montage example. E. Deelman, G. Singh, M. Livny, G. B. Berriman, and J. Good. (SC’08), pages 1–12. IEEE/ACM, 2008. Johnsen, Schlatte, Tapia Tarifa. Modeling Resource-Aware Virtualized Applications for the Cloud in Real-Time ABS. Proc. ICFEM 2012 Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 16 / 22
  19. 19. Case Study: Fredhopper Replication Server (1) The Fredhopper Access Server (FAS) is a distributed, concurrent OO system providing search and merchandising services to e-Commerce companies. The Replication Server is one part of FAS. Acceptor Cloud Provider ClientJob ClientJob ClientJob SyncClient job(schedule) SyncClient SyncClient... ... LIVE STAGING SyncServer create() CLOUD DC4 Connection Thread getConnection(schedule) getConnection(schedule) getConnection(schedule) job(schedule) job(schedule) DC3 Connection Thread replication DC2 Connection Thread replication DC1 Connection Thread replication I Very detailed model: consists of 5000 lines of ABS Albert, de Boer, H¨ahnle, Johnsen, Schlatte, Tapia Tarifa, Wong. Formal modeling and analysis of resource management for cloud architectures: an industrial case study using Real-Time ABS. Service Oriented Computing and Applications 8(4), 2014 Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 17 / 22
  20. 20. Case Study: Fredhopper Replication Server (2) How does the accumulated cost in our model compare to the actual Java implementation? 0 17.5 35 52.5 70 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0 7500 15000 22500 30000 Runningtime[s] Environments Simulationcost Model simulation cost Implementation running time Measured execution time of the implementation (left scale) Accumulated cost of the simulation (right scale) The deviation roughly seems to correspond to the start-up time of JVM Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 18 / 22
  21. 21. Case Study: Hadoop YARN Clusters (1) Open-source software framework that implements a cluster management technology for distributed processing. Popular cloud framework for big data processing: I Resource allocation I Code distribution I Distributed data processing Lin, Yu, Johnsen, Lee. ABS-YARN: A Formal Framework for Modeling Hadoop YARN Clusters. Proc. FASE 2016 Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 19 / 22
  22. 22. Case Study: Hadoop YARN Clusters (2) How does the ABS YARN compare to the actual YARN implementation? (a) The normalized starting time (b) The normalized finish time (c) Cumulative completed jobs (d) Total number of completed jobs Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 20 / 22
  23. 23. The ABS Collaboratory I ABS as a web service, with documentation and examples under development at http://www.abs-models.org I Tools are open source: https://github.com/abstools I ABS API available for orchestration of Java code I Eclipse plug-in for ABS Get involved! Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 21 / 22
  24. 24. Summary Virtualization requires novel modeling abstractions Executable models, deployment components, reflection ABS: Abstract Behavioral Specification I Model deployed services with dynamic resource management I High-level abstractions of low-level platform-specific concerns I Analysis methods: performance, cost analysis, deadlock analysis, . . . I More info and open source tools: www.abs-models.org Make your deployment decisions at design time! ABS permits concise modeling and accurate prediction Engineering Virtualized Services [www.envisage-project.eu] Einar Broch Johnsen (UiO) Designing Resource-Aware Applications iFMCloud, 04.06.2016 22 / 22

×