SlideShare a Scribd company logo
Google App Engine
                                Day of Cloud
                               October 16, 2009




Monday, October 19, 2009                          1
About Me


                               Don Schwarz
                           schwardo@google.com


                             Software Engineer
                                  Google



                                                 2

Monday, October 19, 2009                             2
Overview
               • Problems with scalable web applications
               • What is Google App Engine?
               • Let’s Play a Game
               • How much does it cost?
               • Q/A


                                                           3

Monday, October 19, 2009                                       3
Challenges of Building Web Apps




                                              4

Monday, October 19, 2009                          4
Easy to start. Easy to scale.




                                            5

Monday, October 19, 2009                        5
It’s all included!
                                Hardware
                              Connectivity
                            Operating System
                               Web Server
                           Language Runtimes
                            Software Services
                              Fault-tolerance
                                Load balancing
                                  SSL Support




                                                 6

Monday, October 19, 2009                             6
Key Features
            • No need to install or maintain your own stack
            • We do the scaling for you
            • Use Google’s scalable services
            • We charge only for actual usage
              – Always free to get started
            • Built-in application management console
            • Tool integration (IDE plugins, etc.)



                                                              7

Monday, October 19, 2009                                          7
Architecture
                                             Incoming Requests



                               App Engine       App Engine           App Engine
  Load Balancer                Front End        Front End            Front End




                               AppServer         AppServer           AppServer



                                                                Other Google
                           AppServer                            Infrastructure

                           API Layer                              - Bigtable

                                                              - Google Accounts

                                                                 - Memcache
                   App        App      App
                                                             - Image manipulation
                                                                                    8

Monday, October 19, 2009                                                                8
Software Services
                           Service         Google Infrastructure
                  Authentication             Google Accounts
                      Datastore                   Bigtable
                           Caching   Custom memcache implementation

                           E-mail             Gmail gateway

                      URLFetch             Caching HTTP proxy

                           XMPP          Google Talk infrastructure

                           Images     Picasa Web Photo Infrastructure


                                                                        9

Monday, October 19, 2009                                                    9
Web Hooks
               • Receiving XMPP
               • Receiving Email
               • Scheduled Tasks (cron)
               • Task Queue (offline processing)
               • Google Wave Robots


                                                  10

Monday, October 19, 2009                               10
Restrictions
               • No threads
               • No direct network connections
                 • ... but URLFetch & SDC
               • No direct file system writes
                 • ... but Datastore and Memcache
               • No subprocesses or native code
               • “Safe” subset of runtime environment
               • 30 seconds per request, 10MB limit
                                                        11

Monday, October 19, 2009                                     11
Java
               •    Java 6 VM (with Hotspot)

               •    Full Servlet 2.5 Container

                    •      HTTP Session support

                    •      JSP support

               •    Services integrate with common Java Standards

                    •      JDO/JPA for Datastore API

                    •      JSR 107 for Memcache API

                    •      javax.mail for Mail API

                    •      java.net.URLConnection for URLFetch API

               •    IDE integration: Eclipse, IntelliJ, NetBeans

                                                                     12

Monday, October 19, 2009                                                  12
Python
               •    Python 2.5.2

               •    CGI environment, provided by WSGI module

               •    Web frameworks

                    •      webapp - Minimal built-in framework, based on WebOb

                    •      Django 0.96 is built-in, can deploy 1.0 or 1.1

               •    App Engine Launcher (Mac & Windows)

                    •      Easy access to edit, test, and deploy applications



                                                                                 13

Monday, October 19, 2009                                                              13
Datastore
               •    Datastore is:

                    •      Transactional

                    •      Natively Partitioned

                    •      Hierarchical

                    •      Schema-less

                    •      Based on Bigtable

               •    Datastore is not:

                    •      A relational database

                    •      A SQL engine

                                                   14

Monday, October 19, 2009                                14
Interesting Datastore Modeling
               • Ancestor
               • Multi-value properties
               • Variable properties
               • Heterogenous property types
        Kind               Person            Kind           Person

        Entity Group       /Person:Ethel     Entity Group   /Person:Ethel

                           /Person:Ethel/    Key            /Person:Ethel
        Key
                           Person:Jane       Age            Int64: 30
        Age                Double: 3.5
                                             Hobbies        String: Tennis
                           Key:/Turtle:Sam
        Pets
                           Key:/Dog:Ernie                                    15

Monday, October 19, 2009                                                          15
Datastore Transactions
               • Transactions apply to a single Entity Group
                • Global transactions are feasible
               • get(), put(), delete() are transactional
               • Ancestor queries are transactional
                                         /Person:Ethel


                Transaction        /Person:Ethel/Person:Jane


                                         /Person:Max




                                                               16

Monday, October 19, 2009                                            16
Testing Locally
               •    “Development AppServer”

                    •      Emulates production environment

                    •      Enforces many of the same restrictions

                    •      Local implementation of software services

                           •   Disk-based datastore

                           •   In-memory LRU memcache implementation

                           •   Simple URLFetch implementation


                                                                       17

Monday, October 19, 2009                                                    17
Deploying to the Cloud
               •    Application is available at:

                    •      yourapp.appspot.com, or

                    •      a custom domain

               •    Command-line and IDE-based tools

               •    Admin Console

                    •      Dashboards, Data Viewer

                    •      Request and diagnostic logs

                    •      Billing

                                                         18

Monday, October 19, 2009                                      18
Code Walkthrough



Monday, October 19, 2009                      19
http://java-demo.appspot.com




Monday, October 19, 2009         20
Quotas and Billing
                 Resource        Provided Free      Additional Cost

                     CPU         6.5 hours/day        $0.10/hour


              Bandwidth In        1GByte/day         $0.10/GByte

             Bandwidth Out        1GByte/day         $0.12/GByte

               Stored Data           1 GB           $0.005/GB-day

                               2000/day to users    $0.0001/email
                Emails sent
                              50000/day to admins

                                                                      21

Monday, October 19, 2009                                                   21
Quotas and Billing: Estimates
               • Will always be free to get started
                 • ~5 million pageviews/month free
               • Pay only for what you use
                 • 10-20 million pageviews/month for
                           $20-30/month

               • Payment via Google Checkout
               • X-AppEngine-Estimated-CPM-US-Dollars
                                                        22

Monday, October 19, 2009                                     22
Questions?



Monday, October 19, 2009                23
Resources
               •    Speaker

                    •      Don Schwarz (schwardo@google.com)

               •    Google App Engine

                    •      http://code.google.com/appengine

               •    Google Group

                    •      http://groups.google.com/group/google-appengine




                                                                             24

Monday, October 19, 2009                                                          24
Backup Slides



Monday, October 19, 2009                   25
Does it scale?




            http://whitehouse.gov/openforquestions   26

Monday, October 19, 2009                                  26
Secure Data Connector




                                    27

Monday, October 19, 2009                 27
Demo - Login




                           28

Monday, October 19, 2009        28
Demo - Question




                              29

Monday, October 19, 2009           29
Demo - Question Result




                                     30

Monday, October 19, 2009                  30
Demo - Scoreboard




                                31

Monday, October 19, 2009             31

More Related Content

Don Schwarz App Engine Talk

  • 1. Google App Engine Day of Cloud October 16, 2009 Monday, October 19, 2009 1
  • 2. About Me Don Schwarz [email protected] Software Engineer Google 2 Monday, October 19, 2009 2
  • 3. Overview • Problems with scalable web applications • What is Google App Engine? • Let’s Play a Game • How much does it cost? • Q/A 3 Monday, October 19, 2009 3
  • 4. Challenges of Building Web Apps 4 Monday, October 19, 2009 4
  • 5. Easy to start. Easy to scale. 5 Monday, October 19, 2009 5
  • 6. It’s all included! Hardware Connectivity Operating System Web Server Language Runtimes Software Services Fault-tolerance Load balancing SSL Support 6 Monday, October 19, 2009 6
  • 7. Key Features • No need to install or maintain your own stack • We do the scaling for you • Use Google’s scalable services • We charge only for actual usage – Always free to get started • Built-in application management console • Tool integration (IDE plugins, etc.) 7 Monday, October 19, 2009 7
  • 8. Architecture Incoming Requests App Engine App Engine App Engine Load Balancer Front End Front End Front End AppServer AppServer AppServer Other Google AppServer Infrastructure API Layer - Bigtable - Google Accounts - Memcache App App App - Image manipulation 8 Monday, October 19, 2009 8
  • 9. Software Services Service Google Infrastructure Authentication Google Accounts Datastore Bigtable Caching Custom memcache implementation E-mail Gmail gateway URLFetch Caching HTTP proxy XMPP Google Talk infrastructure Images Picasa Web Photo Infrastructure 9 Monday, October 19, 2009 9
  • 10. Web Hooks • Receiving XMPP • Receiving Email • Scheduled Tasks (cron) • Task Queue (offline processing) • Google Wave Robots 10 Monday, October 19, 2009 10
  • 11. Restrictions • No threads • No direct network connections • ... but URLFetch & SDC • No direct file system writes • ... but Datastore and Memcache • No subprocesses or native code • “Safe” subset of runtime environment • 30 seconds per request, 10MB limit 11 Monday, October 19, 2009 11
  • 12. Java • Java 6 VM (with Hotspot) • Full Servlet 2.5 Container • HTTP Session support • JSP support • Services integrate with common Java Standards • JDO/JPA for Datastore API • JSR 107 for Memcache API • javax.mail for Mail API • java.net.URLConnection for URLFetch API • IDE integration: Eclipse, IntelliJ, NetBeans 12 Monday, October 19, 2009 12
  • 13. Python • Python 2.5.2 • CGI environment, provided by WSGI module • Web frameworks • webapp - Minimal built-in framework, based on WebOb • Django 0.96 is built-in, can deploy 1.0 or 1.1 • App Engine Launcher (Mac & Windows) • Easy access to edit, test, and deploy applications 13 Monday, October 19, 2009 13
  • 14. Datastore • Datastore is: • Transactional • Natively Partitioned • Hierarchical • Schema-less • Based on Bigtable • Datastore is not: • A relational database • A SQL engine 14 Monday, October 19, 2009 14
  • 15. Interesting Datastore Modeling • Ancestor • Multi-value properties • Variable properties • Heterogenous property types Kind Person Kind Person Entity Group /Person:Ethel Entity Group /Person:Ethel /Person:Ethel/ Key /Person:Ethel Key Person:Jane Age Int64: 30 Age Double: 3.5 Hobbies String: Tennis Key:/Turtle:Sam Pets Key:/Dog:Ernie 15 Monday, October 19, 2009 15
  • 16. Datastore Transactions • Transactions apply to a single Entity Group • Global transactions are feasible • get(), put(), delete() are transactional • Ancestor queries are transactional /Person:Ethel Transaction /Person:Ethel/Person:Jane /Person:Max 16 Monday, October 19, 2009 16
  • 17. Testing Locally • “Development AppServer” • Emulates production environment • Enforces many of the same restrictions • Local implementation of software services • Disk-based datastore • In-memory LRU memcache implementation • Simple URLFetch implementation 17 Monday, October 19, 2009 17
  • 18. Deploying to the Cloud • Application is available at: • yourapp.appspot.com, or • a custom domain • Command-line and IDE-based tools • Admin Console • Dashboards, Data Viewer • Request and diagnostic logs • Billing 18 Monday, October 19, 2009 18
  • 21. Quotas and Billing Resource Provided Free Additional Cost CPU 6.5 hours/day $0.10/hour Bandwidth In 1GByte/day $0.10/GByte Bandwidth Out 1GByte/day $0.12/GByte Stored Data 1 GB $0.005/GB-day 2000/day to users $0.0001/email Emails sent 50000/day to admins 21 Monday, October 19, 2009 21
  • 22. Quotas and Billing: Estimates • Will always be free to get started • ~5 million pageviews/month free • Pay only for what you use • 10-20 million pageviews/month for $20-30/month • Payment via Google Checkout • X-AppEngine-Estimated-CPM-US-Dollars 22 Monday, October 19, 2009 22
  • 24. Resources • Speaker • Don Schwarz ([email protected]) • Google App Engine • http://code.google.com/appengine • Google Group • http://groups.google.com/group/google-appengine 24 Monday, October 19, 2009 24
  • 26. Does it scale? http://whitehouse.gov/openforquestions 26 Monday, October 19, 2009 26
  • 27. Secure Data Connector 27 Monday, October 19, 2009 27
  • 28. Demo - Login 28 Monday, October 19, 2009 28
  • 29. Demo - Question 29 Monday, October 19, 2009 29
  • 30. Demo - Question Result 30 Monday, October 19, 2009 30
  • 31. Demo - Scoreboard 31 Monday, October 19, 2009 31