web service programming and cloud computing

89
Web Service Programming and Cloud Computing 1

Upload: harlan-williams

Post on 01-Jan-2016

20 views

Category:

Documents


1 download

DESCRIPTION

Web Service Programming and Cloud Computing. Bigger view of programming. What we learnt are mostly small, standalone programming tasks In real world an application involves several tiers and languages RPC Client/server architecture Browser, http server Browser, http server, DB - PowerPoint PPT Presentation

TRANSCRIPT

Web Service Programming andCloud Computing

1

Bigger view of programming

• What we learnt are mostly small, standalone programming tasks• In real world an application involves several tiers and languages

– RPC– Client/server architecture– Browser, http server – Browser, http server, DB– Browser, http server, application server, DB– … …

• Languages involved– Client side: Html, javascript, xml, css, xslt;– Server side: php, java, python, map/reduce, J2EE, sql, …

2

3

Web Service

4

Service Oriented Architecture

Discovery agency

ProviderRequesterinteract

findpublish

5

Registry

A concrete SOA

WSDL

Web Service ProviderSOAP

ServiceConsumer

Points to description

publish

DescribesService

FindsService

Communicates withXML Messages

6

Web Service definition

• “encapsulated, loosely coupled, contracted software objects offered via standard protocols” --ZapThink Research

– Encapsulated–Web Service implementation is invisible to entities outside the service–Exposes an interface but hides details

– Loosely Coupled–Service and consumer software can be redesigned independently

7

History of Interface Definition Languages (IDLs)

• IDL has a long history in distributed computing– DCE (Distributed Computing Environment) – CORBA IDL, OMG (Object Management Group)– COM IDL, Microsoft– WSDL

• Traditional IDLs– Specifying what to call: the operation names, their signatures,

exceptions. This is the job of IDL. – Agreeing on how to make an invocation: the mechanism of naming,

activation, data encoding. This is what distributed standards such as CORBA or COM do.

• WSDL needs to specify the both: the operation provided by the service, and the mechanism to access the service.

8

Web Service Description Language

• WSDL defines– What the service is: the operations the service provides, including the

signature of the operation –- what– Access specification: details of the data format and protocol necessary to

access the service’s operation–- how– Location of the service: details of the network address, such as a URL –-

where

9

WSDL functionality view

OperationPort Type

MessageBinding

Port Service

Supports

Input & Output

Provides

How to encode

Formats & ProtocolsHow to

invoke

Implements

Interface

Endpoints

– What– how– where

Legend:

In WSDL 2.0, portType is changed to interface.

10

WSDL document structure viewWSDL specification

abstract part

types

messages

operations

port types

concrete part

bindings

services andports

11

<?xml version="1.0"?> <definitions name="Procurement" targetNamespace="http://example.com/procurement/definitions" xmlns:tns="http://example.com/procurement/definitions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" >

<message name="OrderMsg"> <part name="productName" type="xs:string"/> <part name="quantity" type="xs:integer"/> </message>

<portType name="procurementPortType"> <operation name="orderGoods"> <input message = "OrderMsg"/> </operation> </portType>

<binding name="ProcurementSoapBinding" type="tns:procurementPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="orderGoods"> <soap:operation soapAction="http://example.com/orderGoods"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding>

<service name="ProcurementService"> <port name="ProcurementPort" binding="tns:ProcurementSoapBinding"> <soap:address location="http://example.com/procurement"/> </port> </service></definitions>

port and service

binding

operation and port type

messages

abstract part

concrete part

12

<definitions … name="BNQuoteService"><message name="getPriceRequest"> <part name="isbn" type="xsd:string"/> </message><message name="getPriceResponse"><part name="return" type="xsd:float"/> </message><portType name="BNQuotePortType"><operation name="getPrice">

<input name="getPrice" message="tns:getPriceRequest"/><output name="getPriceResponse" message="tns:getPriceResponse"/>

</operation></portType>

<binding name="BNQuoteBinding" type="tns:BNQuotePortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getPrice"><soap:operation/>

<input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:xmethods-BNPriceCheck"/> </input>

<output> <soap:body use="encoded"

encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:xmethods-BNPriceCheck"/>

</output></operation>

</binding><service name="BNQuoteService">

<documentation>Returns price of a book at BN.com given an ISBN number</documentation> <port name="BNQuotePort" binding="tns:BNQuoteBinding">

<soap:address location="http://services.xmethods.net:80/soap/servlet/rpcrouter"/></port>

</service></definitions>

13

Visual representation

14

WSDL structure—interconnection viewWSDL document

Types (type information for the document, e.g., XML Schema)

Message 1 Message 4Message 3Message 2

Operation 1 Operation 3Operation 2

Message 5

Interface (abstract service)

binding 1

endpoint 1

binding 2

endpoint 2

binding 3

endpoint 3

binding 4

endpoint 4

Service (the interface in all its available implementations)

Ab

stra

ct d

escr

ipti

on

of

the

serv

ice

Co

ncr

ete

des

crip

tio

n

of

the

serv

ice

By Gustavo Alonso and Cesare Pautasso

15

A WSDL example

<?xml version="1.0"?><definitions name="PriceCheck"

targetNamespace="http://www.skatestown.com/services/PriceCheck" xmlns:pc="http://www.skatestown.com/services/PriceCheck" xmlns:avail="http://www.skatestown.com/ns/availability" xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"><types> …</types><message> …</message> <message> … </message><portType> … </portType><binding> … </binding><service> … </service></definitions>

This example is from Steve Graham et al: Building Web Services with Java

16

PortType

<portType name="PriceCheckPortType">

<operation name="checkPrice">

<input message="pc:PriceCheckRequest"/>

<output message="pc:PriceCheckResponse"/>

</operation>

</portType>

• <portType> defines the interface of web service. Just as Java Interface declaration;– Will change the name to <interface> in WSDL 2.0.

• It consists of a sequence of operation declarations.• WSDL can have zero or more <portType>s. Typically just one. • It has a name attribute, must be unique.

– The binding will refer the portType by its name

17

Operation

• Operation defines a method signature;– Name, input, output, and fault

• Input and output elements are associated with messages; • Different combinations of input/output define different

operations types.

<operation name="checkPrice">

<input message="pc:PriceCheckRequest"/>

<output message="pc:PriceCheckResponse"/>

</operation>

18

Operation Types• The request-response type is the most common operation type, but WSDL

defines four types:– Request-response: The operation can receive a request and will return a response

<operation name="checkPrice"> <input message="pc:PriceCheckRequest"/> <output message="pc:PriceCheckResponse"/> </operation>

– One-way: The operation can receive a message but will not return a response. <operation name=“cancellation”> <input message=“tns:orderCancellation”/></operation>

– Notification:The operation can send a message but will not wait for a response<operation name=“notification”> <output message=“tns:promotionNotification”/></operation>

– Solicit-response:The operation can send a request and will wait for a response<operation name=“cancellation”> <output message=“tns:pushThis”/> <input message=“tns:reponseToPush”/></operation>

• Different types are decided by the order/occurrences of input and output.

19

Messages

<message name="PriceCheckRequest"> <part name="sku" element="avail:sku"/> </message> <message name="PriceCheckResponse"> <part name="result" element="avail:StockAvailability"/> </message>

• Describe the abstract form of input, output, or fault. • A WSDL file can have zero or more messages. • Each message has a name, which is unique within the document. • Each message has a collection of <part> elements.

20

Part

<part name="sku" element="avail:sku"/><part name="result" element="avail:StockAvailability"/>

• A <part> element can be compared to a parameter in a method.• A part element has two properties: one is name, the other is its

kind. • Kind can be a type or an element

– Element refers to an element defined in XML Schema– Type refers to a simpleType or a complexType in XSD

• In corresponding sku definition is: <xsd:element name="sku" type="xsd:string" />

21

Types in WSDL

<types> <xsd:schema targetNamespace="http://www.skatestown.com/ns/availability" > <xsd:element name="sku" type="xsd:string" /> <xsd:complexType name="availabilityType"> <xsd:sequence> <xsd:element ref="avail:sku"/> <xsd:element name="price" type="xsd:double"/> <xsd:element name="quantityAvailable" type="xsd:integer"/> </xsd:sequence> </xsd:complexType> <xsd:element name="StockAvailability" type="avail:availabilityType" /> </xsd:schema> </types>• The default type system is XML Schema;

– Theoretically you can use any type system, such as Java types. • To be used in<part> element;• We can also import XML Schemas

22

SOAP request message<soapenv:Envelope xmlns:soapenv=“http://schema.xmlsoap.org/soap/evelope/” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”> <soapenv:Body> <sku xmlns=“http://www.skatestown.com/ns/availability”>123</sku> </soapenv:Body></soapenv:Envelope> • Relevant part of the WSDL file:<xsd:element name="sku" type="xsd:string" /> <message name="PriceCheckRequest"> <part name="sku" element="avail:sku"/> </message><operation name="checkPrice"> <input message="pc:PriceCheckRequest"/> <output message="pc:PriceCheckResponse"/></operation>

Envelope

Body

MessagePayload

Header #1

Header #0

23

SOAP response message<soapenv:Envelope xmlns:soapenv= … xmlns:xsd=… xmlns:xsi=… > <soapenv:Body> <StockAvailability xmlns= … > <sku> 123 </sku> <price xmlns=“”>100.00</price> <quantityAvailable xmlns=“”>

12 </quantityAvailable> </StockAvailability> </soapenv:Body></soapenv:Envelope>

• Relevant part of the WSDL file:<xsd:complexType name="availabilityType"> <xsd:sequence> <xsd:element ref="avail:sku"/> <xsd:element name="price" type="xsd:double"/> <xsd:element name="quantityAvailable" type="xsd:integer"/> </xsd:sequence></xsd:complexType>

<message name="PriceCheckResponse"> <part name="result" element="avail:StockAvailability"/></message>

<operation name="checkPrice"> <input message="pc:PriceCheckRequest"/> <output message="pc:PriceCheckResponse"/></operation>

24

Binding <binding name="PriceCheckSOAPBinding" type="pc:PriceCheckPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="checkPrice"> <soap:operation soapAction = "http://www.skatestown.com/services/PriceCheck/checkPrice" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" / </output> </operation> </binding>• Name of the binding should be unique;• Link to the portType is achieved by the portType name

– This explains why portType name should be unique.• Typically, there is only one <binding> element;• Defines:

– Invocation style: rpc vs. document– SOAPAction– Input message appearance: literal or encoded– Output message appearance

25

Service <service name="PriceCheck"> <port name="Pricecheck" binding="pc:PriceCheckSOAPBinding"> <documentation> <wsi:Claim conformsTo="http://ws-i.org/profiles/basic/1.0" /> </documentation> <soap:address location ="http://www.skatestown.com/services/PriceCheck"/> </port> </service>• Contains a set of <port> elements;• <port> combines the interface binding with a network address specified by a

URI;• A web service can be available in different web addresses;

26

Tools

• WSDL parser: WSDL4J• Apache Axis

– Invoking SOAP web service;– Translate WSDL to Java, and vice versa;– Mapping Java into XML Schema, and vice versa;– Host web service;– API for manipulating SOAP;

27

Mapping between Java and WSDL in JAX-RPC

<message name="fooRequest"><part name="para1" type="xs:string"/>

</message><message name="fooResponse">

<part name="para2" type="xs:float"/></message><portType name="FooBar">

<operation name="foo"><input message="y:fooRequest"/><output message="y:fooResponse"/>

</operation></portType>

• A simple example

public interface FooBar extends java.rmi.Remote{ public float foo(java.lang.String para1)

throws java.rmi.RemoteException;}

28

• Multiple input parameters

public interface FooBar extends java.rmi.Remote{ public float foo(String param1, int param2, boolean param3)

throws java.rmi.RemoteException;}

<message name="fooRequest"><part name="param1" type="xs:string"/><part name="param2" type="xs:int"/><part name="param3" type="xs:boolean"/>

</message><message name="fooResponse">

<part name="para2" type="xs:float"/></message><portType name="FooBar">

<operation name="foo"><input message="y:fooRequest"/><output message="y:fooResponse"/>

</operation></portType>

29

• Multiple output parameters<message name="fooRequest">

<part name="param1" type="xs:string"/></message><message name="fooResponse">

<part name="param2" type="xs:int"/><part name="param3" type="xs:boolean"/><part name="param4" type="xs:float"/>

</message><portType name="FooBar">

<operation name="foo"><input message="y:fooRequest"/><output message="y:fooResponse"/>

</operation></portType>

public interface FooBar extends java.rmi.Remote{ public void foo(String param1, javax.xml.rpc.holders.IntHolder param2,

javax.xml.rpc.holders.BooleanHolder param3,javax.xml.rpc.holders.FloatHolder param4,

) throws java.rmi.RemoteException;}

30

Mapping XML Schema to Java

public class Address {private String street;private String city;public String getCity(){return city; }public void setCity(String c){city=c; }… …

}

<complexType name="Address"><sequence>

<element name="city" nillable="true" type="xsd:string"/><element name="street" nillable="true" type="xsd:string"/>

</sequence></complexType>

• Class has to have correct getters and setters;• In axis, you can use WSDL2Java and Java2WSDL to do the mapping.

60-440 31

03-60-440 Mashups

60-440 32

03-60-440 Mashups

60-440 33

Mashups

• From Wikipedia– Mashup (music), a musical genre of songs that consist entirely of parts of

other songs – Mashup (video), a video that is edited from more than one source to

appear as one – Mashup (web application hybrid), a web application that combines data

and/or functionality from more than one source

• Combine data from multiple sources. – Mostly the data sources lay outside of the organizational boundaries

• Create a new and distinct web service that was not originally provided by either source.

• Content is typically sourced via a web API or a RSS Feed

Mashup

60-440 34

Mashup example• The ChicagoCrime.org Web site

– A mapping mashup– One of the first popular mashups– Mashes crime data from the Chicago Police Department’s online database with

cartography from Google Maps– The concept and the presentation are simple and the composition of crime and

map data is visually powerful

The following slides are borrowed from Umut Orhan

Mashup

60-440 35

Why mashup

• Everybody needs customized applications, tailored to his/her own requirements, taste, style.

• DIY in software/web application construction– There are many building blocks (web APIs, web services)– there are also some tools to assemble the building blocks

• It is like end-user programming

60-440 36

Mashup flavours

• Presentation mashups: e.g. Google Maps apps, with emphasis on presentation• This is the shallowest form of mashup in the sense that underlying data

and functionality don’t meet. Information and layout is retrieved and either remix or just placed next to each other. Many of the Ajax desktops today fall into this category and so do portals and other presentation mashup techniques.

• Data mashups: merging data from different sources• Business mashup: combination of above. combines data

integration, presentation plus addition functionality, such as collaboration features

Mashup

60-440 37

Map mashups

• Locational information presented graphically using maps in a specified context

• Google Maps API opened the floodgates– mash all sort of data from nuclear disasters to Boston’s CowParade cows

onto maps

• Other APIs– Microsoft (Virtual Earth)– Yahoo (Yahoo Maps)– AOL (MapQuest)

Mashup G

enres

60-440 38

Photo and Video

• Photo/video hosting and social networking sites resulted interesting mashups.– Flickr– YouTube– Facebook

• Metadata associated with the hosted images and videos– Who took the picture– What it is a picture of– Where and when it was taken– So on…

Mashup G

enres

60-440 39

Search and shopping

• Exist long before the term Mashup was coined– Combinations of B2B technologies or screen-scraping to aggregate

comparative price data– eBay– Amazon– …

Mashup G

enres

60-440 40

News

• News sources such as BBC and Reuters have used syndication technologies like RSS and Atom since 2002.

• Personalized newspaper by Syndication feed mashups• Doggdot.us, combines feeds from the techie-oriented news

sources Digg.com, Slashdot.org and Del.icio.us

Mashup G

enres

60-440 41

Content provider

• Web Protocols– REST Services– SOAP Web Services– RSS/Atom

• Screen Scraping– Scraping is the process of using software tools to parse and analyze

content that was originally written for human consumption in order to extract semantic data structures representative of that information that can be used and manipulated programmatically.

60-440 42

Mashup platforms

• IGoogle• Yahoo Pipes• Openkapow• IBM QedWiki• Microsoft popfly• Google Mashup Editor (migrated to Google App

Engine)• … …

Mashup platform

s

60-440 43

Yahoo! pipes

• Visual development environment for generating data-oriented mashups

• Development is based on:– Dragging gadgets (pipes) from a

toolbox and dropping them in work zone

– Specifying data input– Interconnecting gadgets through

pipes– Specifying data output format

Mashup platform

s

60-440 44

Ajax• AJAX (Asynchronous JavaScript and XML) • Ajax and AJAX• Characteristic: increased responsiveness and interactiveness of

web pages – exchanging small amounts of data with the server – entire web page does not have to be reloaded each time the user

performs an action.

• Not a technology itself, but a term refer to the use of a group of technologies

• The "core" and defining element of Ajax is the XMLHttpRequest object, which gives browsers the ability to make dynamic and asynchronous data requests without having to reload a page, eliminating the need for page refreshes.

Web 2.0

The following slides are from Jimmy LinThe iSchoolUniversity of Maryland

60-440 45

“Old-School” Web Applications

server-side systems

backend database

browser

Inte

rfac

e

Webserver

HTTP request

HTTP response

1

user does something

2

browser sends request to server

3

server generates Web page as a response to the request

4

data is returned in response to the request

5

browser replaces view with data sent from server

60-440 46

Characteristics

• User-driven: Things only happen when the user does something (e.g., clicks on a link or button)

• Views defined by URLs: You can bookmark something and come back to it; use the forward/backward button

• Simple user interaction model: Not that many things you can do in browser

• Synchronous Interaction: System responses are synchronized with user-driven events

60-440 47

Synchronous Interactions

browser

server-side

Time

user activity user activity user activity

server processing server processing

Re

qu

est

Re

qu

est

Re

spo

ns

e

Re

spo

ns

e

browser server-side systemsHTTP request

HTTP response

12

45 3

1

2

3

4

5

60-440 48

LAMP

Linux

Apache

MySQL

PHP/Python/Perl

So what do you run on the server side?

60-440 49

From “Old-School” to Ajax

browser

Inte

rfac

e

request

response

Ajax intermediates between the interface and the server.

server-side systems

backend database

Webserver

data management

Ajax“engine”

interaction management

60-440 50

Inside the Browser

browser

HTML / CSSdata

HTML / CSSdata

other data(e.g. images)

other data(e.g. images)

Inte

rfac

e

Ren

der

ing

En

gin

e

HTTP request

HTTP response

60-440 51

Enter JavaScript

browser

HTML / CSSdata

HTML / CSSdata

other data(e.g. images)

other data(e.g. images)

Inte

rfac

e

Ren

der

ing

En

gin

e

HTTP request

HTTP response

JavaScript Engine

JavaScriptcode

JavaScriptcode

60-440 52

Enter Ajax

browser

HTML / CSSdata

HTML / CSSdata

other data(e.g. images)

other data(e.g. images)

Inte

rfac

e

Ren

der

ing

En

gin

e

HTTP request

HTTP response

JavaScript Engine

XMLdata

XMLdata

JavaScriptcode

JavaScriptcode

XMLHttpRequest

HTTP request

60-440 53

From Synchronous Interactions…

browser

server-side

Time

user activity user activity user activity

server processing server processing

Re

qu

est

Re

qu

est

Re

spo

ns

e

Re

spo

ns

e

60-440 54

To asynchronous Interactions

browser

server-side

Time

user activity

server processing server processing

Re

qu

est

Re

qu

est

Re

spo

ns

e

Re

spo

ns

e

client-side processing

60-440 55

Components of an Ajax Interaction

1. A client event occurs (captured by JavaScript event handlers)

2. An XMLHttpRequest object is created and configured

3. An asynchronous request is made to the server via the XMLHttpRequest object

4. Server processes request and returns data, executing a callback in the XMLHttpRequest object

5. The HTML DOM is updated based on response data

60-440 56

DOM

• Document Object Model: platform- and language-independent way to represent XML– Adopts a tree-based representation– W3C standard, supported by modern browsers

• JavaScript uses DOM to manipulate content– To process user events– To process server responses (via XMLHttpRequest)

60-440 57

Ajax: Things to watch out for!

• Hype• Application development/maintenance cost

– Brower incompatibilities– Many different approaches and tools– For many things, lack of agreed-on best practices

• Behavior is not ‘Web-like’ – Standard things often don’t work correctly (e.g., browser ‘back’ button,

bookmarks) – Usability issues for users with disabilities

• Security issues

Cloud computing

58

What is cloud computing

• Cloud – Datacenter hardware and software that the

vendors use to offer the computing resources and services

• Cloud computing – Refer to both the cloud and the services provided

• Why called cloud computing– the computing happens out there "in the clouds”– wikipedia: "the term derives from the fact that

most technology diagrams depict the Internet or IP availability by using a drawing of a cloud."

59

Definition of cloud computing

• A large-scale distributed computing paradigm • Driven by economies of scale• Provider has a pool of abstracted, virtualized, dynamically-

scalable resources– Computing power, storage, platforms, and services

• Delivered to customers on demand• 5 Characteristics (NIST 2009)

– On demand self-service– Broad network access– Resource pooling– Rapid elasticity– Measured service

60

Timeline of cloud computing

61

From Dr. Javier Soriano

Evolution of cloud computing

62

Economic reason for cloud computing

63

Challenge of cloud computing: Elasticity

• Animoto.com:– Started with 50 servers on Amazon EC2– Growth of 25,000 users/hour– Needed to scale to 3,500 servers in 2 days (RightScale@SantaBarbara)

64

RPC • In the early 1980’s, software was not yet “distributed”, only “copied around”• Programmers wanted to install software once on a server, and then call it

remotely over a network from many clients• “Remote Procedure Call” (RPC)• Several major efforts were made to do RPC over the next 25 years• All suffered from at least one of the common “fallacies of distributed

computing”:– The network is secure– The network is homogeneous– The network is fast enough

• HTTP partially fulfilled the need in the early 1990’s– Programmers could make HTTP GET requests in those days, but the language

support for it was not great until recent years

65

Early days of distributed computing

• 1980’s: – RPC using C/C++– EDI (Electronic Data Interchange)– Microsoft DCOM

• 1990’s: – CORBA (for Unix/Linux only)– HTTP (so-called REST web services)

• Still no way to distribute an application across multiple computers that was:– standards-based– platform-independent

66

SOA (Service Oriented Architecture)• They would be standards-based, platform-independent, and

immune to firewalls– some kind of XML would be the wire format

• Each service’s contract would be expressed in a formal manner and registered in a catalog

– programming languages could “parse” this contract and utilize it at runtime, like an interface in Java

– there would be a “factory” call that returned a reference to the currently preferred implementation of a given service contract

– software architects would “compose” designs by shopping among available services

• Network and machine speed and capacity would increase to make the overhead of XML tolerable– massive software reuse would be achieved

67

Another form of out sourcing

• Differences – Scalability – ‘pay per use’, flexible arrangement

68

Three basic service models

• Users: use software on thin clients. – Do not need to download and

install the software – E.g. google doc, online tax

• Developers: use some languages, APIs, servers to develop and deploy an application – Do not need a server to host

the application

• Network architect

69

Basic service models

70

Service Model ArchitecturesCloud Infrastructure

IaaS

PaaS

SaaS

Infrastructure as a Service (IaaS) Architectures

Platform as a Service (PaaS)Architectures

Software as a Service (SaaS)

Architectures

Cloud Infrastructure

SaaS

Cloud Infrastructure

PaaS

SaaS

Cloud Infrastructure

IaaS

PaaS

Cloud Infrastructure

PaaS

Cloud Infrastructure

IaaS

71

Cloud Infrastructure as a Service (IaaS)• Also known as Hardware as a Service (HaaS).• Service provider owns the equipment; responsible for housing, running and

maintaining it.• Client typically pays on a per-use basis, creates virtual machines (VMs) on

demand– They have full access to these VMs

• Strengths:– Can control and configure environment– Familiar technologies– Limited code lock-in

• Weaknesses:– Must control and configure environment– Requires administrative skills to use

• e.g. Amazon Web Service, Rackspace, GoGrid

72

73

PaaS

• Platform provides hardware architecture and software framework (including application frameworks)

• Developers provide an application, which the platform runs– They don’t work directly with VMs

• Strengths:– Provides higher-level services than IaaS– Requires essentially no administrative skills

• Weaknesses:– Allows less control of the environment– Can be harder to move existing software

• e.g. Google App Engine, which supports Java and Python, and Engine Yard, which supports Ruby on Rails.

74

SaaS

• Very common in the IT community• Software companies host their software themselves and then

upgrade to maintain users• e.g. Salesforce.com –online CRM, Live.com, Zoho, Google Docs,

Microsoft Web Apps 2010

75

76

Three Features of Mature SaaS Applications

• Scalable– Handle growing amounts of work in a graceful manner

• Multi-tenancy– One application instance may be serving hundreds of companies– Opposite of multi-instance where each customer is provisioned

their own server running one instance• Metadata driven configurability

– Instead of customizing the application for a customer (requiring code changes), one allows the user to configure the application through metadata

76

77

SaaS Maturity Levels

• Level 1: Ad-Hoc/Custom• Level 2: Configurable• Level 3: Configurable, Multi-

Tenant-Efficient• Level 4: Scalable,

Configurable, Multi-Tenant-Efficient

77Source: Microsoft MSDN Architecture Center

SaaS

PaaS

IaaS

Amazon Google Microsoft Salesforce

Service Delivery Model Examples

78

Cloud Deployment Models• Private cloud

– enterprise owned or leased

• Community cloud– shared infrastructure for specific community

• Public cloud– Sold to the public, mega-scale infrastructure

• Hybrid cloud– composition of two or more clouds

79

Case studies

80

Google Cloud• Started with Google Apps• Platform as Service later on• Replace office software

– Gmail– Google Docs (word processing and spreadsheets)– Google video for business– Google sites (intranet sites and wikis)

• Google Cloud Connect• 500,000+ organizations use Google Apps • GE moved 400,000 desktops from Microsoft Office to Google Apps

81

Google App Engine

• Exposes the Google Infrastructure to the outside world– BigTable– Python Language runtime– Access to some google api’s (authentication , image, manipulation)

• APIs– Python Runtime, The Python environment in which your app runs; CGI,– sandbox features, application caching, logging– Datastore API, BigTable – Google’s Database– Images API, the image data manipulation service– Mail API, sending email from your app– Memcache API, the distributed memory cache– URL Fetch API, accessing other Internet hosts from your app– Users API, integrating your app with Google Accounts– You should expect to see more API’s exposed. More specifically the

Google API’s for Docs , GWT , etc82

Amazon Cloud• Amazon cloud components

– Elastic Compute Cloud (EC2)– Simple Storage Service (S3)– SimpleDB

83

84

Amazon Cloud Users: New York Times and Nasdaq

• Both companies used Amazon’s cloud offering• New York Times

– Used EC2 and S3 to convert 15 million scanned news articles to PDF (4TB data)

– Took 100 Linux computers 24 hours (would have taken months on NYT computers

– “It was cheap experimentation, and the learning curve isn't steep.” – Derrick Gottfrid, Nasdaq

• Nasdaq– Uses S3 to deliver historic stock and fund information– Millions of files showing price changes of entities over 10 minute

segments– “The expenses of keeping all that data online [in Nasdaq servers] was too

high.” – Claude Courbois, Nasdaq VP– Created lightweight Adobe AIR application to let users view data

85

Salesforce Cloud

• Started with information management service that could replace traditional business software technology

• Pioneered software-as-a-service market (esp. CRM tools)• 5,000+ Public Sector and Nonprofit Customers use

Salesforce Cloud Computing Solutions• Moving beyond SaaS into the platform-as-a-service

market

86

Salesforce.com in Government• President Obama’s Citizen’s Briefing Book

– 134,077 Registered Users– 1.4 M Votes – 52,015 Ideas– Peak traffic of 149 hits per second

• US Census Bureau Uses Salesforce.com Cloud Application– Project implemented in under 12 weeks – 2,500+ partnership agents use Salesforce.com for 2010

decennial census – Allows projects to scale from 200 to 2,000 users overnight to

meet peak periods with no capital expenditure

87

88

Facebook’s Use of Open Source and Commodity Hardware

• 400 million users + 250,000 new users per day• 100,000 transactions per second, 10,000+ servers• Built on open source software

– Web and App tier: Apache, PHP, AJAX– Middleware tier: Memcached (Open source caching)– Data tier: MySQL (Open source DB)

• Thousands of DB instances store data in distributed fashion (avoids collisions of many users accessing the same DB)

Drawbacks

• Excessive dependence on the Internet• Subject to ISP and Cloud Service Providers’ disclosure policy• Inappropriate for sensitive, classified data• Data replication, coherency, integrity loss

89