Introduzione al Cloudcomputing Roberto Beraldi
Outline What is cloud computing Benefit of cloud computing Types of cloud computing Examples
What is cloud computing A style of computing in which dynamically scalable and often virtualized resources are provided as a service over the Internet. [Wikipedia]
Why is it called cloud? User Cloud with servers Services provided on virtualised resources Virtual machines spawned on demand Location of services no longer certain Pay as you go price model User
A new IT model? Cloud computing is likely to have the same impact on software that foundries have had on the hardware industry * Semiconductor foundries that produce chips for others fab-less semiconductor companies,whosevalue is innovative chip design Multiplexof state-of-the-art fabrication line [*] Above the Clouds: A Berkeley View of Cloud Computing
A new IT model? Production Transportation Users Utility computing
Benefit of cloud computing Flexibility: -Flexible provisioning -Add machines on demand -Add storage on demand Effort: -Low barrier to entry -Elimination of up-front commitment of cloud users -Initial effort: no need to spec and set up physical infrastructure -No need to maintain physical infrastructure
Cost: Benefit of cloud computing -No Initial capital expenditure -No Costs of over-provisioning for scalability -Pay for what you use Reliability: -Redundancy -Trust reliability of provider -Data backups -..but, what happens when provider goes down? - What about Security? Privacy?
Example: provisioning Provisioning for peak load Underprovisioning-1 Underprovisioning- 2
Cloud computing flavors (SaaS)Software as a Service XaaS (PaaS) Platform as a Service (IaaS) Infrastructure as a Service
XaaS Service Web URL (standard HTTP methods) web brower HTTP IaaS PaaS SaaS(aka Web API) Rest,XML-RPC,etc HTTP Programmatic Service Access (many methods) A service is usually deliverd through two access points: standard web browing(http) and Programmatic access (Rest,XML-RPC,SOAP, etc. over HTTP) Application
Example
Top Web API* 1) Google Maps mapping: 5 billion calls/day and 2184 mashups 2) Facebook-social networking: 5 billioncalls/dayand 237 mashups 3) Flickr- photos sharing: 567 mashups 4) Twitter microblogging : 3 billion calls/day, 75% ofall traffic and 547 mashups 5) Netflix video : about 1 billion calls/day 6) ebay auction: abouthalfbillioncalls/ dayand 206 mashups 7) Amazon- online storage: over 100 billion objects stored in S3 8) Salesforce.com CRM : over 50% of all their transactions 9) Twilio telephony: 144 mashups 10) Box.net online storage: 70 mashups (*) Source: GetApp.com
Example: Doodle
SaaSEx2: Google docs
Google forms Edit publish https://spreadsheets.google.com/viewform?formkey read
Flickr API Le funzioni del sito sono rese disponibili come servizi web Ci sono 3 differenti end- point, ciascuno per un formato di richiesta differente http://api.flickr.com/services/rest/ http://api.flickr.com/services/soap/ http://api.flickr.com/services/xmlrpc/
FacebookAPI The Graph API presents a simple, consistent view of the Facebooksocial graph, uniformly representing objects in the graph (e.g., people, photos, events, and pages) and the connections between them (e.g., friend relationships, shared content, and photo tags).
Graph API, simple but great idea friend relationship People People home books
Example Object ID
Example: query the object..
FacebookAPI
Another example: ORANGE
Dropbox is a free (up to 2GB), web-based cloud storage mechanism file backup service data sharing Data sync among different clients Mobile applications Windows IaaS Linux.mp3.avi.jpg iphone ipad MAC REST / JSON Blackberry Android
Features
DropboxAPI The DropboxAPI utilizes a REST-stylearchitecture over the HTTP protocol. In other words, many of the functions in it use standard URLs via GETor POST. All messaging is delivered in the JSONformat
Technology supported
Example of applications
Example (SourceKit) A Textmatelike lightweight programmer's text editor right inside of Chrome. It saves files directly to Dropbox, so if you have the Dropboxsync software installed, the changes will appear locally as if you did so with a text editor! Changes will be stored remotely so naturally this same extension will pull up the same copy of the file everywhere!
PaaS Ex1: GAE Cloud service for running web application on the Google data center Do one thing well Simple configuration Transparent scalability infinite number of applications, req/sec/ storage Security All applications run inside a sandbox, do not have direct access to file system, cannot open other connections
GAE architecture (simplified view) Requests App Eng Front End App Eng Front End App Eng Front End Load Balancer App Server App Server App Server Other Google Service API layer APP APP APP
GAE: supported language Java JVM, Java servlet, SDK Eclipse extension Python Standard library (without unsecure calls)
LAB: Hello Word in GAE What we need: Google account GAE registration Plafond free (10 app) Register a new application SDK The application ID will be used to deploy the application Python 2.5 +
Hello Word in GAE Step 1 Code helloworld.py Deploy Step 4 Google Cloud Web-based Admin console Conf app.yamlstep 2 Simulator Step 3 Try it now! (see get started)
Esempio application: helloworldversion: 1 runtime: python api_version: 1 handlers: -url: /.* script: helloworld.py print 'Content-Type: text/plain print '' print 'Hello, world!'
Python GAE architecture Stateless Google API Services REQ/REP CGI Sandbox URLfetch mail images Python VM Standard Lib App Read-only File system Stateful API BigTable MEMCACHE DATASTORE Fonte: Google App Engine Guido van Rossum
Python GAE architecture (scaling) Stateless Google API Services REQ/REP CGI HTTP (e.g., service time <10 sec, Size of a file < 1 MB) Sandbox URLfetch mail images Python VM Standard Lib App Read-only File system Queue of precreated processes Quota on resources Stateful API BigTable MEMCACHE DATASTORE Fonte: Google App Engine Guido van Rossum
PaaSexample2: Windows Azure It is a set of integrated cloud technologies each providing a specific set of services to application developers Windows Azure provides developer-accessible services for creating applications Strongly integrated with Visual studio Development fabric simulator Development storage simulator
Architecturalview Windows Azure provides a Window-based environment for running applications and storing data in MS datacenters SQL Azure provides data service in the cloud on SQL Server AppFabricprovides cloud service for connecting applications running in the cloud or on premises
Windows AzureArchitecture Compute service: allows to run applications following a specific programming model Storage serviceis available to cloud and on-premises applications. Accessed via REST The fabric layer provides virtualization(hyper-v)
Azure: Service Model Developers write their code and describes a service model Service model includes role definitions, VM size, instance count, endpoints, etc. Packaged code + the service model are uploaded to Azure, which deploys the service in the Microsoft Datacenters according the service
Deployement 1. Register (Live-id) Web Portal 2. Create Hosted-Service http://xxxx.cloudapp.net 3. Package upload.csconf +.cspkg Service Service Conf (n.inst. =3) Fabric Controller Service Service.cspkg
Difference with traditional programming model Interaction with the OS Previous release allows only run application in the user mode. Now removed Modify the system property is critical, however. The application can moved on other VM Storage must be external to role instances. File system is not a persistent storage! Interactions among roles Asynchronous through queues (though direct interaction is possible) Instances must be stateless
Programmingmodel A Windows Azure application is built from one or more roles A Windows Azure application runs multiple instances of the each role Each on these instances run inside a VM provided by the hypervisor Hyper-V Number of instances are defined via a configuration file (is not varied automatically) A Windows Azure application behaves correctly when any role instance fail
Roles Web roles are intended to accept and process HTTP requests using IIS (Internet Information Service) Developers can create Web role instances using various technologies including ASP.NET, Windows Communication Foundation (WCF), PHP and java Worker rolesare intended to perform background jobs. They typically interact with the Web role via a queue VM rolesrun an image (Virtual Hard Disk, VHD) of a Windows Server 2008 R2 virtual machine The VHD is created using on-premises machine
Example 2 tier application model: web role (front-end) and worker role (back-end) Application designed to scale-out(multiple copies on different VM) rather than scale-up(one copy on a bigger machine) No affinity among roles: multiple request can be sent to different instances
Iaas: Amazon Web Service
IaaSExample: SeeWEB http://www.seeweb.it/cloudserver/ Calcolatore
La nuvolaitaliana
Cloud actors
Grid computing Use of a computational grid Allows to share computation resources (computers, clusters,.. storage, db) and special devices (e.g., telescopes) among virtual organizations Resources are managed by different organization Usually for scientific purpose Simple yet effective example: Seti@home More precisely it desktop grid or Volunteer computing
SETI: Search for Extra-Terrestrial Intelligence Internet Data is recorded on highdensity tapes at the Arecibo telescope in Puerto Rico and sent to Berckely The data is then divided into 0.25 Mbyte chunks(which we call "work-units") 10 KHz x 2 (Nyquist) x 100 s x 8 bit These are sent from the Seti@Home server over the Internet to people around the world to analyze.
SETI Find deviations from Gaussian Get data chunk from the central server (radiotelescope) FFT as screensaver
http://lhcathome.cern.ch/grid/index.shtml
Macchine virtuali Una macchina virtuale è una macchina Logica realizzatain software (M L ) chegirasuuna macchinafisica(m F ) Due tipi principali di emulazione Emulazionenon nativa. M L M F Tipicamente Process virtual machine Emulazionenativa. M L =M F Tipicamente System virtual machine
Processvirtualmachine Gira come processo SW Utile per ottenere portabilità ed interoperabilità di applicazioni Java Virtual Machine Common Language Runtime (CLR), cuore dell architettura.net
Macchina virtuali ed interoperabilità Java Virtual Machine (JVM) ISA: Macchina a stack (zero-register) Linguaggio macchina: Bytecode Java JVM Portabilità: writeonce run everywhere M F1 M F2 M Fn
Macchina virtuali ed interoperabilità Common Language Runtime (CLR);.NET framework Macchina a stack (zero-register) Common Intermediate Language (CIL); MSIL Cross-language integration C# VB F# IL M F1 M F2 M Fn Compiltatore di front-end Compiltatore di back-end Just In Time (JIT)
System virtualmachine La Macchina virtuale riproduce la stessa macchinafisica( Efficient, isolated duplicate of a real machine * ) La virtualizzazioneè realizzatadaun Virtual Machine Monitor (VMM) o hypervisor Processo: SO = Supervisor : Hypervisor
System virtualmachine Due tipologie principali di hypervisor Full virtualization Il SO gira senza alcuna modifica(vmware) Necessario per SO legacy Paravirtualization Il SO deveesseremodificatoper effettuarehyper Calls (Xen) Maggiore efficienza
VMM-propietà Fidelity OgniprogrammachegirasullaVM (dalvmm) deve avere lo stesso comportamento dello stesso programma eseguito sul sistema fisico Safety Controllo completo delle risorse virtualizzate Efficiency Una buona percentuale di istruzioni deve essere esguita senza l intervento del VMM
Risorse Xenand the Art of Virtualization, Pratt et al. SOSP 2003. A Comparison of Software and Hardware Techniques for x86 Virtualization, K. Adams, O. Agesen. ASPLOS 2006.
Classical virtualization A classical VMM executes guest operating system directly, but at a reduced privileged level. The VMM intercepts traps from the deprivileged guest, and emulates the trapping instruction against a virtual machine state [*] Teorema: Se tuttele istruzionisensibili(chepossonomodificarelo stato delle risorse) girano in modalità protetta, allora è possibile realizzare un VMM seguendo la classical virtualization Le archietterurex86 (32 e 64 bit) no hw assisted non sono virtualizzabiliin modoclassico(p.e. popfnon genera trap) Tali architetturex86 sonovirtualizzate mediantealtretecniche, come la tecnica Binary Translation usata nei VMM della VMWare [*] A camparisonof Software and Hardware Techniques for x86 Virtualization, K.Adams, O.Agesen, ASPLOS 2006
Classicalvirtualization, esempio a. La CPU esegue un istruzione Livello User privilegiata, ma sitrovain Guest OS modalità utente b. La CPU genera unatrap 1 c. Il controllopassaal VMM che emula l istruzione ed esce(il 2 controllo ritorna al SO guest) d. Nota 2 non e la stessa 3 istruzione 2 ma un insiemedi istruzioni che emulano la 2 4 modificando lo stato della macchina virtuale (per 5 esempio, CLI VCPU.IF=0) tempo trap Livello Kernel VMM 2 Istruzione non privilegiata Istruzione privilegiata p.e. CLI, Clear Interrupts verde= User Mode rosso = System Mode
Software Virtualization L architetturax86 non è virtualizzabilein modoclassico(p.e., popf non genera trap) Unatecnicaalternativadivirtualizzazioneè scrivereun interprete software che esegue le istruzioni modificando una CPU virtuale, VCPU (anche diversa da quella fisica) Binary Translation(BT): Il codicemacchinaviene tradotto in codice eseguibile direttamente dalla CPU (emulazione nativa)
Software Virtualization Molte istruzioni sono in realtà identiche a quelle di partenza! Solo quelle sensibili sono tradotte in una serie di istruzioni che modificanola VCPU e le strutturedatidisupportoal S.O. La traduzione del codice binario è dinamica(avviene a runtime, interleaving ditraduzionediblocchidicodice p.e. 12 istruzioni-edesecuzione) e on-demand
Type-1 hypervisor(bare metal) Il Guest OS gira senza alcuna modifica(full virtualization) Hardware Server (cloud computing) Esempi: Hyper-V(Microsoft), VMWare ESX
Type-2 hypervisor(hosted) Gira sopra un Sistema Operativo(detto Host) Guest OS non modificato(full virtualization); Guest OS giraal 3 livello (minore efficienza) Spesso usato lato client
Paravirtualization Richiede una modifica(porting) del Sistema Operativo poichè è necessario prevedere chiamate esplicite all hypervisor(hypercall) Elevata efficienza