Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Google App Engine

Introduction to Google App Engine

Google App Engine overview

Eric Shangkuan

December 08, 2010

Transcript

20 slides
  1. Outline •  Architecture •  Features •  App Servers •  Datastore

    •  Services •  Restrictions •  Codelab •  Q & A. (optional)
  2. Architecture Overview Request Frontend App Servers Big Table Image Service

    Static Files Memcache Task Q. … Datastore API Memcache API Image API
  3. GAE App Servers •  GAE is an application platform for

    running your apps. •  Uses Google’s infrastructure •  A *.appspot.com domain (customized domain name is fine) •  Compromises Python or Java runtime •  Provides APIs to access storage and services •  Scales on demand •  Pay as you need
  4. GAE Datastore •  Store the persistent data. •  A kind

    of Key-Value database built on GFS. •  Scalable •  Access through Datastore API or GQL •  Dynamically add/remove -ing properties is okay. Relational Database Datastore
  5. GAE Storages •  BlobStore •  Store the static data (for

    upload/serving files) •  Quota limits (ref. doc) •  Memcache •  Distributed in-memory data cache •  1MB entity
  6. GAE Services (increasing) •  Image Service •  Scale, resize, crop,

    transform, … an image •  Mail Service •  Send/Receive Emails •  Task Queue Service •  Put tasks in queue and execute them later (avoid exceeding quota limit) •  User Service •  Authentication user with Google account (or OpenID)
  7. GAE Services (increasing) •  URL Fetch Service •  Fetch data

    from other websites •  OAuth Service •  Help build an OAuth-based API services. •  XMPP Service •  Send/Receive XMPP messages (e.g., Google Talk)
  8. Restrictions •  Quota •  Quota is extensible if the billing

    enabled •  Types of quotas •  CPU time •  The capacity of data storages •  The bandwidth of incoming/outgoing request/responses •  The frequency of API calls •  Limits •  1MB data entity (datastore, blobstore, memcache) •  30 sec. lifetime of a request •  URL Fetch: 32MB data and 10 minutes •  Image service: 1600px image •  …
  9. Google Apps and Marketplace •  GAE-based application can be installed

    into the Google Apps. •  If you want to use a custom domain name for the app, you should use that domain to register Google Apps. •  Authenticate Google Apps’ users. •  Sell your app on the Google Apps Marketplace.
  10. Create a GAE App •  Go to http:// appengine.google.com • 

    Do an authorization process via SMS while you’re first-time logging in. Your application ID
  11. Create a Project •  Create a app.yaml file in your

    project. # app.yaml application: your-app-id version: 1 runtime: python api_version: 1 handlers: - url: /.* handler: main.py URL Routings Appliaction identifier
  12. Main Handler #!/usr/bin/env python # -*- coding: utf-8 -*- from

    google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class IndexPage(webapp.RequestHandler): def get(self): self.response.out.write('<h1>Hello, world</h1>') def main(): app = webapp.WSGIAppliaction([ ('/', IndexPage), ], debug=True) run_wsgi_app(app) if __name__ == '__main__': main()
  13. Start a Local Development Server •  Now, your project directory

    contains 2 files: •  app.yaml •  main.py •  Start the development server, it servers http://localhost:8080 Start the dev server Use this URL test your app
  14. Deployment •  Use appcfg.py script (in GAE SDK) to deploy

    your project. Start deploying… Auth your GAE account Complete deployment
  15. Application Management •  Use the dashboard to monitor your app

    from: http://www.flickr.com/photos/kevin814/3587610731/
  16. Code Lab: Simple Guestbook •  Goal: •  Create a GAE-based

    application. •  Learn how to use Datastore API •  Learn the webapp framework and template •  Use User service for authentication •  Access data offline •  Attachments: •  blank.zip: The blank project directory. •  gbook-1.zip: The website flow and URL routings •  gbook-2.zip: Design the data models •  gbook-3.zip: Authenticate with Google account •  gbook-4.zip: Use template for output

More Decks by Eric Shangkuan

Other Decks in Programming