Living In The CloudHosting Data & Apps Using The Google Infrastructure
Introductions
Pamela Fox USC/Google
http://www.wordle.net/gallery/wrdl/710650/fkedupmonkey_tags
The Cloud!
Tonight’s Agenda
Google Data APIs App Engine
Before the Cloud: Web Apps
After the Cloud: Web Apps
Viral Spread + User Edits = Scaling Nightmare
Mo’ Users, Mo’ Problems
Old Architecture
code/data
Old Architecture
Old Architecture
Old Architecture
Solution: App Engine
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
App Engine Architecture
code data
Simple, Automatic Scaling
App Engine Components
code data
Python
Data Store
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)
Memcache
Users
@gmail.com
@myappsdomain.com
Demo
Google App Engine
Before the Cloud: User Apps
After the Cloud: User Apps
• Users demand ownership of their content.
• Other sites want to access that content.
Damn Needy Users
Solution: Google data APIs
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
APIs
RPC || REST
* SOAP
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++
REST
Representational
State
Transfer( )[Fielding 2000]
REST
Fundamentals of REST:
Application state and functionality is abstracted into discrete resources.
REST
Fundamentals of REST:
Resources are accessible via URLs.
/blog/posts/1234
REST
Fundamentals of REST:
Resources share a uniform interface for transferring state.
HTTP://
GET POST
PUT DELETE
}
RSS/ATOM
Feed
{Entries
Example RSS feed.
ATOMPub
Feed
{Entries
GET POST
PUT DELETE
Google data APIs Protocol
Feed
Query
{Entries
GET POST
PUT DELETE
The Google Data Protocol
REST
Google Data Protocol
RSS 2.0
Architecture
Syndication
UpdatesAtomPub
Atom
The Google Data Protocol
RSS 2.0 Atom(Pub)
Google Data
Syndication Format ✓ ✓ ✓
Queries ✓
Updates ✓ ✓
Optimistic Concurrency ✓
Authentication ✓
The Google Data Protocol
Over 15 APIs, 1 Protocol
Many Uses
Case Study: CalGoo
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
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
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
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
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
The Google Data Protocol
DELETE /myFeed/1/2/
200 OK
Updating an entry
Demo
Google Data CRUD
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
Demo
Youtube Searcher
JSON and RSS
Other formats are also supported:
?alt=json
?alt=json-in-script
?alt=kml
?alt=rss
Client Libraries
PHP
.NET
Java
JavaScriptObjective-C
Python
+ Community Contributed
DemoGoogle Data Sample Applications
My Secret Motivation For Giving This Talk
Google Data APIs
♥App Engine
DemoGoogle Data APIs + App Engine
Conclusion
Google Data APIs App Engine
Scalable Architecture(AtomPub) APIs