Advanced Distributed Systems Cristian Klein Department of Computing Science Umeå University During this course Treads in IT Towards a new data center What is Cloud computing? Types of Clouds Making applications Cloud-ready 1/43 2/43 Internet is everywhere Trends in IT Source: w3.org More Number and more of mobile, users always-connected are users is increasing Home bandwidth Total Internet follows bandwidth Nielson's law: is It doubles increasing every 21 exponentially months (some say 12) Source: ITU 3/43 4/43 Frequency barrier hit Management costs increase Since 2003, (single-core) processor speed stopped increasing 5/43 6/43 1
24/11/14 Power & Cooling expensive Increasing prosumarism Users both produce and consume content Need efficient means to share it 7/43 8/43 Business face rapid growth Towards a new data center 9/43 regular peaks 10/43 expected peaks Wikipedia Traces Load on the FIFA 98 Website Daily, weekly and yearly patterns Marketing campaigns Christmas Tax filling 11/43 12/43 2
unexpected peaks and need to provision for such load Over-provisioning Under-provisioning wasted resources lost clients Source: Google blog Legend: actual load provisioned load time time Ideally: auto-scaling Triggered by news/events time 13/43 14/43 NIST definition What is Cloud computing? Cloud computing is a model for enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction. You do not own computing infrastructure, you rent it 15/43 16/43 Essential Characteristics On-demand self-service User can provision resources without human intervention Broad network access Service is accessible through the network Resource pooling Resources are pooled to several costumers Rapid elasticity Can rapidly increase and decrease capacity Measured service Resource usage can be monitored, reported Service models SaaS: Software as a Service Ready to use applications E.g.: Gmail, Google Docs, YouTube, Facebook PaaS: Platform as a Service Ready to use tools E.g.: Google Apps Engine IaaS: Infrastructure as a Service Fundamental computing resources E.g., Amazon EC2, Amazon S3, Windows Azure 17/43 18/43 3
Deployment models Private cloud ( my stuff ) Institution resources managed in a Cloud-like fashion Community cloud ( our stuff ) Share resources among institutions Public cloud ( anyone's stuff ) Resources to rent by anybody with a credit card Hybrid cloud A combination of the above 19/43 Types of Clouds 20/43 Infrastructure as a Service (IaaS) Virtualization Fundamental computing resources CPU, RAM, storage, network, etc. Mostly in an virtualized way Details of the underlying physical resources are hidden from the user 1 2 OS 1 OS 2 Physical Machine 1 Physical Machine 2 1 2 OS 1 OS 2 Virtual Machine 1 Virtual Machine 2 Hypervisor 21/43 Physical Machine Hypervisors: Xen, VMware, KVM, Microsoft Hyper-V Isolates different users Flexible infrastructure management: consolidation At VM start: mapping During VM execution: migration 22/43 Public IaaS Clouds Amazon: EC2, S3 Windows Azure RackSpace E.g.: Amazon EC2 1 year micro instance for free Try it yourself! Small: 0.60 $/hr 8XL: 4.60 $/hr For comparison: 8XL in your own datacenter: 1.50 $/hr (estimated) Abisko @ HPC2N: 0.07 $/core/hr (source: P-O) Open-source solutions Useful to build private/community/ hybrid clouds Production-oriented Eucalyptus, CloudStack, OpenStack Research-oriented OpenNebula, Nimbus 23/43 24/43 4
IaaS Cloud standards De-facto: Amazon WSDL-based createinstance() startinstances(), stopinstances() Open Cloud Compute Interface (OCCI) REST-based Cloud-ready applications Almost any application can run in the Cloud, but they are not Cloud-ready Use API to auto-scale needs to be elastic load POST /compute/ HTTP/1.1 Category: compute [...] X-OCCI-Attribute: occi.compute.cores=2 X-OCCI-Attribute: occi.compute.hostname="foobar" HTTP/1.1 201 OK Location: http://example.com/vms/foo/vm1 25/43 time 26/43 1 VM per tier Client Database 27/43 28/43 Scalable architecture Add auto-scaling Client read write Client read write Load balancer Load balancer 1 2 1 2 n Master DB Slave DB 1 replicate 29/43 Master DB Slave DB 1 Slave DB n-1 replicate replicate 30/43 5
IaaS pros and cons Platform as a Service (PaaS) Pros General purpose Very flexible Cons Low-level, fine-grained Need to handle application Deployment Elasticity Failure 31/43 Provides programming languages, libraries, services and tools Higher level than IaaS Special purpose Less flexible Examples For web applications: Google Apps Engine For BigData processing: MapReduce 32/43 Google Apps Engine Develop and host web applications Take advantage of Google technologies for scalability, resilience Python, Java, Go Several APIs Images, Mail, Log Blobstore, Datastore, BigTable Hello Google Apps Engine helloworld.py import webapp2 class MainPage(webapp2.RequestHandler): def get(self): self.response.headers['content-type'] = 'text/plain' self.response.write('hello, webapp2 World!') app = webapp2.wsgi([('/', MainPage)], debug=true) app.yaml application: helloworld version: 1 runtime: python27 api_version: 1 threadsafe: true Try it, it's free! handlers: - url: /.* script: helloworld.app 33/43 34/43 MapReduce A programming model for processing large data sets (BigData) Difficult due to scalability, failure, etc. Useful for: Indexing, Financial Analysis, etc. Used by Google, Yahoo!, Facebook Open source implementation: Hadoop MapReduce: Logical View Operates on several key-value spaces: (1) input, (2) intermediate, (3) output Map : (key, value ) (key, value ) 1 1 2 2 Reduce : (key, list(value )) list(value ) 2 2 3 35/43 Source: blog.maxgarfinkel.com 36/43 6
MapReduce: Word count function map(string name, String document): for each word w in document: emit (w, 1) function reduce(string word, list partialcounts): sum = 0 for each partialcount in partialcounts: sum += partialcount emit (word, sum) Spark General-purpose BigData engine Most operations in-memory Allows interactive use 37/43 38/43 Spark: More Examples Final thoughts 39/43 40/43 Clouds vs. Grids Clouds Grids Origin Industry Academic Economic model Public: pay-per-use Other: domain-specific (e.g., grant models) Grant models Size of allocation Many small users Few big users Waiting time On-demand Queuing Duration Long (months) Short (< 4h) Usual workload Interactive Long-lived services Non-interactive Jobs Organization One provider Multiple providers 41/43 Cloud issues Privacy What happens to your data? Security Sometimes VM provide insufficient isolation Standardization is lagging behind Important to prevent vendor lock-in IaaS: less of a problem PaaS: major problem 42/43 7
Conclusion IT trends Frequency barrier Infrastructure complexity Omnipresent network connection What are Clouds: rent computing resources, rapid elasticity Types of Clouds: IaaS, PaaS, SaaS Making an application Cloud ready Challenges remaining 43/43 8