Google App Engine
               Technical Update




Chris Schalk                 Ignacio Blanco
Developer Advocate           Software Engineer
http://twitter.com/cschalk   http://twitter.com/blanconet
What is
  cloud
computing?
Cloud Computing Defined




                           SaaS

                         APaaS


                             IaaS


Source: Gartner AADI Summit Dec 2009
IaaS value proposition…
APaaS value proposition…
APaaS value proposition…
Google App Engine



Easy to build
Easy to maintain
Easy to scale
By the numbers
By the numbers
By the numbers


 250,000+
Developers
By the numbers


100,000+
  Apps
By the numbers

  250M+
   daily
Pageviews
In a word… via Wordle




Word source: http://en.wikipedia.org/wiki/App_Engine
Some App Engine Partners
Socialwok
Social networking at scale

          >62M Users
gigy Socialize
gigy Socialize
                                                                      Flexible Scalability




        "Although we typically host all our services in-house,
  on our own infrastructure, we felt that GAE would be a better fit
for the live chat feature because of its unique traffic pattern, which
 is characterized by very low traffic most of the time with very high
                  bursts during high profile events."

                               Raviv Pavel, Gigya VP of Research and Development


http://googleappengine.blogspot.com/2010/02/scalability-means-flexibility.html#links
Why App Engine?
Managing Everything is Hard
DIY Hosting means hidden
           costs
Idle capacity
Software patches & upgrades
License fees
Lots of maintenance
Traffic & utilization forecasting
Upgrades
Cloud development in a box
SDK & “The Cloud”
Hardware
Networking
Operating system
Application runtime
   Java, Python
Static file serving
Services
Fault tolerance
Load balancing
App Engine Details
Specialized Services

Memcache   Datastore   URL Fetch




  Mail      XMPP       Task Queue




 Images    Blobstore   User Service
Specialized Services

Memcache   Datastore   URL Fetch




  Mail      XMPP       Task Queue




 Images    Blobstore   User Service
Language runtimes




             Duke, the Java mascot
           Copyright Š Sun Microsystems Inc., all rights reserved.
Ensuring Portability
Extended Language support
       through JVM
Java
Scala
JRuby (Ruby)
Groovy
Quercus (PHP)
Rhino (JavaScript)    Duke, the Java mascot
                     Copyright Š Sun Microsystems Inc., all rights reserved.

Jython (Python)
Always free to get started
-~5M pageviews/month
  6.5 CPU hrs/day
  1 GB storage
  650K URL Fetch calls/day
  2,000 recipients emailed
  1 GB/day bandwidth
  100,000 tasks enqueued
  650K XMPP messages/day
Application Platform Management
App Engine Dashboard
App Engine Health History
20+ months in review
Apr 2008   Python launch
May 2008   Memcache, Images API
Jul 2008   Logs export
Aug 2008   Batch write/delete
Oct 2008   HTTPS support
Dec 2008   Status dashboard, quota details
Feb 2009   Billing, larger files
Apr 2009   Java launch, DB import, cron support, SDC

May 2009   Key-only queries
Jun 2009   Task queues
Aug 2009   Kindless queries
Sep 2009   XMPP
Oct 2009   Incoming Email
Dec 2009   Blobstore
Feb 2010   Datastore cursors
Happy Birthday App Engine!




  Two years old as of Wed April 7th!
  Vibrant community of over 250k developers
  Over 250 million pageviews
  http://googleappengine.blogspot.com/2010/04/happy-birthday.html
Development Tools for App Engine
Google App Engine Launcher
SDK Console
Google Plugin for Eclipse
New Features!
Cursors
# class Person(db.Model): ...

# Start a query for all Person entities.
q = Person.all()

# If the app stored a cursor during a previous request, use it.
last_cursor = memcache.get('person_cursor')
if last_cursor:
    q.with_cursor(last_cursor)

# Perform the query to get 100 results.
people = q.fetch(100)

# Store the latest cursor for the next request.
cursor = q.cursor()
memcache.set('person_cursor', cursor)
Task queue
# for each user, add a task to send a custom email message
  for u in users:
     taskqueue.add(url='/work/sendmail',
       params=dict(to=u.email, subject='Hello ' + u.name, body='this
is a message!'))

  return # finished now, emails will be sent offline using tasks
  ...
# task handler automatically called for each task created above
  class MailWorker(webapp.RequestHandler):
      def post(self):
       mail.send_mail('from_me@example.com',
          self.request.get('to'), self.request.get('subject'),
          self.request.get('body'))
Cron #1
cron.yaml (in your project root)

cron:
- description: clear memcache
  url: /memcache_clear
  schedule: every 24 hours
...

# Human-readable schedule format:
# every 5 minutes
# every 12 hours
# 2nd,third mon,wed,thu of march 17:00
# every monday 09:00
# 1st monday of sep,oct,nov 17:00
# every day 00:00
Cron #2
...
class ClearMemcache(webapp.RequestHandler):
    def get(self):
      pre_flush_stats = memcache.get_stats()
      memcache.flush_all()
      post_flush_stats = memcache.get_stats()
      subject = 'Daily memcache flush'
      sender = 'somebody@example.com'
      recipient = 'interested-people@example.com'
      body = ('Hello! The weekly memcache flush succeeded.n')
      body += '<3 your friendly neighborhood cron job'
      body += 'pre-flush stats %s nn' % str(pre_flush_stats)
      body += 'post-flush stats %s' % str(post_flush_stats)
      mail.send_mail(sender, recipient, subject, body)

application = webapp.WSGIApplication([('/memcache_clear',
ClearMemcache)], debug=True)
...
AppStats

           Win a T-shirt

           Upload before/after
           screenshots and link
           them on Twitter before
           May 2nd
               @app_engine
               #coolappstats
Demo time!
Wall demo App




http://devfestmxwall.appspot.com
Guestbook + XMPP




http://devfestmxguestbook.appspot.com
Add in gmail and chat with:
 devfestmxguestbook@appspot.
             com
A latin american App
Engine user's perspective:
      eForcers.com
Nuestra Experiencia con Google App Engine

   Aplicaciones empresariales y sitios Web pĂşblicos
   Runtime Python y Java. ~2 aĂąos

Beneficios
  Concentrarnos en la funcionalidad NO en el resto
  FĂĄcil despliegue instalaciĂłn

Retos
   Base de datos relacional vs. Bigtable
   Limitantes y restricciones
FundaciĂłn Rogelio Salmona
                         http://obra.fundacionrogeliosalmona.org




Panel de Soporte para
Operadores Google Apps
ContĂĄctenos

www.eforcers.com

       Eforcers S.A.
       Cra. 12 No. 90 - 20
               Oficina 301
        BogotĂĄ, Colombia
          [571] 6 22 83 20
       info@eforcers.com
More Info on App Engine:
   http://code.google.com/appengine




 http://googleappengine.blogspot.com/
http://gae-java-persistence.blogspot.com/
          http://bit.ly/gcodelabs
One last thing

   If you experience any issue during the
appengine signup like not receiving the SMS



           http://bit.ly/devfestsms

App engine devfest_mexico_10

  • 2.
    Google App Engine Technical Update Chris Schalk Ignacio Blanco Developer Advocate Software Engineer http://twitter.com/cschalk http://twitter.com/blanconet
  • 3.
    What is cloud computing?
  • 4.
    Cloud Computing Defined SaaS APaaS IaaS Source: Gartner AADI Summit Dec 2009
  • 5.
  • 6.
  • 7.
  • 8.
    Google App Engine Easyto build Easy to maintain Easy to scale
  • 9.
  • 10.
  • 11.
    By the numbers 250,000+ Developers
  • 12.
  • 13.
    By the numbers 250M+ daily Pageviews
  • 14.
    In a word…via Wordle Word source: http://en.wikipedia.org/wiki/App_Engine
  • 15.
  • 16.
  • 17.
    Social networking atscale >62M Users
  • 18.
  • 19.
    gigy Socialize Flexible Scalability "Although we typically host all our services in-house, on our own infrastructure, we felt that GAE would be a better fit for the live chat feature because of its unique traffic pattern, which is characterized by very low traffic most of the time with very high bursts during high profile events." Raviv Pavel, Gigya VP of Research and Development http://googleappengine.blogspot.com/2010/02/scalability-means-flexibility.html#links
  • 20.
  • 21.
  • 23.
    DIY Hosting meanshidden costs Idle capacity Software patches & upgrades License fees Lots of maintenance Traffic & utilization forecasting Upgrades
  • 24.
    Cloud development ina box SDK & “The Cloud” Hardware Networking Operating system Application runtime Java, Python Static file serving Services Fault tolerance Load balancing
  • 25.
  • 26.
    Specialized Services Memcache Datastore URL Fetch Mail XMPP Task Queue Images Blobstore User Service
  • 27.
    Specialized Services Memcache Datastore URL Fetch Mail XMPP Task Queue Images Blobstore User Service
  • 28.
    Language runtimes Duke, the Java mascot Copyright Š Sun Microsystems Inc., all rights reserved.
  • 29.
  • 30.
    Extended Language support through JVM Java Scala JRuby (Ruby) Groovy Quercus (PHP) Rhino (JavaScript) Duke, the Java mascot Copyright Š Sun Microsystems Inc., all rights reserved. Jython (Python)
  • 31.
    Always free toget started -~5M pageviews/month 6.5 CPU hrs/day 1 GB storage 650K URL Fetch calls/day 2,000 recipients emailed 1 GB/day bandwidth 100,000 tasks enqueued 650K XMPP messages/day
  • 32.
  • 33.
  • 34.
  • 35.
    20+ months inreview Apr 2008 Python launch May 2008 Memcache, Images API Jul 2008 Logs export Aug 2008 Batch write/delete Oct 2008 HTTPS support Dec 2008 Status dashboard, quota details Feb 2009 Billing, larger files Apr 2009 Java launch, DB import, cron support, SDC May 2009 Key-only queries Jun 2009 Task queues Aug 2009 Kindless queries Sep 2009 XMPP Oct 2009 Incoming Email Dec 2009 Blobstore Feb 2010 Datastore cursors
  • 36.
    Happy Birthday AppEngine! Two years old as of Wed April 7th! Vibrant community of over 250k developers Over 250 million pageviews http://googleappengine.blogspot.com/2010/04/happy-birthday.html
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
    Cursors # class Person(db.Model):... # Start a query for all Person entities. q = Person.all() # If the app stored a cursor during a previous request, use it. last_cursor = memcache.get('person_cursor') if last_cursor: q.with_cursor(last_cursor) # Perform the query to get 100 results. people = q.fetch(100) # Store the latest cursor for the next request. cursor = q.cursor() memcache.set('person_cursor', cursor)
  • 43.
    Task queue # foreach user, add a task to send a custom email message for u in users: taskqueue.add(url='/work/sendmail', params=dict(to=u.email, subject='Hello ' + u.name, body='this is a message!')) return # finished now, emails will be sent offline using tasks ... # task handler automatically called for each task created above class MailWorker(webapp.RequestHandler): def post(self): mail.send_mail('from_me@example.com', self.request.get('to'), self.request.get('subject'), self.request.get('body'))
  • 44.
    Cron #1 cron.yaml (inyour project root) cron: - description: clear memcache url: /memcache_clear schedule: every 24 hours ... # Human-readable schedule format: # every 5 minutes # every 12 hours # 2nd,third mon,wed,thu of march 17:00 # every monday 09:00 # 1st monday of sep,oct,nov 17:00 # every day 00:00
  • 45.
    Cron #2 ... class ClearMemcache(webapp.RequestHandler): def get(self): pre_flush_stats = memcache.get_stats() memcache.flush_all() post_flush_stats = memcache.get_stats() subject = 'Daily memcache flush' sender = 'somebody@example.com' recipient = 'interested-people@example.com' body = ('Hello! The weekly memcache flush succeeded.n') body += '<3 your friendly neighborhood cron job' body += 'pre-flush stats %s nn' % str(pre_flush_stats) body += 'post-flush stats %s' % str(post_flush_stats) mail.send_mail(sender, recipient, subject, body) application = webapp.WSGIApplication([('/memcache_clear', ClearMemcache)], debug=True) ...
  • 46.
    AppStats Win a T-shirt Upload before/after screenshots and link them on Twitter before May 2nd @app_engine #coolappstats
  • 47.
  • 48.
  • 49.
    Guestbook + XMPP http://devfestmxguestbook.appspot.com Addin gmail and chat with: devfestmxguestbook@appspot. com
  • 50.
    A latin americanApp Engine user's perspective: eForcers.com
  • 51.
    Nuestra Experiencia conGoogle App Engine Aplicaciones empresariales y sitios Web pĂşblicos Runtime Python y Java. ~2 aĂąos Beneficios Concentrarnos en la funcionalidad NO en el resto FĂĄcil despliegue instalaciĂłn Retos Base de datos relacional vs. Bigtable Limitantes y restricciones
  • 52.
    FundaciĂłn Rogelio Salmona http://obra.fundacionrogeliosalmona.org Panel de Soporte para Operadores Google Apps
  • 53.
    ContĂĄctenos www.eforcers.com Eforcers S.A. Cra. 12 No. 90 - 20 Oficina 301 BogotĂĄ, Colombia [571] 6 22 83 20 info@eforcers.com
  • 54.
    More Info onApp Engine: http://code.google.com/appengine http://googleappengine.blogspot.com/ http://gae-java-persistence.blogspot.com/ http://bit.ly/gcodelabs
  • 55.
    One last thing If you experience any issue during the appengine signup like not receiving the SMS http://bit.ly/devfestsms