Google App Engine
a JVM cloud computing workshop




                                 by Matthew McCullough, Ambient Ideas, LLC
Matthew McCullough
 ★ Open Source Architect
   Ambient Ideas, LLC
 ★ Twitter
   @matthewmccull
 ★ Email
   matthewm@ambientideas.com
 ★ Web
   ambientideas.com/blog
90 min   90 min
on ?
               Le ss
      sto ry
H i
v elo pe rs!
We ’re De
Let’s build an app!
Google App Engine SDK
Google Web Toolkit SDK
Google Eclipse Plugin
Let’s code!
deploy to

local   development server
debugging defaults
Success!
Why the cloud?
I have an idea for an app!
scrounge up money
LD
SO
going great, then...
Spiked Traffic
D LD
   LO
S OS
Whew! We survived!
Not again!
D LD LD
   LO O
S OS S
can’t afford to keep doing this!
success = crowds
crowds can be good
crowds can be bad
crowds are sudden
crowds are transient
fu nds!
No   Re
pay-per-use!
brilliant!
GAE Account
before a real deployment
sign up for GAE
http://appengine.google.com
Google account
SMS-delivered code
demo of signup
Production Deployment
reserve App ID
http://appengine.google.com

Control Panel
demo reserving App ID
set App ID & Version
demo setting App ID
deploy...
demo deploying to
production GAE from
     eclipse
<appid>.appspot.com
Pay-as-you-go?
who thought of this?
Joh
      nM
           cCa
               r   thy
1960
1960
1960
“com putation may  someday
            d as a publ ic utility”
 be organize
                       -John McCarthy
with the premise that the data services and
“It starts
                       be on servers. We c all it cloud computing
  architecture should
                       be in a cloud      somewhere.”
 – they should
                                           -Eric Schmidt, 8/9/2006
what does this solve?
New Signups         Active Users
Users




    Jan   Feb   Mar   Apr   May       Jun       Jul      Aug         Sep
minimal cost for
short-lived peaks
Command Line (SDK)
appcfg.sh
 appcfg.cmd
production maintenance
> appcfg.sh help

Action must be one of:
  help: Print help for a specific action.
  request_logs: Write request logs in Apache common log format.
  rollback: Rollback an in-progress update.
  update: Create or update an app version.
  update_indexes: Update application indexes.
  update_cron: Update application cron jobs.
  update_queues: Update application task queue definitions.
  update_dos: Update application DoS protection configuration.
  version: Prints version information.
  cron_info: Displays times for the next several runs of each
cron job.
Use 'help <action>' for a detailed description.
demo appcfg help
push to production
appcfg.sh update war
fetch logs
appcfg.sh request_logs war mylogs.log
demo appcfg fetch logs
dev_appserver.sh
dev_appserver.cmd
Jetty Servlet Container
demo dev_appserver
The WAR
WAR folder format
no actual WAR
optimized to upload delta
Logging
log4j
java.util.logging
System.out == info
System.err == warning
The Datastore
A place to store data
Filesystem
Relational database
column-oriented
List ( Maps ( Maps ) )
schema-less
Persisting Easily


★ Low Level Datastore API
★ com.google.appengine.api.datastore
low level API
full control

      but...

       vendor lock in
DataNucleus
Who?
DataNucleus
JDO
JPA
demo JDO persistence
demo two rows with
 columns differing
Why Google’s cloud?
free to start
generous free quotas
no hardware to own
no OS to patch
no network to secure
SaaS
PaaS
IaaS
Python
      +
JVM languages
Java Runtime 1.6
Jetty servlet container
Google uptime
Google scaling brilliance
freedom through constraints
freedom through constra
                       ints
The Whitelist
the allowed classes
Banned




         ⅘
         Java
The JRE Class White List
A Java App Engine application's access to the classes in the Java standard library (the Java Runtime Environment, or JRE)
is limited to the following classes:
     java.awt.datatransfer.DataFlavor
     java.awt.datatransfer.MimeType
     java.awt.datatransfer.Transferable
     java.beans.AppletInitializer
     java.beans.BeanDescriptor
     java.beans.BeanInfo
     java.beans.Beans
     java.beans.ConstructorProperties
     java.beans.Customizer
     java.beans.DefaultPersistenceDelegate
     java.beans.DesignMode
     java.beans.Encoder
     java.beans.EnumPersistenceDelegate
     java.beans.EventHandler
     java.beans.EventSetDescriptor
     java.beans.ExceptionListener
     java.beans.FeatureDescriptor
     java.beans.IndexedPropertyChangeEvent
     java.beans.IndexedPropertyDescriptor
     java.beans.IntrospectionException
     java.beans.Introspector
     java.beans.MethodDescriptor
     java.beans.ParameterDescriptor
     java.beans.PersistenceDelegate
     java.beans.PropertyChangeEvent
     java.beans.PropertyChangeListener
org.xml.sax.DocumentHandler
org.xml.sax.EntityResolver
org.xml.sax.ErrorHandler
org.xml.sax.HandlerBase
org.xml.sax.InputSource
org.xml.sax.Locator
org.xml.sax.Parser
org.xml.sax.SAXException
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
org.xml.sax.SAXParseException
org.xml.sax.XMLFilter
org.xml.sax.XMLReader
org.xml.sax.ext.Attributes2
org.xml.sax.ext.Attributes2Impl
org.xml.sax.ext.DeclHandler
org.xml.sax.ext.DefaultHandler2
org.xml.sax.ext.EntityResolver2
org.xml.sax.ext.LexicalHandler
org.xml.sax.ext.Locator2
org.xml.sax.ext.Locator2Impl
org.xml.sax.helpers.AttributeListImpl
org.xml.sax.helpers.AttributesImpl
org.xml.sax.helpers.DefaultHandler
org.xml.sax.helpers.LocatorImpl
org.xml.sax.helpers.NamespaceSupport
org.xml.sax.helpers.ParserAdapter
org.xml.sax.helpers.ParserFactory
org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.helpers.XMLReaderAdapter
org.xml.sax.helpers.XMLReaderFactory
controversial
you agree with Sun     policing it or not,
 “Whether                         all very well for
Java compatib ility has served us
over a decade.

            es being sure as a d eveloper that all
That includ                           ll platforms.
core classes a     re present on a
                -sets of the cor   e classes in the
Creating sub
           tform was forb      idden for a really
Java pla                         nd irresponsible to
good reaso   n, and it's wanton a
 casually flaunt the rules.”
                                                         s
              -Simon Phipps, OSS Manager, Sun Microsystem
what about

J2ME?
No threads
No File I/O
No Sockets
No JNI
demo violating the
 whitelist locally
demo violating the
whitelist remotely
Why another vendor’s cloud?
better response times
3000




           ‘hello world’
2250   GAE response times
             in milliseconds



1500




 750
OS neutrality
choice of programming language
avoiding G
             AE
platform l
          ock-in
EC2
SimpleDB
S3 Storage
CloudServers
Windows OS
Linux OS
CDN
open networking
root access
1.5 cents/hour
0.66 rupees/hour
Dashboard
web console
logging
datastore inspector
usage graphs
Memcache
retrieve,
 but don’t calculate
why the 2nd data source?
tested, measured, proven
JSR-107 / JCache
demo memcache
Mail
email services
common for web apps
realiable delivery
URL Fetch
only means of port
   connectivity
10 second limit
10 MB request limit
demo URLFetch
demo fail on 10MB get
Task Queue
webhook pattern
outbound = API
inbound = HTTP POST
scheduled
queues
worker, processing
but still limited to

30 seconds
Quotas
why?
multi-tenancy
cumulative
per day
per minute
30 seconds max
    per request
demo quota limit grid
profiling usage
demo quota code
demo app stats
Costs
very affordable
great for startups
great for
weekend experiments
demo cost grid
Security
helped by constraints
built-in authentication
developer roles
web.xml
demo security config
spring security
   (formerly acegi)
Co-Developers
dev invite process
https://
only for appspot domains
Domain Names
CNAME entries
Real World
Comparisons
Limits too tight?
Blobs > 50MB?
Throughput > 72GB / day?
Throughput > 1TB / day?
Transactions > 43,000,000 / day?
Blob Store
images, zips, audio
Datastore, 1 MB limit
50MB max
XMPP
Jabber, Google Talk, Google Wave
instant message service
why in a GAE app?
webhook pattern
demo XMPP console,
       API
Image Manipulation
convenience functions
AWT on blacklist
Secure Data Connector
Enterprise
Concerns
p s
  ck u
ba
no binary solution
csv export
Resources
Official Blog
App Gallery
http://vancouver2010.crosspollinate.org/search
Issue Tracker
Datastore Archive Feature Request
Maven Support Feature Request
The takeaways
What is the single
biggest benefit of GAE?


Scalability
What type of business
best fits GAE?


Startups
What types of apps
best fit GAE?


Web Mashups
What is the hardest
limit of GAE to work
around?

30 sec. processing
Google App Engine
a JVM cloud computing workshop




                                 att end ing!
       you for
Th ank


                                     by Matthew McCullough, Ambient Ideas, LLC
Resources

SDK Downloads: http://code.google.com/appengine/downloads.html

App Gallery: http://appgallery.appspot.com/

Issue Tracker: http://code.google.com/p/googleappengine/issues/list

Secure Data Connector Install: http://code.google.com/securedataconnector/docs/1.0/installing.html
Photo Credits
Various Clouds: http://www.ambientideasphotography.com

Newspaper: http://www.flickr.com/photos/12836528@N00/1202823367

Flickr Chart: http://www.flickr.com/photos/85494010@N00/84912961

No Refunds: http://www.flickr.com/photos/8804814@N08/2591957763

Cell Phone Number Pad: http://www.flickr.com/photos/88543347@N00/2243527026

Men Conversation: http://www.flickr.com/photos/99037763@N00/2314463032

Backup Tape: http://www.flickr.com/photos/48615294@N00/75622824
Photo Credits
Clouds: http://www.flickr.com/photos/cindy47452/1624383308/

Big Chair: http://www.flickr.com/photos/annapickard/20988642/sizes/o/

Yellow Crowd: http://www.flickr.com/photos/twose/887903401/sizes/l/

Multicolor Crowd: http://www.flickr.com/photos/akc77/3370167184/sizes/l/

Jet Truck: http://www.flickr.com/photos/85819182@N00/301495633

Puzzled Power Plug: http://www.flickr.com/photos/95492938@N00/3203311346

Power Towers: http://www.flickr.com/photos/97544179@N00/3317530283

Reporter: http://www.flickr.com/photos/19953384@N00/4101633839

Idea Lightbulb Head: http://www.flickr.com/photos/17731548@N00/981372736

Google App Engine for Java v0.0.2