Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Introduzione al Cloud computing
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?
• Services provided on virtualised resources
• Virtual machines spawned on demand
• Location of services no longer certain
• Pay as you go price model
User
UserCloud with servers
A new IT model?
• “Cloud computing is likely to have the same impact on
software that foundries have had on the hardware industry”*
“fab-less” semiconductor
companies,whose value is
innovative chip design
Semiconductor foundries that
produce chips for others
Multiplex of state-of-the-art
fabrication line
[*] Above the Clouds: A Berkeley View of Cloud Computing
A new IT model?
Production Transportation Users
Utility 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
Benefit of cloud computing
Benefit of cloud computing• Cost:
-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
Storage service in the cloud
Cloud computing flavors
(IaaS) Infrastructure as a Service
(SaaS)Software as a Service
XaaS (PaaS) Platform as a Service
XaaS
• A service is delivered through two access points:
• Standard web browsing (HTTP) and
• Programmatic access (Rest,XML-RPC,SOAP, etc. over HTTP)
Programmatic Service Access
(many methods)
Web URL
(standard HTTP methods)
web browerHTTP
Application
HTTP
Rest,XML-RPC,etc
Service
PaaS
IaaS
(a.k.a. web API) SaaS
Software as a Service
• A SW application that runs remotely
• Does not require any local special installation (accessed through standard methods), e.g., js program making calls from within a browser
• SW components do not interact with each other; rather they are ‘orchestrated’ remotely…
SW applicationSW Component
Client SW
Example
Top Web API*
1) Google Maps – mapping: 5 billion calls /day and 2184 mashups
2) Facebook - social networking: 5 billion calls /day and 237 mashups
3) Flickr- photos sharing : 567 mashups
4) Twitter – microblogging : 3 billion calls /day , 75% of alltraffic and 547 mashups
5) Netflix – video : about 1 billion calls/day
6) eBay – auction : about half billion calls/ day and 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@2011
Example: Doodle®
SaaS example
Google forms
Edit
publishhttps://spreadsheets.google.com/viewform?formkey
read
Google docs®
Google APIs
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/soap/
http://api.flickr.com/services/rest/
http://api.flickr.com/services/xmlrpc/
Facebook API
• “The Graph API presents a simple, consistent view of the Facebook social 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
People People
friend relationship
home books…
ExampleObject ID
Example: query the object..
Facebook API
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
Android
iPhone
iPad
Blackberry
Windows
Linux
MAC
.mp3
.avi.jpg
REST / JSON
Storage as a Service
Features
Dropbox API
The Dropbox API utilizes a REST-style architecture over the HTTP
protocol. In other words, many of the functions in it use standard URLs
via GET or POST. All messaging is delivered in the JSON format
Technology supported
Example of applications
Example (SourceKit)
• A Textmate like lightweight programmer's text editor right inside of Chrome. It saves files directly to Dropbox, so if you have the Dropbox sync 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!
Another example
Platform as a Service
• Provide a ‘platform’ for application
development
• Developers do have access to a SDK that
allows to develop a new application and to
deploy it in the cloud
• Impact on the programming model
• Google’s app engine, Windows Azure,
Picloud…
PaaS – Ex1: GAE
• Cloud service for running web applications 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
• Google App Engine speaks with web applications through the Web Server Gateway Interface (WSGI) standard protocol
• App Engine and SDK includes the webapp2 framework that implements WSGI
– Advanced frameworks can be used, e.g., Django
WEB AppHTTP Requests
WEB Server
WSGI Protocol
GAE: supported language
• Java
– JVM, Java servlet, …
– SDK Eclipse extension
• Python
– Standard library (without ‘unsecure’ calls)
• Go
LAB: Hello Word in GAE
• What we need:
– Google account
– GAE registration
• Plafond free (10 app)
– Register a new application
• The application ID will be used to deploy the
application
– SDK
– Python 2.7 (does not support 3.x)
Hello Word in GAE
helloworld.py
app.yaml
Code
ConfSimulator
“Google Cloud”Deploy
Web-based Admin console
Step 1
Step 3
Step 2
Step 4
Hello Word in GAE
• Define a handler for the HTTP requests as a class that extends webapp2.RequestHandler class (MainPage)– Attributes : response, request (instance of class Request, Response)
– Methods: get,post, etc.. (to override)
• Map HTTP get request to get method (also post, put, etc..)
• Write data to HTTP response through self.response
• app is a global name that must assigned to the application
helloworld.py
Code
Step 1
app.yaml
Conf
“Google Cloud”Deploy
Web-based Admin console
Step 3
Step 4
• An application name helloword must be registered with the google engine– helloworld.appspot.com
appcfg.py update .
GAE architecture (simplified view)
App Eng
Front End
App Eng
Front End
App Eng
Front End
App Server
Loa
d
Ba
lan
cer
App Server App Server
API layer
APP APP APP
Other
Service
HTTP Requests
Python GAE architecture
Python
VM
Standard
Lib
App
Read-only
File system
Source: Google App Engine – Guido van Rossum
REQ/REP
DATASTOREMEMCACHE
BigTable
URLfetch
images
ServicesSandbox
Stateless Google API
Stateful API
CGI
Python GAE architecture (scaling)
Python
VM
Standard
Lib
App
Read-only
File system
Source: Google App Engine – Guido van Rossum
REQ/REP
DATASTOREMEMCACHE
BigTable
URLfetch
images
Services
Stateless Google API
Stateful API
HTTP (e.g., service time <10 sec,
Size of a file < 1 MB)
•Queue of precreated
processes
•Quota on resources
SandboxCGI
More complex example
• Use a google calendar through your own
application
• OAuth 2.0 required to grant access (token)
• Calendar API call requires the token
• Application must be registered to the Google
API console
Google Calendar
• Event
• Calendar
• CalendarList
API
REST
Actors
Developer
User
Web application
Google API console
developregister
define: redirect_uri
authenticate
User consent
consent
OAuth Authorization
server
User authentication and consensus
Authorization
Server
http://accounts.goole.com /o/oauth2/auth
GET accounts.google.com/o/oauth2/auth?
response_type=code&
scope=https://www.googleapis.com/auth/calendar&
redirect_uri=https://xxxxxx/oauth2callback&
client_id=<given at registration time>&
hl=it
…
http://code.google.com/intl/it-IT/apis/accounts/docs/OAuth2.html
http://code.google.com/intl/it-IT/apis/accounts/docs/OAuth2WebServer.html
Passing authorization
Browser
Autherization
Server
Callback
Web application
GET
Redirect (302)
Location: http:// code=..
Registering the application
to be used inside authetication requests
URI used to redirect the browser after authentication
(specified during application registration)
Obtaining an access token
home.pyoauth2callback.py
OAuth Server
- url: /.*
script: home.app
- url: /oauth2callback.*
script: oauth2callback.app
secure: always
app.yaml
Cloud Application
…
Performing operations
oauth2callback.py
Calendar
Cloud Application
Rest endpoint
Mobile cloud computing
Repubblica del 31 marzo
Get the list of events from a calendar
• Demo
Another example: Trip support
• In this example, events are trips from one city
to another
• We add support by weather conditions and
directions
PaaS example2: 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
Architectural view
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
AppFabric provides cloud
service for connecting
applications running in the
cloud or on premises
Windows Azure Architecture
The fabric layer provides
virtualization (Hyper-V)
Compute service: allows to
run applications following a
specific programming model
Storage service is available to
cloud and on-premises
applications. Accessed via
REST
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
DeployementWeb Portal
1. Register (Live-id)
Conf(n.inst. =3)
Fabric
Controller
Service
.cspkg
Service
Service
Service
2. Create Hosted-Service
http://xxxx.cloudapp.net
3. Package upload
.csconf + .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
Programming model
• 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 roles are intended to perform background jobs. They
typically interact with the Web role via a queue
• VM roles run 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
PiCloud (python)
Iaas: Amazon Web Service
IaaS Example: SeeWEB
http://www.seeweb.it/cloudserver/
Calcolatore
La “nuvola italiana”
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
Data is recorded on high-density 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.
Internet
SETI
• Find deviations from Gaussian
• Get data chunk from the central server (radio-telescope)
• FFT as screensaver
http://lhcathome.cern.ch/grid/index.shtml
Macchine virtuali
• Una macchina virtuale è una macchina Logica
“realizzata in software” (ML) che gira su una
macchina Fisica (MF)
• Due tipi principali di emulazione
• Emulazione non nativa. ML≠MF
– Tipicamente Process virtual machine
• Emulazione nativa. ML=MF
– Tipicamente System virtual machine
Process virtual machine
• 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
JVM
MF1 MF2 MFn
Java
• Portabilità:
“write once run
everywhere”
Macchina virtuali ed interoperabilità
• Common Language Runtime (CLR); .NET framework
– Macchina a stack (zero-register)
– Common Intermediate Language (CIL); MSIL
IL
MF1 MF2 MFn
C# VB F#
Compiltatore di
back-end
Just In Time (JIT)
Compiltatore di
front-end
• Cross-language
integration
System virtual machine
• La Macchina virtuale riproduce la stessa
macchina fisica (“Efficient, isolated duplicate
of a real machine”*)
• La virtualizzazione è realizzata da un Virtual
Machine Monitor (VMM) o hypervisor
• Processo : SO = Supervisor : Hypervisor
System virtual machine
• Due tipologie principali di hypervisor
• Full virtualization
– Il SO gira senza alcuna modifica (VMWare)
– Necessario per SO legacy
• Paravirtualization
– Il SO deve essere modificato per effettuare Hyper Calls (Xen)
– Maggiore efficienza
VMM- propietà
• Fidelity
– Ogni programma che gira sulla VM (dal VMM) deveavere lo stesso comportamento dello stessoprogramma eseguito sul sistema fisico
• Safety
– Controllo completo delle risorse virtualizzate
• Efficiency
– Una buona percentuale di istruzioni deve essereesguita senza l’intervento del VMM
Risorse
• Xen and 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 de-privileged guest, and emulates the trapping instruction against a virtual machine state”[*]
• Teorema: Se tutte le istruzioni sensibili (che possono modificare lo stato delle risorse) girano in modalità protetta, allora è possibilerealizzare un VMM seguendo la “classical virtualization”
• Le archietterure x86 (32 e 64 bit) no hw assisted non sonovirtualizzabili in modo classico (p.e. popf non genera trap)
• Tali architetture x86 sono virtualizzate mediante altre tecniche, come la tecnica “Binary Translation” usata nei VMM della VMWare
[*]”A camparison of Software and Hardware Techniques for x86 Virtualization”, K.Adams, O.Agesen, ASPLOS 2006
Classical virtualization, esempio
1
3
4
5
Guest OS Istruzione non privilegiata
verde = User Mode
rosso = System Mode
Istruzione privilegiata
p.e. CLI, Clear Interrupts
2trap
VMM
tempo
2’
Livello User Livello Kernela. La CPU esegue un’istruzione
privilegiata, ma si trova in
modalità utente
b. La CPU genera una trap
c. Il controllo passa al VMM che
emula l’istruzione ed esce (il
controllo ritorna al SO guest)
d. Nota 2’ non e’ la stessa
istruzione 2 ma un insieme di
istruzioni che emulano la 2
modificando lo stato della
macchina virtuale (per
esempio, CLI�VCPU.IF=0)
Software Virtualization
• L’architettura x86 non è virtualizzabile in modo classico (p.e.,
popf non genera trap)
• Una tecnica alternativa di virtualizzazione è scrivere un
interprete software che esegue le istruzioni modificando una
CPU virtuale, VCPU (anche diversa da quella fisica)
• Binary Translation (BT): Il codice macchina viene “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
modificano la VCPU e le strutture dati di supporto al S.O.
• La traduzione del codice binario è dinamica (avviene a run-
time, interleaving di traduzione di blocchi di codice – p.e. 12
istruzioni - ed esecuzione) 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 gira al “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
Big view
Full
Virtualization
Para
Virtualization
Type 1
Hypervisor
Type 2
Hypervisor
Process Level
Virtualization
System Level
Virtualization
Java
.NET
Virtualization