App Engine On Air: Munich

6,990 views
6,692 views

Published on

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.

Published in: Technology, News & Politics
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,990
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
125
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

App Engine On Air: Munich

  1. Google App Engine Flying into Munich
  2. Dion Almaer twitter.com/dalmaer almaer.com
  3. Don't forget, RIA's have rich internet back-ends (RIBs?) Jonathan Schwartz CEO, Sun Microsystems
  4. 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
  5. Google App Engine Technical Challenges
  6. Google App Engine Financial and Admin Challenges
  7. Google App Engine Easy to use, Easy to scale, Free to start
  8. 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
  9. 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
  10. Develop locally. Deploy to Google. Launch.
  11. Develop locally. Deploy to Google. Launch. Deploy
  12. Develop locally. Deploy to Google. Launch.
  13. Develop locally. • Google App Engine SDK is open source • Simulates production environment •dev_appserver.py myapp •appcfg.py update myapp
  14. Hello World Simplest output, simplest config # helloworld.py print quot;Content-Type: text/htmlquot; print print quot;Hello, world!quot; # app.yaml application: dalmaer-helloworld version: 1 runtime: python api_version: 1 handlers: - url: /.* script: helloworld.py
  15. loadcontacts var contacts = [ { id: 1, name: ‘Dion Almaer’, ... }, { id: 2, name: ‘Ben Galbraith’, ... }, savecontact ] name=’Dion A Lamer’ email=’dion@almaer.com’ Web Services
  16. threads sockets files foreground the snake is almost there
  17. from django import v0_96 as django
  18. Store data Scalable, and not like a RDBMS Wow, that's a big table!
  19. • No joins • Hierarchies • Indexes
  20. 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.
  21. GQL Our query language SELECT * FROM Story WHERE title = 'App Engine Launch' AND author = :current_user AND rating >= 10 ORDER BY rating, created DESC
  22. 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)
  23. 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
  24. Call Web Services
  25. URL Fetch API Aint no urllib2 from google.appengine.api import urlfetch some_feed = urlfetch.fetch('http://somesite.com/rss') if some_feed.status_code == 200: self.response.out.write(some_feed.content) 53 421
  26. Authenticate to Google OpenID provider.... available
  27. 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(): ...
  28. Send Email
  29. Email API No SMTP config required from google.appengine.api import mail def post(self): email_body = self.request.get('email_body') sender = users.get_current_user().email mail.send_mail(sender=sender, to='marce@google.com', subject='Wiki Page', body=email_body) self.response.out.write('Email Sent')
  30. Manipulate Images
  31. Image Manipulation API No SMTP config required # in model avatar = db.BlobProperty() # in handler avatar = images.resize(self.request.get(quot;imgquot;), 32, 32) # available resize crop rotate horizontal_flip vertical_flip im_feeling_lucky :)
  32. Memcache Support In-memory distributed cache
  33. 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;)
  34. 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
  35. Use it as you will No need to go whole hog
  36. Your Application Web Services
  37. Google App Engine Announcing Open Signups
  38. Python Runtime Web Configuration Applications Static Files URL Fetch API Google App Engine Email API Users API Memcache API Image API
  39. 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
  40. Python Runtime Web Configuration Applications Static Files URL Fetch API Google App Engine Email API Users API Memcache API Image API

×