This is the presentation that I gave on the European On Air tour in Munich. Hence the footy pieces. A lot of the presentation was going through a live application, a port of the addressbook app to App Engine, that lives on Google Code.
6. Don't forget, RIA's have rich
internet back-ends (RIBs?)
Jonathan Schwartz
CEO, Sun Microsystems
7. Google App Engine
Running Web Apps on Google’s Infrastructure
• Fully-integrated
application environment
• Language agnostic runtime
Python for now
• Free quota of 5M
pageviews per month
code.google.com/appengine
11. Google App Engine
Free Quota and Expected Pricing
Resource Free Quota Additional
CPU 10-12¢ / core-hour
Storage Equivalent to 5M 15-18¢ / GB-month
pageviews / month
Bandwidth, Outgoing for a typical app 11-13¢ / GB transferred
Bandwidth, Incoming 9-11¢ / GB transferred
11
12.
13. Google App Engine
Free Quota and Expected Pricing
eo rge!
an ks G
Th
Resource Free Quota Additional
CPU 1 euro / core-year
Storage Equivalent to 5M 1 euro / GB-decade
pageviews / month
Bandwidth, Outgoing for a typical app 1 euro / PB transferred
Bandwidth, Incoming 1 euro / PB transferred
13
26. Data Model
Just an object
from google.appengine.ext import db
class Story(db.Model):
title = db.StringProperty()
body = db.TextProperty(required=True)
author = db.UserProperty(required=True)
created = db.DateTimeProperty(auto_now_add=True)
rating = db.RatingProperty()
# Many other types: BlobProperty, ReferenceProperty, EmailProperty, PhoneProperty, IMProperty,
PostallAddressProperty, etc.
27. GQL
Our query language
SELECT *
FROM Story
WHERE title = 'App Engine Launch'
AND author = :current_user
AND rating >= 10
ORDER BY rating, created DESC
28. Run the queries
Beyond GQL
Story.gql(GQL_FROM_BEFORE,
current_user = users.get_current_user())
query = Story.all()
query.filter('title =', 'Foo')
.order('-date')
.ancestor(key)
29. Inserts
Manipulating the data
story = Story(
title = 'Morning Glory',
body = '....',
author = users.get_current_user(),
)
story.put() # save or update
story.delete() # delete if saved
33. Users API
But you can do your own thing too of course...
from google.appengine.api import users
current_user = users.get_current_user()
if not current_user:
self.redirect(users.create_login_url('/
current_url'))
nickname = current_user.nickname()
email = current_user.email()
if users.is_current_user_admin():
...
39. Memcache API
In-memory distributed cache
from google.appengine.api import memcache
def get_data():
data = memcache.get(quot;keyquot;)
if data is not None:
return data
else:
data = self.query_for_data()
memcache.add(quot;keyquot;, data, 60)
return data
# Set several values, overwriting any existing values for these keys.
memcache.set_multi({ quot;USA_98105quot;: quot;rainingquot;,
quot;USA_94105quot;: quot;foggyquot;,
quot;USA_94043quot;: quot;sunnyquot; },
key_prefix=quot;weather_quot;, time=3600)
# Atomically increment an integer value.
memcache.set(key=quot;counterquot;, 0)
memcache.incr(quot;counterquot;)
memcache.incr(quot;counterquot;)
memcache.incr(quot;counterquot;)
40. Google App Engine
Areas of Work, Including…
• Offline Processing
• Rich Media Support
– e.g., large file upload / download
• Add’l Infrastructure Services
• What would you like to see?
40
46. Python
Runtime
Web
Configuration
Applications
Static Files URL Fetch API
Google App
Engine
Email API Users API
Memcache API Image API
47. What if popular JavaScript libraries
were available and shared in the browser?
1 Now hosting open source JavaScript libraries at Google
Starting with: Prototype, Script.aculo.us, jQuery, Dojo, Mootools
Accepting requests for other open source libraries
Can access directly:
ajax.googleapis.com/ajax/lib/prototype?v=1.6.0.2&packed=false
Can access via AJAX API Loader:
google.load(“prototype”, “1.6”);
2 Other features
Automatic compression
Minification of libraries
Not tied to Google Code
48. Python
Runtime
Web
Configuration
Applications
Static Files URL Fetch API
Google App
Engine
Email API Users API
Memcache API Image API