Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

56
Living In The Cloud Hosting Data & Apps Using The Google Infrastructure

description

In the modern web, the user rules. Nearly every successful web app has to worry about scaling to an exponentially growing user base and giving those users multiple ways of interacting with their data. Pamela Fox, Maps API Support Engineer & Developer advocate, provides an overview of two technologies - Google App Engine and the Google Data APIs - that aim to make web development and data portability easier.

Transcript of Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Page 1: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Living In The CloudHosting Data & Apps Using The Google Infrastructure

Page 2: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Introductions

Pamela Fox USC/Google

http://www.wordle.net/gallery/wrdl/710650/fkedupmonkey_tags

Page 3: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Cloud!

Page 4: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Tonight’s Agenda

Google Data APIs App Engine

Page 5: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Before the Cloud: Web Apps

Page 6: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

After the Cloud: Web Apps

Page 7: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Viral Spread + User Edits = Scaling Nightmare

Mo’ Users, Mo’ Problems

Page 8: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Old Architecture

code/data

Page 9: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Old Architecture

Page 10: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Old Architecture

Page 11: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Old Architecture

Page 12: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Solution: App Engine

Page 13: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

What Is App Engine?

Lets you run your web application on top of Google’s infrastructure.

• Servers• Network• Datastore• Backups• Pagers

Scalable}“We wear pagers so you don’t have to.”

— Guido van Rossum

Page 14: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

App Engine Architecture

code data

Page 15: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Simple, Automatic Scaling

Page 16: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

App Engine Components

code data

Page 17: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Python

Page 18: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Data Store

Page 19: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Data Store

db.GqlQuery("SELECT * FROM Shout " "WHERE who >= 'b' AND who < ' c ' " "ORDER BY when DESC").fetch(100)

query = Shout.all()query.order('-date')query.filter('who >=', 'b')query.filter('who <', ‘c')shouts = query.fetch(100)

Page 20: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Memcache

Page 21: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Users

@gmail.com

@myappsdomain.com

Page 22: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Demo

Google App Engine

Page 23: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Before the Cloud: User Apps

Page 24: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

After the Cloud: User Apps

Page 25: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

• Users demand ownership of their content.

• Other sites want to access that content.

Damn Needy Users

Page 26: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Solution: Google data APIs

Page 27: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

How Do You Make Things Accessible?

Application

Programming

Interface( )An application programming interface (API) is a set of functions, procedures, methods or classes that an operating system, library or service provides to support requests made by computer programs.

Source: Wikipedia

Page 28: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

APIs

RPC || REST

* SOAP

Page 29: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Remote Procedure Calls

fooInstance->addNumbers(2, 3);

<?xml version="1.0"?><methodCall> <methodName>Foo.addNumbers</methodName> <params> <param> <value><int>2</int></value> <value><int>3</int></value> </param> </params></methodCall>

fooInstance.addNumbers(2, 3);

PHP

XML(Network)

C++

Page 30: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

REST

Representational

State

Transfer( )[Fielding 2000]

Page 31: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

REST

Fundamentals of REST:

Application state and functionality is abstracted into discrete resources.

Page 32: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

REST

Fundamentals of REST:

Resources are accessible via URLs.

/blog/posts/1234

Page 33: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

REST

Fundamentals of REST:

Resources share a uniform interface for transferring state.

HTTP://

GET POST

PUT DELETE

}

Page 34: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

RSS/ATOM

Feed

{Entries

Example RSS feed.

Page 35: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

ATOMPub

Feed

{Entries

GET POST

PUT DELETE

Page 36: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Google data APIs Protocol

Feed

Query

{Entries

GET POST

PUT DELETE

Page 37: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

REST

Google Data Protocol

RSS 2.0

Architecture

Syndication

UpdatesAtomPub

Atom

Page 38: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

RSS 2.0 Atom(Pub)

Google Data

Syndication Format ✓ ✓ ✓

Queries ✓

Updates ✓ ✓

Optimistic Concurrency ✓

Authentication ✓

Page 39: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

Over 15 APIs, 1 Protocol

Many Uses

Page 40: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Case Study: CalGoo

Page 41: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

GET /myFeed

200 OK

<?xml version="1.0"?>

<feed xmlns="http://www.w3.org/2005/Atom">

<title>Foo</title>

<updated>2006-01-23T16:25:00-08:00</updated>

<id>http://www.example.com/myFeed</id>

<author>

<name>Jo March</name>

</author>

<link href="/myFeed" rel="self"/>

</feed>

Requesting a feed or resource

Page 42: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

POST /myFeed

<?xml version="1.0"?>

<entry xmlns="http://www.w3.org/2005/Atom">

<author>

<name>Elizabeth Bennet</name>

<email>[email protected]</email>

</author>

<title type="text">Entry 1</title>

<content type="text">This is my entry</content>

</entry>

Creating a new resource

Page 43: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

201 CREATED

<?xml version="1.0"?>

<entry xmlns="http://www.w3.org/2005/Atom">

<id>http://www.example.com/id/1</id>

<link rel="edit" href="http://example.com/myFeed/1/1/"/>

<updated>2006-01-23T16:26:03-08:00</updated>

<author>

<name>Elizabeth Bennet</name>

<email>[email protected]</email>

</author>

<title type="text">Entry 1</title>

<content type="text">This is my entry</content>

</entry>

Creating a new resource

Page 44: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

PUT /myFeed/1/1/

<?xml version="1.0"?>

<entry xmlns="http://www.w3.org/2005/Atom">

<id>http://www.example.com/id/1</id>

<link rel="edit" href="http://example.com/myFeed/1/1/"/>

<updated>2006-01-23T16:28:05-08:00</updated>

<author>

<name>Elizabeth Bennet</name>

<email>[email protected]</email>

</author>

<title type="text">Entry 1</title>

<content type="text">This is my first entry.</content>

</entry>

Updating an entry

Page 45: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

200 OK

<?xml version="1.0"?>

<entry xmlns="http://www.w3.org/2005/Atom">

<id>http://www.example.com/id/1</id>

<link rel="edit" href="http://example.com/myFeed/1/2/"/>

<updated>2006-01-23T16:28:05-08:00</updated>

<author>

<name>Elizabeth Bennet</name>

<email>[email protected]</email>

</author>

<title type="text">Entry 1</title>

<content type="text">This is my first entry.</content>

</entry>

Updating an entry

Page 46: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

DELETE /myFeed/1/2/

200 OK

Updating an entry

Page 47: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Demo

Google Data CRUD

Page 48: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

The Google Data Protocol

GET /myFeed?q=This

200 OK

<?xml version="1.0"?>

<feed xmlns="http://www.w3.org/2005/Atom">

<title>Foo</title>

<updated>2006-01-23T16:26:03-08:00</updated>

<id>http://www.example.com/myFeed</id>

<link href="/myFeed" rel="self"/>

<entry>

<id>http://www.example.com/id/1</id>

<link rel="edit" href="http://example.com/myFeed/1/1/"/>

<updated>2006-01-23T16:26:03-08:00</updated>

<title type="text">Entry 1</title>

<content type="text">This is my entry</content>

</entry>

</feed>

Searching for a resource

Page 49: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Demo

Youtube Searcher

Page 50: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

JSON and RSS

Other formats are also supported:

?alt=json

?alt=json-in-script

?alt=kml

?alt=rss

Page 51: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Client Libraries

PHP

.NET

Java

JavaScriptObjective-C

Python

+ Community Contributed

Page 52: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

DemoGoogle Data Sample Applications

Page 53: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

My Secret Motivation For Giving This Talk

Google Data APIs

♥App Engine

Page 54: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

DemoGoogle Data APIs + App Engine

Page 55: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Conclusion

Google Data APIs App Engine

Scalable Architecture(AtomPub) APIs

Page 56: Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure

Questions?

Pamela [email protected]@pamelafox

More Infohttp://code.google.com