SlideShare a Scribd company logo
Google App Engine
                           …is an expression of how Google
                              thinks about infrastructure.


                         DevNexus App Engine Update
                                    Mar 21, 2012


                                             David Chandler
                                             Developer Advocate
                                             drfibonacci@google.com


Friday, March 23, 2012
Agenda
            App Engine intro
             ‣ 60 second demo
            Whatʼs new in App Engine?
             ‣ SLA, premier accounts, security audits
             ‣ Backends, pull queues
             ‣ HRD, query planner, XG transactions
             ‣ Cloud SQL, Files API
            Load testing recipe
            Minimize response time, cost
            Case study (Mike Lawrence)
            Wrap up / Questions?




Friday, March 23, 2012
Cloud in a box
            Easy to build
             ‣ Local SDK - Java, Python, Go
             ‣ Lots of APIs


            Easy to maintain
             ‣ Admin Console
             ‣ Site Reliability Engineers
             ‣ No clunky knobs/dials


            Easy to scale
             ‣ Google scale infrastructure
             ‣ No limits to how much data your can put in the datastore




Friday, March 23, 2012
Two minute demo




                                           4


Friday, March 23, 2012
Out of labs... weʼre growing up!


                         ✓ Supported product

                         ✓ 99.95% uptime guarantee (SLA)

                         ✓ Paid operational support

                         ✓ Platform certifications

                         ✓ Growing fast...



                                             5

Friday, March 23, 2012
3B+ Requests / day
       300k+ Apps
       100k+ Developers


             2008                          2009                           2010                     2011
                                                                                        High
       Memcache                                   Task                               Replication
                                                Queues                                Datastore
                         HTTPS                               Appstats                              Go Runtime
                                                                                      Channel
                                                     XMPP               Namespaces      API          ISAE3402
 Python Runtime
                                 Java Runtime        Email                     API                       Type II
                                                                                                   Certification
                                                                                            Backends

                                                                                           Pull Queues



Friday, March 23, 2012
Common types of App Engine apps
            Mobile/Tablet
             ‣ App backends
             ‣ Cloud persistence
            Social/Mobile Games
             ‣ Speed, scale
             ‣ API integrations
            Consumer Web Apps
             ‣ Unpredictable traffic
             ‣ Scale
            Business Web Apps
             ‣ Enterprise
             ‣ Java runtime




Friday, March 23, 2012
App Engine customers




                         8

Friday, March 23, 2012
Social networking at scale




                               >75M Installs



                           9

Friday, March 23, 2012
Angry Birds =          +   +        +   +




                                 10

Friday, March 23, 2012
Khan Academy




                               SALMAN KHAN

                  www.youtube.com/watch?v=gM95HHI4gLk#t=0m15s
                                         11

Friday, March 23, 2012
The Royal Wedding




                         - 32k req/second peak
                         - 37m pageviews
                         - 13m visitors




                                           12

Friday, March 23, 2012
Mobile/game backend .... PocketGems




                         13

Friday, March 23, 2012
WebFilings




                         14

Friday, March 23, 2012
Best Buy




                         15

Friday, March 23, 2012
Chillingo Crystal
  Gaming meets Social
      16




    Zombie Dash          Angry Birds LITE   Underground       Meltdown          Cogs




Mission Deep Sea          Speed Forge       Guerilla Bob    Ravensword:      Angry Birds
                            Extreme                        The Fallen King


Friday, March 23, 2012
What’s New?



                              17
Friday, March 23, 2012
Feature overview

                                                            URL Fetch
                           Frontends
                                                            XMPP
                Compute    Backends              Network
                                                            Channel API
                           Task Queues
                                                            Mail API
                           Cron



                           Datastore                        Images API
                 Storage
                           Memcache                         App Identity
                                                 Services
                           Namespaces                       Users API
                           Blobstore                        MapReduce API
                           Cloud SQL                        Pipeline API
                           Static content                   Prospective Search API




                                            18

Friday, March 23, 2012
Frontends, Backends, Task Queue, Cron                      Compute




                                      Pull (Task) Queues

                           App
                            App
                          Engine        Push (Task) Queues / Cron
                           Engine
           Client        Frontend
            Client        Frontend



                                       App
                           App           App
                            App       Engine
                                          App
           Client         Engine       Engine
                                           App
            Client         Engine    Frontend
                                         Engine
                         Backend      Frontend
                                          Engine
                          Backend       Backend
                                         Backend




                           19

Friday, March 23, 2012
URL Fetch                                                         Network


            HTTP/1.1
             ‣ GET, POST, PUT, HEAD, and DELETE
            Maximum request deadlines
             ‣ 60s (default 5s): user facing (online) requests
             ‣ 10 minutes (new): cron, task queue (offline) requests
            Execution options
             ‣ Synchronous
             ‣ Async




Friday, March 23, 2012
Talking to the outside world          Network


            XMPP / Jabber
             ‣ Send/receive messages
             ‣ Send chat invites
             ‣ Request presence, status
             ‣ Set status
            Channel API
             ‣ Server push
            Mail API
             ‣ Send and receive
            Use cases
             ‣ Chat bot
             ‣ Realtime notifications
             ‣ Chat user interface


Friday, March 23, 2012
Images                      Services




                         22

Friday, March 23, 2012
Prospective search                                                  Services


            Register your queries
             ‣ Define interesting search criteria
            Create your data
             ‣ Users and systems interact with your app
            Receive callbacks
             ‣ App Engine tells you about data which matches searches




Friday, March 23, 2012
Identity                                                         Services


            Users API
             ‣ Require users to login and identify
               - Email address
               - Unique, stable id
             ‣ Servlet filter for dynamic requests


            App Identity
             ‣ Who am I?
               appIdentityService.getServiceAccountName()
                ‣ Assert your identity to applications
                  - GAE handles key security, key rotation for you
                  - Other Google APIs
                         appIdentityService.getAccessToken()
                   - On other systems
                         appIdentityService.signForApp()



Friday, March 23, 2012
MapReduce & Pipeline API                                       Services




                         code.google.com/p/appengine-pipeline/
                                             25

Friday, March 23, 2012
High Replication Datastore (HRD)                                                Storage


            Schemaless
            Object datastore
             ‣ Entities & Entity Groups
            Query engine
             ‣ Standard & custom indexes
            Atomic transactions
            Features
             ‣ Highly scalable
               - More distributed as more data is stored
             ‣ Highly reliable
               - Synchronous, multi-datacenter replication
             ‣ Managed
                         www.google.com/events/io/2011/sessions/more-9s-please-
                          under-the-covers-of-the-high-replication-datastore.html


Friday, March 23, 2012
Advanced query planner New!                                           Storage


            Datastore never requires an exploding index
             ‣ code.google.com/appengine/docs/python/datastore/
               queries.html#Big_Entities_and_Exploding_Indexes
            dev_appserver
             ‣ Understands query planner changes
            Zigzag merge-join queries
             ‣ Will continue scanning for up to 30 sec
             ‣ No more "needs index" errors (although some may timeout)
             ‣ www.google.com/events/io/2009/sessions/
               BuildingScalableComplexApps.html




Friday, March 23, 2012
The “old” query planner                                                                   Storage



                                               es
          Index(Photo,                   I
                         owner_id,s -date)ndex
                              Tag -rating) = 256
          Index(Photo,   owner_id,    2^6*4       12
          Index(Photo,           1
                         owner_id, -comments) = 5
          Index(Photo,           2     2^7*4
                         owner_id, -downloads) 1024
                                               =
          Index(Photo,   size, -date) 2^   8*4
                                  3                .
          Index(Photo,   size, -rating)     .
          Index(Photo,             .
                         size, -comments)           .
          Index(Photo,   size, -downloads) .
                                    .
          …
          Index(Photo,   owner_id,   size,   -date)
          Index(Photo,   owner_id,   size,   -rating)
          Index(Photo,   owner_id,   size,   -comments)
          Index(Photo,   owner_id,   size,   -downloads)
          …
          Index(Photo,   aspect,   coloration,   license,   owner_id,   size,   -date)
          Index(Photo,   aspect,   coloration,   license,   owner_id,   size,   -rating)
          Index(Photo,   aspect,   coloration,   license,   owner_id,   size,   -comments)
          Index(Photo,   aspect,   coloration,   license,   owner_id,   size,   -downloads)

          = 2^(no. of filters) * (no. of different orders) = 2 ^ 6 * 4 = 256 indexes




Friday, March 23, 2012
The “improved” query planner                                              Storage




          Index(Photo,   owner_id, -date)
          Index(Photo,   owner_id, -rating)
          Index(Photo,   owner_id, -comments)
          Index(Photo,   owner_id, -downloads)
          Index(Photo,   size, -date)
          Index(Photo,   size, -rating)
          Index(Photo,   size, -comments)
          Index(Photo,   size, -downloads)
          …
          Index(Photo,   license,   -date)
          Index(Photo,   license,   -rating)
          Index(Photo,   license,   -comments)
          Index(Photo,   license,   -downloads)
          …
          Index(Photo,   tag, -date)
          Index(Photo,   tag, -rating)
          Index(Photo,   tag, -comments)
          Index(Photo,   tag, -downloads)
          = (number of   filters) * (number of orders) = 7 * 4 = 28 indexes




Friday, March 23, 2012
Query planner performance - cost trade-offs
            Option #1 - Write to more indexes at write time
             ‣ Entity writes are expensive
             ‣ Possible queries must be known in advance
               - Others will fail with Needs Index error
             ‣ Predictable / fast query time [for supported queries]


            Option #2 - Scan multiple indexes at read time
             ‣ Entity writes much cheaper
             ‣ More queries possible with fewer indexes
             ‣ Ad hoc queries
             ‣ Query response time depends on shape of data
               - Specific cases can be optimized by providing addʼl indexes




Friday, March 23, 2012
Using the new query planner                                      Storage


            Upgrade to 1.5.4+
            Turn off auto index generation
             ‣ Python: dev_appserver.py --require_indexes
             ‣ Java: <datastore-indexes autoGenerate="false">
            Remove unnecessary custom index definitions
             ‣ Python:
               - index.yaml
             ‣ Java:
               - WEB-INF/datastore-indexes.xml
               - WEB-INF/appengine-generated/datastore-indexes-auto.xml
            Test your app
            Deploy to production
             ‣ Judiciously run: appcfg vacuum_indexes


Friday, March 23, 2012
XG Transactions New!                                                   Storage


            In a single transaction…
              ‣ Access 1..5 entity groups - read and/or write
              ‣ Does not provide transactional ancestor-less query
              ‣ Does allow 1..5 separate ancestor queries within transaction
            Concurrency exceptions possible
             ‣ 1st access of each entity group
             ‣ For reads as well as writes
            Availability
             ‣ Only in HRD apps
             ‣ App Engine 1.5.5 release
            Non-ancestor (transaction-less) queries may see…
             ‣ Partially committed non-XG transaction (same as before)
             ‣ Partially committed XG transactions (more likely)


Friday, March 23, 2012
XG Transactions - Java                                                        Storage




          import com.google.appengine.api.datastore.*;

          void transferFunds(long amt, String fromAccount, String toAccount) {
            DatastoreService datastore =
                DatastoreServiceFactory.getDatastoreService();
            TransactionOptions options = TransactionOptions.Builder.withXG(true);
            Transaction txn = datastore.beginTransaction(options);

              Entity a = datastore.get(KeyFactory.createKey("Account", fromAccount));
              Entity b = datastore.get(KeyFactory.createKey("Account", toAccount));

              a.setProperty("balance", (Long) a.getProperty("balance") - amt);
              b.setProperty("balance", (Long) b.getProperty("balance") + amt);

              datastore.put(txn, a);
              datastore.put(txn, b);

              txn.commit();
          }




Friday, March 23, 2012
Cloud SQL (labs)                                                   Storage



             New! Cloud SQL support in Google Plugin for Eclipse 2.5



                     Client




       Client




               Client




                              Client



                                           34

Friday, March 23, 2012
Cloud SQL (labs)                                              Storage


            Developer console
             ‣ Easy to use
            Fully managed
             ‣ Site Reliability Engineers (SREs)
            High availability
             ‣ Synchronous replication to multiple data centers
            Integrated with Google App Engine
              ‣ Java: JDBC, Python: DB-API
              ‣ Use with High Replication Datastore
            Migration
             ‣ MySQL Import / export




Friday, March 23, 2012
Google Cloud Storage / Files API                                   Storage


            Google Cloud Storage
             ‣ Buckets in the cloud
             ‣ REST API
             ‣ Command line
             ‣ Web UI tool
             ‣ Enable in APIs console



            Use from App Engine
             ‣ Files API (new)
             ‣ No more OAuth hassle
             ‣ http://code.google.com/appengine/docs/java/googlestorage/
               overview.html



Friday, March 23, 2012
Minimize response time



                                    37

Friday, March 23, 2012
Appstats
                              “I used to be blind,
                              but now I can see :-)”
                                  --An early Appstats user




                         38

Friday, March 23, 2012
Load testing - Guidelines
            Test traffic must be representative of real user traffic
            Ramp over a period of several minutes




                                               his!
                                           o ts ! s
                                        t d hi e i etter
                                      on’ T ic
                                    D      N
                                             uc  h b
                                           m




Friday, March 23, 2012
Load testing - basic recipe
            Send steady 5 qps traffic to your site
             ‣ Uncover basic problems, e.g. entity contention on global data
            Monitor for 15-20 minutes and expect to see:
             ‣ Stable request latency <1000ms (no longer an issue)
             ‣ Zero quota denials
             ‣ Low error rate
             ‣ Tasks queues are keeping up
             ‣ No elevated datastore contention
            Slowly ramp up; increase traffic by 2x
             ‣ Uncover next application bottleneck, if any
            Repeat until serving desired qps
             ‣ Plan your next feature




Friday, March 23, 2012
Memcache




                                       2 ms

                           App
                             App
           Client         Engine
                              App
            Client         Engine
                               App
                         Frontend
                             Engine
                          Frontend
                              Engine
                            Backend
                             Backend   20m
                                              s




                                        41

Friday, March 23, 2012
Enable content caching
            Free lunch possibility
             ‣ And your users will be happier too
            Use memcache
             ‣ Only if you care about your users
            Static resource files
             ‣ Do not consume instance hours
            HTTP/1.1 caching
               Cache-Control: public, s-maxage=...
                ‣ Respected by browsers, ISPs and App Engine
                ‣ Saves bandwidth
            Replace dynamic content with
             ‣ Static content
             ‣ Blobstore (custom HTTP headers)


Friday, March 23, 2012
Best practices in client-side code
                                                    Clients all
                             t his!
                    Av oid                          checking in at a
                                                    specific time of
                                                    day
                                                    Spread out load:
                                                    - Randomize client checkin times

                                                       Clients retr y
                                                       failures after a
                                      t his!
                             And                       fixe d interval
                                                          Avoi d a Denials-of-Ser vice
                                                          (DoS) on yo ur app after a
                                                          failure:
                                                          - Use exponential back-off:
                                                          1s, 2s, 4s, 8s, 16s, …
                                                          - Use a fuzz factor:
                                                          randomize retr y times
                                               43

Friday, March 23, 2012
Best practices in server-side code
            Reduce instance hours
             ‣ Reduce request latency
             ‣ Use Memcache
             ‣ Datastore/Memcache batch get/put
             ‣ Async URL Fetch, Datastore, Memcache
               - Parallelize RPCs
             ‣ Enable HTTP session async writes
            Spin up fewer instances
             ‣ Task queue rate and max_concurrent_requests
             ‣ X-AppEngine-FailFast



              code.google.com/appengine/articles/managing-resources.html



Friday, March 23, 2012
Best practices in server-side code
            Enable concurrent requests
             ‣ Java appengine-web.xml
             ‣ Python 2.7
            Discounted reserved instance hours
             ‣ $0.08/hr → $0.05/hr
            Scheduler knobs
             ‣ Max Idle Instances
             ‣ Min Pending Latency




Friday, March 23, 2012
Manage storage costs
            Discard stuff you no longer need
             ‣ Entities
             ‣ Indexes
             ‣ Blobs
             ‣ Tasks
            Drop unwanted indexes
             ‣ Vacuum custom indexes
             ‣ New query planner
            Explicitly mark properties as unindexed
             ‣ To migrate existing entities, put() again with:
               Python: foo = db.StringProperty(indexed=False)
               Java: entity.setUnindexedProperty(“foo”, “bar”)




Friday, March 23, 2012
Manage 'datastore ops' costs
            Number of write ops in SDK
            Fewer indexes & indexed properties → fewer write ops
            Take advantage of query planner improvements
            Replace queries with
             ‣ keys-only queries (cheaper)
             ‣ fetch-by-key (optimal)
             ‣ datastore cursors (for pagination)




Friday, March 23, 2012
Enable warming requests
            Request logs
               /_ah/warmup
            Default behavior
             ‣ Enabled for Java apps / Disabled for Python apps
             ‣ All jar files are indexed in memory
             ‣ Initializes your application and filters
               - Servlets marked in <load-on-startup>
               - ServletContextListener filters
            Custom warmup servlet
             ‣ Override built-in _ah_warmup servlet
                     <servlet>
                      <servlet-name>_ah_warmup</servlet-name>
                      <servlet-class>foo.MyWarmupServlet</servlet-class>
                     </servlet>




Friday, March 23, 2012
Only upload what you need
            Python
               static_files, static_dir
               skip_files
            Java
               <static-files>
               <resource-files>
            Diagnostics
               appcfg.sh --retain_upload_dir update …




Friday, March 23, 2012
Custom error pages
            Avoid




            Java
               <static-error-handlers>
               <handler file="default_error.html"/>
               <handler file="over_quota.html" error-
               code="over_quota"/>
               </static-error-handlers>
            Python
               error_handlers:
                 - file: default_error.html
                 - error_code: over_quota
                   file: over_quota.html




Friday, March 23, 2012

More Related Content

PPTX
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
BIOVIA
 
PPTX
(ATS3-GS03) Accelrys Enterprise Platform Deeper Dive
BIOVIA
 
PDF
Cloud Computing2
rajivmordani
 
PDF
Ajax World Oct2008 Jrd
rajivmordani
 
PDF
Egl Rui Ajax World
rajivmordani
 
PPTX
Webinar The App Lifecycle Platform
Service2Media
 
PDF
Mahmoud Khattab
Mahmoud_Khattab
 
PDF
전문가토크릴레이 1탄 html5 전망 (전종홍 박사)
Saltlux zinyus
 
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
BIOVIA
 
(ATS3-GS03) Accelrys Enterprise Platform Deeper Dive
BIOVIA
 
Cloud Computing2
rajivmordani
 
Ajax World Oct2008 Jrd
rajivmordani
 
Egl Rui Ajax World
rajivmordani
 
Webinar The App Lifecycle Platform
Service2Media
 
Mahmoud Khattab
Mahmoud_Khattab
 
전문가토크릴레이 1탄 html5 전망 (전종홍 박사)
Saltlux zinyus
 

What's hot (20)

PDF
Aras Role Based Clients
Prodeos
 
PDF
Java Web Programming Using Cloud Platform: Module 10
IMC Institute
 
PDF
Frank Mantek Google G Data
deimos
 
PPTX
Deep Dive SharePoint 2013: Developing applications in SharePoint 2013: forget...
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
PDF
[2011-17-C-4] Heroku & database.com
Mitch Okamoto
 
PDF
V fabric overview
Pronam Chatterjee
 
PDF
adrian coyler open tour keynote
marklucovsky
 
PDF
Java one brazil_keynote_dochez
Jerome Dochez
 
PDF
Wc Mand Connectors2
day
 
PDF
JavaOne 2015 Keynote Presentation
ibmwebspheresoftware
 
PPTX
Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!
goodfriday
 
PPTX
A great api is hard to find
Dan Diephouse
 
PDF
Sencha Web Applications Come of Age
bastila
 
PPTX
Meteor Mobile App Development
Sanjay Kumar
 
PPTX
Building single page, modular html5 applications for PC and Mobile
Lorant Domokos
 
PDF
Social Enterprise Java Apps on Heroku Webinar
Salesforce Developers
 
PPTX
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
rsnarayanan
 
PDF
Java Enterprise Edition 6 Overview
Eugene Bogaart
 
PPTX
Leapfrogging with legacy
clive boulton
 
PDF
Ajax In Enterprise Portals Wesley Hales
rajivmordani
 
Aras Role Based Clients
Prodeos
 
Java Web Programming Using Cloud Platform: Module 10
IMC Institute
 
Frank Mantek Google G Data
deimos
 
Deep Dive SharePoint 2013: Developing applications in SharePoint 2013: forget...
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
[2011-17-C-4] Heroku & database.com
Mitch Okamoto
 
V fabric overview
Pronam Chatterjee
 
adrian coyler open tour keynote
marklucovsky
 
Java one brazil_keynote_dochez
Jerome Dochez
 
Wc Mand Connectors2
day
 
JavaOne 2015 Keynote Presentation
ibmwebspheresoftware
 
Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!
goodfriday
 
A great api is hard to find
Dan Diephouse
 
Sencha Web Applications Come of Age
bastila
 
Meteor Mobile App Development
Sanjay Kumar
 
Building single page, modular html5 applications for PC and Mobile
Lorant Domokos
 
Social Enterprise Java Apps on Heroku Webinar
Salesforce Developers
 
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
rsnarayanan
 
Java Enterprise Edition 6 Overview
Eugene Bogaart
 
Leapfrogging with legacy
clive boulton
 
Ajax In Enterprise Portals Wesley Hales
rajivmordani
 
Ad

Viewers also liked (7)

PDF
Postgres plus cloud_database_getting_started_guide
ice1oog
 
PDF
Mi primera app con GAE y GWT
GDG Lima
 
PDF
oikos Newsletter
oikos
 
PPT
The 90-Day Startup with Google AppEngine for Java
David Chandler
 
PDF
Hands on App Engine
Simon Su
 
PDF
Developing TouchActive with GAE and GWT - Google DevFest Barcelona 2012
Andrew Mackenzie
 
PDF
Google App Engine
Publicis Sapient Engineering
 
Postgres plus cloud_database_getting_started_guide
ice1oog
 
Mi primera app con GAE y GWT
GDG Lima
 
oikos Newsletter
oikos
 
The 90-Day Startup with Google AppEngine for Java
David Chandler
 
Hands on App Engine
Simon Su
 
Developing TouchActive with GAE and GWT - Google DevFest Barcelona 2012
Andrew Mackenzie
 
Google App Engine
Publicis Sapient Engineering
 
Ad

Similar to Google App Engine Update 2012 (20)

PDF
Barak Regev - Google Cloud Platform
Paris Open Source Summit
 
PDF
App Engine Overview @ Google Hackathon SXSW 2010
Chris Schalk
 
PDF
App Engine Presentation @ SFJUG Sep 2010
Chris Schalk
 
PDF
Inaugural address manjusha - Indicthreads cloud computing conference 2011
IndicThreads
 
PDF
What's new in App Engine and intro to App Engine for Business
Chris Schalk
 
PDF
App engine cloud_comp_expo_nyc
Chris Schalk
 
PDF
Windows Azure For Architects
Anko Duizer
 
PDF
App Engine Overview Cloud Futures Publish
Chris Schalk
 
PDF
API Design & Moving from Junior to Senior Developer
christophercotton
 
PDF
Javaedge 2010-cschalk
Chris Schalk
 
PDF
Software Development Engineers Ireland
Sean O'Sullivan
 
PDF
Introduction to Google's Cloud Technologies
Chris Schalk
 
PPT
IBM Pulse 2013 session - DevOps for Mobile Apps
Sanjeev Sharma
 
PDF
Google AppEngine @Open World Forum 2012 - 12 oct.2012
Paris Open Source Summit
 
PDF
OWF12/Java Moussine pouchkine Girard
Paris Open Source Summit
 
PDF
Development Model for The Cloud
umityalcinalp
 
PPTX
SiLApps for Smart Working
Software in Life
 
PPTX
Si l 세미나_#3_v2.3_20121128
현 강
 
PDF
Fluentd meetup #3
Treasure Data, Inc.
 
PDF
Node.js Enterprise Middleware
Behrad Zari
 
Barak Regev - Google Cloud Platform
Paris Open Source Summit
 
App Engine Overview @ Google Hackathon SXSW 2010
Chris Schalk
 
App Engine Presentation @ SFJUG Sep 2010
Chris Schalk
 
Inaugural address manjusha - Indicthreads cloud computing conference 2011
IndicThreads
 
What's new in App Engine and intro to App Engine for Business
Chris Schalk
 
App engine cloud_comp_expo_nyc
Chris Schalk
 
Windows Azure For Architects
Anko Duizer
 
App Engine Overview Cloud Futures Publish
Chris Schalk
 
API Design & Moving from Junior to Senior Developer
christophercotton
 
Javaedge 2010-cschalk
Chris Schalk
 
Software Development Engineers Ireland
Sean O'Sullivan
 
Introduction to Google's Cloud Technologies
Chris Schalk
 
IBM Pulse 2013 session - DevOps for Mobile Apps
Sanjeev Sharma
 
Google AppEngine @Open World Forum 2012 - 12 oct.2012
Paris Open Source Summit
 
OWF12/Java Moussine pouchkine Girard
Paris Open Source Summit
 
Development Model for The Cloud
umityalcinalp
 
SiLApps for Smart Working
Software in Life
 
Si l 세미나_#3_v2.3_20121128
현 강
 
Fluentd meetup #3
Treasure Data, Inc.
 
Node.js Enterprise Middleware
Behrad Zari
 

More from David Chandler (13)

PPTX
Taking Your GWT App to Tablets with GXT 4.0
David Chandler
 
PDF
StORM: a lightweight ORM for Android SQLite
David Chandler
 
PDF
Easy REST APIs with Jersey and RestyGWT
David Chandler
 
PDF
Cómo trabajan los Googlers
David Chandler
 
PDF
Life of an engineer
David Chandler
 
PDF
StORM preview
David Chandler
 
PDF
GWT Plus HTML 5
David Chandler
 
PDF
Scalable Apps with Google App Engine
David Chandler
 
PDF
What's New in GWT 2.2
David Chandler
 
PDF
Develop and Deploy Scalable Apps with Google App Engine
David Chandler
 
PDF
Secrets of the GWT
David Chandler
 
PPT
GWT MVP Case Study
David Chandler
 
PDF
Securing JSF Applications Against the OWASP Top Ten
David Chandler
 
Taking Your GWT App to Tablets with GXT 4.0
David Chandler
 
StORM: a lightweight ORM for Android SQLite
David Chandler
 
Easy REST APIs with Jersey and RestyGWT
David Chandler
 
Cómo trabajan los Googlers
David Chandler
 
Life of an engineer
David Chandler
 
StORM preview
David Chandler
 
GWT Plus HTML 5
David Chandler
 
Scalable Apps with Google App Engine
David Chandler
 
What's New in GWT 2.2
David Chandler
 
Develop and Deploy Scalable Apps with Google App Engine
David Chandler
 
Secrets of the GWT
David Chandler
 
GWT MVP Case Study
David Chandler
 
Securing JSF Applications Against the OWASP Top Ten
David Chandler
 

Recently uploaded (20)

PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
The Future of Artificial Intelligence (AI)
Mukul
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Doc9.....................................
SofiaCollazos
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 

Google App Engine Update 2012

  • 1. Google App Engine …is an expression of how Google thinks about infrastructure. DevNexus App Engine Update Mar 21, 2012 David Chandler Developer Advocate [email protected] Friday, March 23, 2012
  • 2. Agenda App Engine intro ‣ 60 second demo Whatʼs new in App Engine? ‣ SLA, premier accounts, security audits ‣ Backends, pull queues ‣ HRD, query planner, XG transactions ‣ Cloud SQL, Files API Load testing recipe Minimize response time, cost Case study (Mike Lawrence) Wrap up / Questions? Friday, March 23, 2012
  • 3. Cloud in a box Easy to build ‣ Local SDK - Java, Python, Go ‣ Lots of APIs Easy to maintain ‣ Admin Console ‣ Site Reliability Engineers ‣ No clunky knobs/dials Easy to scale ‣ Google scale infrastructure ‣ No limits to how much data your can put in the datastore Friday, March 23, 2012
  • 4. Two minute demo 4 Friday, March 23, 2012
  • 5. Out of labs... weʼre growing up! ✓ Supported product ✓ 99.95% uptime guarantee (SLA) ✓ Paid operational support ✓ Platform certifications ✓ Growing fast... 5 Friday, March 23, 2012
  • 6. 3B+ Requests / day 300k+ Apps 100k+ Developers 2008 2009 2010 2011 High Memcache Task Replication Queues Datastore HTTPS Appstats Go Runtime Channel XMPP Namespaces API ISAE3402 Python Runtime Java Runtime Email API Type II Certification Backends Pull Queues Friday, March 23, 2012
  • 7. Common types of App Engine apps Mobile/Tablet ‣ App backends ‣ Cloud persistence Social/Mobile Games ‣ Speed, scale ‣ API integrations Consumer Web Apps ‣ Unpredictable traffic ‣ Scale Business Web Apps ‣ Enterprise ‣ Java runtime Friday, March 23, 2012
  • 8. App Engine customers 8 Friday, March 23, 2012
  • 9. Social networking at scale >75M Installs 9 Friday, March 23, 2012
  • 10. Angry Birds = + + + + 10 Friday, March 23, 2012
  • 11. Khan Academy SALMAN KHAN www.youtube.com/watch?v=gM95HHI4gLk#t=0m15s 11 Friday, March 23, 2012
  • 12. The Royal Wedding - 32k req/second peak - 37m pageviews - 13m visitors 12 Friday, March 23, 2012
  • 13. Mobile/game backend .... PocketGems 13 Friday, March 23, 2012
  • 14. WebFilings 14 Friday, March 23, 2012
  • 15. Best Buy 15 Friday, March 23, 2012
  • 16. Chillingo Crystal Gaming meets Social 16 Zombie Dash Angry Birds LITE Underground Meltdown Cogs Mission Deep Sea Speed Forge Guerilla Bob Ravensword: Angry Birds Extreme The Fallen King Friday, March 23, 2012
  • 17. What’s New? 17 Friday, March 23, 2012
  • 18. Feature overview URL Fetch Frontends XMPP Compute Backends Network Channel API Task Queues Mail API Cron Datastore Images API Storage Memcache App Identity Services Namespaces Users API Blobstore MapReduce API Cloud SQL Pipeline API Static content Prospective Search API 18 Friday, March 23, 2012
  • 19. Frontends, Backends, Task Queue, Cron Compute Pull (Task) Queues App App Engine Push (Task) Queues / Cron Engine Client Frontend Client Frontend App App App App Engine App Client Engine Engine App Client Engine Frontend Engine Backend Frontend Engine Backend Backend Backend 19 Friday, March 23, 2012
  • 20. URL Fetch Network HTTP/1.1 ‣ GET, POST, PUT, HEAD, and DELETE Maximum request deadlines ‣ 60s (default 5s): user facing (online) requests ‣ 10 minutes (new): cron, task queue (offline) requests Execution options ‣ Synchronous ‣ Async Friday, March 23, 2012
  • 21. Talking to the outside world Network XMPP / Jabber ‣ Send/receive messages ‣ Send chat invites ‣ Request presence, status ‣ Set status Channel API ‣ Server push Mail API ‣ Send and receive Use cases ‣ Chat bot ‣ Realtime notifications ‣ Chat user interface Friday, March 23, 2012
  • 22. Images Services 22 Friday, March 23, 2012
  • 23. Prospective search Services Register your queries ‣ Define interesting search criteria Create your data ‣ Users and systems interact with your app Receive callbacks ‣ App Engine tells you about data which matches searches Friday, March 23, 2012
  • 24. Identity Services Users API ‣ Require users to login and identify - Email address - Unique, stable id ‣ Servlet filter for dynamic requests App Identity ‣ Who am I? appIdentityService.getServiceAccountName() ‣ Assert your identity to applications - GAE handles key security, key rotation for you - Other Google APIs appIdentityService.getAccessToken() - On other systems appIdentityService.signForApp() Friday, March 23, 2012
  • 25. MapReduce & Pipeline API Services code.google.com/p/appengine-pipeline/ 25 Friday, March 23, 2012
  • 26. High Replication Datastore (HRD) Storage Schemaless Object datastore ‣ Entities & Entity Groups Query engine ‣ Standard & custom indexes Atomic transactions Features ‣ Highly scalable - More distributed as more data is stored ‣ Highly reliable - Synchronous, multi-datacenter replication ‣ Managed www.google.com/events/io/2011/sessions/more-9s-please- under-the-covers-of-the-high-replication-datastore.html Friday, March 23, 2012
  • 27. Advanced query planner New! Storage Datastore never requires an exploding index ‣ code.google.com/appengine/docs/python/datastore/ queries.html#Big_Entities_and_Exploding_Indexes dev_appserver ‣ Understands query planner changes Zigzag merge-join queries ‣ Will continue scanning for up to 30 sec ‣ No more "needs index" errors (although some may timeout) ‣ www.google.com/events/io/2009/sessions/ BuildingScalableComplexApps.html Friday, March 23, 2012
  • 28. The “old” query planner Storage es Index(Photo, I owner_id,s -date)ndex Tag -rating) = 256 Index(Photo, owner_id, 2^6*4 12 Index(Photo, 1 owner_id, -comments) = 5 Index(Photo, 2 2^7*4 owner_id, -downloads) 1024 = Index(Photo, size, -date) 2^ 8*4 3 . Index(Photo, size, -rating) . Index(Photo, . size, -comments) . Index(Photo, size, -downloads) . . … Index(Photo, owner_id, size, -date) Index(Photo, owner_id, size, -rating) Index(Photo, owner_id, size, -comments) Index(Photo, owner_id, size, -downloads) … Index(Photo, aspect, coloration, license, owner_id, size, -date) Index(Photo, aspect, coloration, license, owner_id, size, -rating) Index(Photo, aspect, coloration, license, owner_id, size, -comments) Index(Photo, aspect, coloration, license, owner_id, size, -downloads) = 2^(no. of filters) * (no. of different orders) = 2 ^ 6 * 4 = 256 indexes Friday, March 23, 2012
  • 29. The “improved” query planner Storage Index(Photo, owner_id, -date) Index(Photo, owner_id, -rating) Index(Photo, owner_id, -comments) Index(Photo, owner_id, -downloads) Index(Photo, size, -date) Index(Photo, size, -rating) Index(Photo, size, -comments) Index(Photo, size, -downloads) … Index(Photo, license, -date) Index(Photo, license, -rating) Index(Photo, license, -comments) Index(Photo, license, -downloads) … Index(Photo, tag, -date) Index(Photo, tag, -rating) Index(Photo, tag, -comments) Index(Photo, tag, -downloads) = (number of filters) * (number of orders) = 7 * 4 = 28 indexes Friday, March 23, 2012
  • 30. Query planner performance - cost trade-offs Option #1 - Write to more indexes at write time ‣ Entity writes are expensive ‣ Possible queries must be known in advance - Others will fail with Needs Index error ‣ Predictable / fast query time [for supported queries] Option #2 - Scan multiple indexes at read time ‣ Entity writes much cheaper ‣ More queries possible with fewer indexes ‣ Ad hoc queries ‣ Query response time depends on shape of data - Specific cases can be optimized by providing addʼl indexes Friday, March 23, 2012
  • 31. Using the new query planner Storage Upgrade to 1.5.4+ Turn off auto index generation ‣ Python: dev_appserver.py --require_indexes ‣ Java: <datastore-indexes autoGenerate="false"> Remove unnecessary custom index definitions ‣ Python: - index.yaml ‣ Java: - WEB-INF/datastore-indexes.xml - WEB-INF/appengine-generated/datastore-indexes-auto.xml Test your app Deploy to production ‣ Judiciously run: appcfg vacuum_indexes Friday, March 23, 2012
  • 32. XG Transactions New! Storage In a single transaction… ‣ Access 1..5 entity groups - read and/or write ‣ Does not provide transactional ancestor-less query ‣ Does allow 1..5 separate ancestor queries within transaction Concurrency exceptions possible ‣ 1st access of each entity group ‣ For reads as well as writes Availability ‣ Only in HRD apps ‣ App Engine 1.5.5 release Non-ancestor (transaction-less) queries may see… ‣ Partially committed non-XG transaction (same as before) ‣ Partially committed XG transactions (more likely) Friday, March 23, 2012
  • 33. XG Transactions - Java Storage import com.google.appengine.api.datastore.*; void transferFunds(long amt, String fromAccount, String toAccount) { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); TransactionOptions options = TransactionOptions.Builder.withXG(true); Transaction txn = datastore.beginTransaction(options); Entity a = datastore.get(KeyFactory.createKey("Account", fromAccount)); Entity b = datastore.get(KeyFactory.createKey("Account", toAccount)); a.setProperty("balance", (Long) a.getProperty("balance") - amt); b.setProperty("balance", (Long) b.getProperty("balance") + amt); datastore.put(txn, a); datastore.put(txn, b); txn.commit(); } Friday, March 23, 2012
  • 34. Cloud SQL (labs) Storage New! Cloud SQL support in Google Plugin for Eclipse 2.5 Client Client Client Client 34 Friday, March 23, 2012
  • 35. Cloud SQL (labs) Storage Developer console ‣ Easy to use Fully managed ‣ Site Reliability Engineers (SREs) High availability ‣ Synchronous replication to multiple data centers Integrated with Google App Engine ‣ Java: JDBC, Python: DB-API ‣ Use with High Replication Datastore Migration ‣ MySQL Import / export Friday, March 23, 2012
  • 36. Google Cloud Storage / Files API Storage Google Cloud Storage ‣ Buckets in the cloud ‣ REST API ‣ Command line ‣ Web UI tool ‣ Enable in APIs console Use from App Engine ‣ Files API (new) ‣ No more OAuth hassle ‣ http://code.google.com/appengine/docs/java/googlestorage/ overview.html Friday, March 23, 2012
  • 37. Minimize response time 37 Friday, March 23, 2012
  • 38. Appstats “I used to be blind, but now I can see :-)” --An early Appstats user 38 Friday, March 23, 2012
  • 39. Load testing - Guidelines Test traffic must be representative of real user traffic Ramp over a period of several minutes his! o ts ! s t d hi e i etter on’ T ic D N uc h b m Friday, March 23, 2012
  • 40. Load testing - basic recipe Send steady 5 qps traffic to your site ‣ Uncover basic problems, e.g. entity contention on global data Monitor for 15-20 minutes and expect to see: ‣ Stable request latency <1000ms (no longer an issue) ‣ Zero quota denials ‣ Low error rate ‣ Tasks queues are keeping up ‣ No elevated datastore contention Slowly ramp up; increase traffic by 2x ‣ Uncover next application bottleneck, if any Repeat until serving desired qps ‣ Plan your next feature Friday, March 23, 2012
  • 41. Memcache 2 ms App App Client Engine App Client Engine App Frontend Engine Frontend Engine Backend Backend 20m s 41 Friday, March 23, 2012
  • 42. Enable content caching Free lunch possibility ‣ And your users will be happier too Use memcache ‣ Only if you care about your users Static resource files ‣ Do not consume instance hours HTTP/1.1 caching Cache-Control: public, s-maxage=... ‣ Respected by browsers, ISPs and App Engine ‣ Saves bandwidth Replace dynamic content with ‣ Static content ‣ Blobstore (custom HTTP headers) Friday, March 23, 2012
  • 43. Best practices in client-side code Clients all t his! Av oid checking in at a specific time of day Spread out load: - Randomize client checkin times Clients retr y failures after a t his! And fixe d interval Avoi d a Denials-of-Ser vice (DoS) on yo ur app after a failure: - Use exponential back-off: 1s, 2s, 4s, 8s, 16s, … - Use a fuzz factor: randomize retr y times 43 Friday, March 23, 2012
  • 44. Best practices in server-side code Reduce instance hours ‣ Reduce request latency ‣ Use Memcache ‣ Datastore/Memcache batch get/put ‣ Async URL Fetch, Datastore, Memcache - Parallelize RPCs ‣ Enable HTTP session async writes Spin up fewer instances ‣ Task queue rate and max_concurrent_requests ‣ X-AppEngine-FailFast code.google.com/appengine/articles/managing-resources.html Friday, March 23, 2012
  • 45. Best practices in server-side code Enable concurrent requests ‣ Java appengine-web.xml ‣ Python 2.7 Discounted reserved instance hours ‣ $0.08/hr → $0.05/hr Scheduler knobs ‣ Max Idle Instances ‣ Min Pending Latency Friday, March 23, 2012
  • 46. Manage storage costs Discard stuff you no longer need ‣ Entities ‣ Indexes ‣ Blobs ‣ Tasks Drop unwanted indexes ‣ Vacuum custom indexes ‣ New query planner Explicitly mark properties as unindexed ‣ To migrate existing entities, put() again with: Python: foo = db.StringProperty(indexed=False) Java: entity.setUnindexedProperty(“foo”, “bar”) Friday, March 23, 2012
  • 47. Manage 'datastore ops' costs Number of write ops in SDK Fewer indexes & indexed properties → fewer write ops Take advantage of query planner improvements Replace queries with ‣ keys-only queries (cheaper) ‣ fetch-by-key (optimal) ‣ datastore cursors (for pagination) Friday, March 23, 2012
  • 48. Enable warming requests Request logs /_ah/warmup Default behavior ‣ Enabled for Java apps / Disabled for Python apps ‣ All jar files are indexed in memory ‣ Initializes your application and filters - Servlets marked in <load-on-startup> - ServletContextListener filters Custom warmup servlet ‣ Override built-in _ah_warmup servlet <servlet>  <servlet-name>_ah_warmup</servlet-name>  <servlet-class>foo.MyWarmupServlet</servlet-class> </servlet> Friday, March 23, 2012
  • 49. Only upload what you need Python static_files, static_dir skip_files Java <static-files> <resource-files> Diagnostics appcfg.sh --retain_upload_dir update … Friday, March 23, 2012
  • 50. Custom error pages Avoid Java <static-error-handlers> <handler file="default_error.html"/> <handler file="over_quota.html" error- code="over_quota"/> </static-error-handlers> Python error_handlers:   - file: default_error.html   - error_code: over_quota     file: over_quota.html Friday, March 23, 2012