SlideShare a Scribd company logo
1 of 35
Download to read offline
Google App Engine
                                        Ikai Lan
                            Kuala Lumpur, GTUG Hackathon
                                    Twitter: @ikai
                                     June 18, 2011




Saturday, June 18, 2011
About the speaker
                     • Developer Relations at Google based out
                          of San Francisco, CA
                     • Primarily work in Java and Python
                          nowadays; lots of experience with Ruby,
                          JavaScript, PHP <5.3
                     • Focus: Cloud products
                     • Twitter: @ikai
Saturday, June 18, 2011
Agenda

                     • What is Google App Engine?
                     • Various features of GAE
                     • How to get started
                     • Introduction to Go
                     • Important tools + some tips

Saturday, June 18, 2011
Software

                            Platform


                          Infrastructure

                                           Source: Gartner AADI Summit Dec 2009


Saturday, June 18, 2011
Software

                            Platform


                          Infrastructure

                                           Source: Gartner AADI Summit Dec 2009


Saturday, June 18, 2011
Software

                            Platform


                          Infrastructure

                                           Source: Gartner AADI Summit Dec 2009


Saturday, June 18, 2011
Software

                            Platform


                          Infrastructure

                                           Source: Gartner AADI Summit Dec 2009


Saturday, June 18, 2011
• Easy to build
                     • Easy to manage
                     • Easy to scale

Saturday, June 18, 2011
“We wear pagers so
                           you don’t have to”




Saturday, June 18, 2011
Saturday, June 18, 2011
>90K Developers

                              >130K Apps

                          >700M daily pageviews


Saturday, June 18, 2011
SDK & “The Cloud”

                 Hardware

                 Networking

                 Operating system

                 Application runtime

                          Java, Python, Go

                 Static file serving

                                             20

Saturday, June 18, 2011
Development Cycle

                     • Write code locally
                     • Test, push to Google Servers
                     • Administer via a web interface - http://
                          appengine.google.com




Saturday, June 18, 2011
Admin Console




Saturday, June 18, 2011
Duke, the Java mascot
                          Go Gopher    Copyright © Sun Microsystems Inc., all rights reserved.




Saturday, June 18, 2011
Extended Language support
                                 through JVM
                   • Java
                   • Scala
                   • JRuby (Ruby)
                   • Groovy                    Duke, the Java mascot
                                            Copyright © Sun Microsystems Inc., all rights reserved.



                   • Quercus (PHP)
                   • Rhino (JavaScript)
                   • Jython (Python)
                   • Clojure

Saturday, June 18, 2011
Core APIs
                          Memcache      Datastore   URL Fetch




                            Mail         XMPP       Task Queue




                           Images       Blobstore   User Service


Saturday, June 18, 2011
High Replication

                     • Strongly consistent, multi-datastore, multi-
                          data center serving solution
                     • Write once, have your data be available in a
                          highly consistent manner
                     • No data loss, no datastore outages

Saturday, June 18, 2011
Other APIs

                     • High performance image serving
                     • App Engine Map Reduce
                     • Prospective Search API
                     • Pipeline API
                     • OAuth provider

Saturday, June 18, 2011
Prospective Search
                     • Matches a high rate of incoming documents
                     • 100,000 matches a second
                     • Think: How might we build something like
                          Google Alerts?
                     • http://code.google.com/appengine/docs/
                          python/prospectivesearch/


Saturday, June 18, 2011
A basic Python app

                     • 2 files: app.yaml and main.py
                     • Easier to use when Python SDK is in your
                          system path
                     • Start server with dev_appserver.py
                     • Deploy via appcfg.py

Saturday, June 18, 2011
app.yaml




Saturday, June 18, 2011
main.py




Saturday, June 18, 2011
Getting started with
                                  Java

                     • Servlets API
                     • Google Plugin for Eclipse will generate a
                          skeleton project: http://code.google.com/
                          eclipse/beta/docs/download.html




Saturday, June 18, 2011
Go: why I like it
                     • “The next version of C, brought to you by
                          the guys who didn’t bring you C++”
                     • Modern, type safe compiled language (stdlib
                          includes: json parsing, web server)
                     • Functions as first class objects
                     • Concurrency baked in via goroutines and
                          channels
                     • Very fast compilation times
Saturday, June 18, 2011
Flexible interfaces
                      // This is an interface declaration
                      type myInterface interface {
                      	   set(i int)
                      }

                      // This is a Type declaration. Note that it is a type, not a class
                      type myType struct {
                          i int
                      }

                      // This is how we define a function where myType is a receiver
                      // With an instance of myType we can call myType.set(123)
                      func (p *myType) set(i int) {
                         p.i = i
                      }

                      // Because myType defines a function with the signature set(int i) method,
                      // we can use it anywhere myInterface is accepted!
                      func setToThousand(x myInterface) {
                         myInterface.set(1000)
                      }




Saturday, June 18, 2011
First class functions
                package main
                import "fmt"

                // Make a function that returns a new function
                func makeAdd(increment int) (counter func(int) int) {
                        return func(v int) int {
                                return v + increment;
                        }
                }

                func main() {
                        fmt.Printf("value of makeAdd(100)(1) is %vn", makeAdd(100)(1));
                        fmt.Printf("value of makeAdd(200)(2) is %vn", makeAdd(200)(2));
                }

                // Outputs:
                // value of makeAdd(100)(1) is 101
                // value of makeAdd(200)(2) is 202




Saturday, June 18, 2011
Goroutines and
                          package main
                                      Channels
                          import (
                              "fmt"
                              "time"
                          )

                          func doLotsOfWork(until int, ch chan int) {
                              c := 0
                              for i := 0; i < until; i++ {
                                  c += i
                                  time.Sleep(1000)
                              }
                              ch <- c
                          }

                          func main() {
                              ch := make(chan int)

                              // First the work off into the background
                              go doLotsOfWork(5, ch)

                              // Do more work here while we wait for this process to complete

                              // Block until doLotsOfWork sends data back on this channel
                              i := <- ch
                              fmt.Printf("Final value: %vn", i)
                          }


Saturday, June 18, 2011
It runs on App Engine!
                     • Currently requires whitelisting
                     • Experimental status
                     • Goroutines allow for concurrency within
                          request; concurrent requests coming
                     • Demo app: http://moustach-io.appspot.com/
                     • Source: https://code.google.com/p/
                          appengine-go/source/browse/example/


Saturday, June 18, 2011
Mustachio




Saturday, June 18, 2011
General tips
                     • The datastore is built on top of BigTable. It
                          is non-relational!

                     • Be aware of limits: 30 second requests, 10
                          minute tasks queues/cron jobs, whitelisted
                          classes
                     • Python 2.5 compatible (but can use 2.6 or
                          2.7 locally)


Saturday, June 18, 2011
Useful Python tools
                     • Tipfy: http://www.tipfy.org/
                     • Django non-rel: http://
                          www.allbuttonspressed.com/projects/
                          django-nonrel
                     • Testbed API: http://code.google.com/
                          appengine/docs/python/tools/
                          localunittesting.html


Saturday, June 18, 2011
Java tips
                     • Use low-level datastore API or third party
                          API: http://code.google.com/p/objectify-
                          appengine/
                     • Start with servlets API - will have to do
                          some work to make your favorite
                          framework work. Slim3 is a good GAE
                          specific framework


Saturday, June 18, 2011
Summary

                     • Hopefully people here are interested in
                          hacking on App Engine
                     • Java, Python and Go
                     • Ask me if you have general questions, I will
                          be around all weekend



Saturday, June 18, 2011
Questions?


                     • Twitter: @ikai
                     • App Engine: http://code.google.com/
                          appengine




Saturday, June 18, 2011

More Related Content

Similar to 2011 june-kuala-lumpur-gtug-hackathon

Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Guillaume Laforge
 
Create a Professional Blog with WordPress: Chapter 6 Customizing Your Sites w...
Create a Professional Blog with WordPress: Chapter 6 Customizing Your Sites w...Create a Professional Blog with WordPress: Chapter 6 Customizing Your Sites w...
Create a Professional Blog with WordPress: Chapter 6 Customizing Your Sites w...
Atit Patumvan
 
Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009
John Woodell
 
Javaedge 2010-cschalk
Javaedge 2010-cschalkJavaedge 2010-cschalk
Javaedge 2010-cschalk
Chris Schalk
 
Android presentation 2011
Android presentation 2011Android presentation 2011
Android presentation 2011
Bram Vandeputte
 

Similar to 2011 june-kuala-lumpur-gtug-hackathon (20)

2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
 
What is Google App Engine?
What is Google App Engine?What is Google App Engine?
What is Google App Engine?
 
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
 
App Engine Meetup
App Engine MeetupApp Engine Meetup
App Engine Meetup
 
Devfest09 App Engine Java
Devfest09  App Engine  JavaDevfest09  App Engine  Java
Devfest09 App Engine Java
 
FreshAir2008
FreshAir2008FreshAir2008
FreshAir2008
 
FreshAir2008
FreshAir2008FreshAir2008
FreshAir2008
 
Rubypalooza 2009
Rubypalooza 2009Rubypalooza 2009
Rubypalooza 2009
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
Introduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesIntroduction to Google's Cloud Technologies
Introduction to Google's Cloud Technologies
 
Introduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform TechnologiesIntroduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform Technologies
 
Create a Professional Blog with WordPress: Chapter 6 Customizing Your Sites w...
Create a Professional Blog with WordPress: Chapter 6 Customizing Your Sites w...Create a Professional Blog with WordPress: Chapter 6 Customizing Your Sites w...
Create a Professional Blog with WordPress: Chapter 6 Customizing Your Sites w...
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinating
 
Javascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSJavascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJS
 
AFNetworking
AFNetworking AFNetworking
AFNetworking
 
Javaedge 2010-cschalk
Javaedge 2010-cschalkJavaedge 2010-cschalk
Javaedge 2010-cschalk
 
Don Schwarz App Engine Talk
Don Schwarz App Engine TalkDon Schwarz App Engine Talk
Don Schwarz App Engine Talk
 
Android presentation 2011
Android presentation 2011Android presentation 2011
Android presentation 2011
 

More from ikailan

2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore
ikailan
 
What is App Engine? O
What is App Engine? OWhat is App Engine? O
What is App Engine? O
ikailan
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngine
ikailan
 

More from ikailan (13)

Your language doesn't scale
Your language doesn't scaleYour language doesn't scale
Your language doesn't scale
 
From 0-1 billion in 46 days
From 0-1 billion in 46 daysFrom 0-1 billion in 46 days
From 0-1 billion in 46 days
 
2011 august-gdd-mexico-city-rest-json-oauth
2011 august-gdd-mexico-city-rest-json-oauth2011 august-gdd-mexico-city-rest-json-oauth
2011 august-gdd-mexico-city-rest-json-oauth
 
2011 aug-gdd-mexico-city-high-replication-datastore
2011 aug-gdd-mexico-city-high-replication-datastore2011 aug-gdd-mexico-city-high-replication-datastore
2011 aug-gdd-mexico-city-high-replication-datastore
 
2011 july-nyc-gtug-go
2011 july-nyc-gtug-go2011 july-nyc-gtug-go
2011 july-nyc-gtug-go
 
2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore
 
Intro to App Engine - Agency Dev Day NYC 2011
Intro to App Engine - Agency Dev Day NYC 2011Intro to App Engine - Agency Dev Day NYC 2011
Intro to App Engine - Agency Dev Day NYC 2011
 
Rapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbRapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodb
 
Introducing the App Engine datastore
Introducing the App Engine datastoreIntroducing the App Engine datastore
Introducing the App Engine datastore
 
What is App Engine? O
What is App Engine? OWhat is App Engine? O
What is App Engine? O
 
OSCON Google App Engine Codelab - July 2010
OSCON Google App Engine Codelab - July 2010OSCON Google App Engine Codelab - July 2010
OSCON Google App Engine Codelab - July 2010
 
Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngine
 

2011 june-kuala-lumpur-gtug-hackathon

  • 1. Google App Engine Ikai Lan Kuala Lumpur, GTUG Hackathon Twitter: @ikai June 18, 2011 Saturday, June 18, 2011
  • 2. About the speaker • Developer Relations at Google based out of San Francisco, CA • Primarily work in Java and Python nowadays; lots of experience with Ruby, JavaScript, PHP <5.3 • Focus: Cloud products • Twitter: @ikai Saturday, June 18, 2011
  • 3. Agenda • What is Google App Engine? • Various features of GAE • How to get started • Introduction to Go • Important tools + some tips Saturday, June 18, 2011
  • 4. Software Platform Infrastructure Source: Gartner AADI Summit Dec 2009 Saturday, June 18, 2011
  • 5. Software Platform Infrastructure Source: Gartner AADI Summit Dec 2009 Saturday, June 18, 2011
  • 6. Software Platform Infrastructure Source: Gartner AADI Summit Dec 2009 Saturday, June 18, 2011
  • 7. Software Platform Infrastructure Source: Gartner AADI Summit Dec 2009 Saturday, June 18, 2011
  • 8. • Easy to build • Easy to manage • Easy to scale Saturday, June 18, 2011
  • 9. “We wear pagers so you don’t have to” Saturday, June 18, 2011
  • 11. >90K Developers >130K Apps >700M daily pageviews Saturday, June 18, 2011
  • 12. SDK & “The Cloud” Hardware Networking Operating system Application runtime Java, Python, Go Static file serving 20 Saturday, June 18, 2011
  • 13. Development Cycle • Write code locally • Test, push to Google Servers • Administer via a web interface - http:// appengine.google.com Saturday, June 18, 2011
  • 15. Duke, the Java mascot Go Gopher Copyright © Sun Microsystems Inc., all rights reserved. Saturday, June 18, 2011
  • 16. Extended Language support through JVM • Java • Scala • JRuby (Ruby) • Groovy Duke, the Java mascot Copyright © Sun Microsystems Inc., all rights reserved. • Quercus (PHP) • Rhino (JavaScript) • Jython (Python) • Clojure Saturday, June 18, 2011
  • 17. Core APIs Memcache Datastore URL Fetch Mail XMPP Task Queue Images Blobstore User Service Saturday, June 18, 2011
  • 18. High Replication • Strongly consistent, multi-datastore, multi- data center serving solution • Write once, have your data be available in a highly consistent manner • No data loss, no datastore outages Saturday, June 18, 2011
  • 19. Other APIs • High performance image serving • App Engine Map Reduce • Prospective Search API • Pipeline API • OAuth provider Saturday, June 18, 2011
  • 20. Prospective Search • Matches a high rate of incoming documents • 100,000 matches a second • Think: How might we build something like Google Alerts? • http://code.google.com/appengine/docs/ python/prospectivesearch/ Saturday, June 18, 2011
  • 21. A basic Python app • 2 files: app.yaml and main.py • Easier to use when Python SDK is in your system path • Start server with dev_appserver.py • Deploy via appcfg.py Saturday, June 18, 2011
  • 24. Getting started with Java • Servlets API • Google Plugin for Eclipse will generate a skeleton project: http://code.google.com/ eclipse/beta/docs/download.html Saturday, June 18, 2011
  • 25. Go: why I like it • “The next version of C, brought to you by the guys who didn’t bring you C++” • Modern, type safe compiled language (stdlib includes: json parsing, web server) • Functions as first class objects • Concurrency baked in via goroutines and channels • Very fast compilation times Saturday, June 18, 2011
  • 26. Flexible interfaces // This is an interface declaration type myInterface interface { set(i int) } // This is a Type declaration. Note that it is a type, not a class type myType struct { i int } // This is how we define a function where myType is a receiver // With an instance of myType we can call myType.set(123) func (p *myType) set(i int) { p.i = i } // Because myType defines a function with the signature set(int i) method, // we can use it anywhere myInterface is accepted! func setToThousand(x myInterface) { myInterface.set(1000) } Saturday, June 18, 2011
  • 27. First class functions package main import "fmt" // Make a function that returns a new function func makeAdd(increment int) (counter func(int) int) { return func(v int) int { return v + increment; } } func main() { fmt.Printf("value of makeAdd(100)(1) is %vn", makeAdd(100)(1)); fmt.Printf("value of makeAdd(200)(2) is %vn", makeAdd(200)(2)); } // Outputs: // value of makeAdd(100)(1) is 101 // value of makeAdd(200)(2) is 202 Saturday, June 18, 2011
  • 28. Goroutines and package main Channels import ( "fmt" "time" ) func doLotsOfWork(until int, ch chan int) { c := 0 for i := 0; i < until; i++ { c += i time.Sleep(1000) } ch <- c } func main() { ch := make(chan int) // First the work off into the background go doLotsOfWork(5, ch) // Do more work here while we wait for this process to complete // Block until doLotsOfWork sends data back on this channel i := <- ch fmt.Printf("Final value: %vn", i) } Saturday, June 18, 2011
  • 29. It runs on App Engine! • Currently requires whitelisting • Experimental status • Goroutines allow for concurrency within request; concurrent requests coming • Demo app: http://moustach-io.appspot.com/ • Source: https://code.google.com/p/ appengine-go/source/browse/example/ Saturday, June 18, 2011
  • 31. General tips • The datastore is built on top of BigTable. It is non-relational! • Be aware of limits: 30 second requests, 10 minute tasks queues/cron jobs, whitelisted classes • Python 2.5 compatible (but can use 2.6 or 2.7 locally) Saturday, June 18, 2011
  • 32. Useful Python tools • Tipfy: http://www.tipfy.org/ • Django non-rel: http:// www.allbuttonspressed.com/projects/ django-nonrel • Testbed API: http://code.google.com/ appengine/docs/python/tools/ localunittesting.html Saturday, June 18, 2011
  • 33. Java tips • Use low-level datastore API or third party API: http://code.google.com/p/objectify- appengine/ • Start with servlets API - will have to do some work to make your favorite framework work. Slim3 is a good GAE specific framework Saturday, June 18, 2011
  • 34. Summary • Hopefully people here are interested in hacking on App Engine • Java, Python and Go • Ask me if you have general questions, I will be around all weekend Saturday, June 18, 2011
  • 35. Questions? • Twitter: @ikai • App Engine: http://code.google.com/ appengine Saturday, June 18, 2011