google app engine at a glance
DESCRIPTION
Short intro to Google App Engine 4 JavaTRANSCRIPT
Google App Engine at a glanceStefan Christoph
Introduction
• PaaS
• Running own Apps in Google infrastructure
• Supports different runtime environments
– Java ( JRE 6 with limitations, standard APIs like
JDO, JPA, JavaMail)
– Python ( 2.5.2, standard library)
• App runs in sandbox
• Automatic scaling and load balancing
Architecture - Overview
InternetInternet
Loadbalancer
Frontend
Static File Server Static File Server…
Frontend
Application Server Application Server…
…
http://<version>.<appid>.appspot.com/some/path
static filesstatic files resource files
resource filesprogram files
program files
Google Infrastructure
Architecture - Application Server
Google App Engine
Application sandbox /Runtime Environment
Application
Internal Services
Lo
ggin
g
Da
tasto
re
Blo
bsto
re
Ima
ge
Ta
sks
Me
mca
che
Au
the
ntic
atio
n
External Services
URLFetcher
XMPP
Bigtable
Inte
rnet
Inte
rnet
memcache
Services / Capabilities
• Sandbox
• Runtime Environment / Servlet Container– Java Interpreter
– Read only filesystem
– Memory
• Data Store
• Services– User authentication
– URL Fetch
– XMPP
– Memcache
– Image Manipulation
– Scheduled tasks / Task Queues
– Blobstore
– Logging
Limitations
• Programming Model– Application runs in sandbox and can not
• Write to filesystem
• Make arbitary network connections
• Use multiple threads/processes
• Perform long-lasting processing
• Permissions
• Know about other instances/applications
– Sandbox restrictions are implemented as JVM
• Quotas (Requests, In/Out bandwidth, CPU time, API calls)– Billable Quotas
• Set by the application owner to keep in budget
– Fixed Quotas• Set by GAE to ensure integrity of the system
Development Environment
• Tools
– Development Server
– Application lifecycle management
– Eclipse plugins / Firefox plugin (GWT)
– Local unit testing / debugging
Deployment Environment
• Application is deployed as war which contains:
– Static files
– Resource Files
– Program Files
– Deployment Descriptor
• Rich Admin web console
• Deployment is integrated in IDE
• Deploy multiple version of the application at the same time
Framework
GWT-RPC
<<interface>>
ServiceDefTarget
<<interface>>
RemoteServiceRemoteServiceServlet
Our stuff
<<interface>>OurServiceAsync
<<interface>>OurService
OurServiceImpl
extends
implements
extends
related
GWT framework (autogenerated)
ProxyService
implements
implements
Client Server
App Engine Datastore
• Non-relational Data-store
• Stores data as entities
• APIs:– JDO / JPA
– Low Level API
Entity
key
Application ID
Kind
ID / Name
“data”
Property *
name Value *
• Distribution, replication, load balancing behind the scene
• Based on Bigtable / GFS
Using Email/XMPP
• Create Servlet for handling incoming messages
• Ensure proper url configuration ins deployment descriptor
• Configure as inbound service
• XMPP
– implementation supports no Group Chat
Logging
• Java.util.logging.Logger
• View in Administration Console
• Download logfiles
• Standard output / standard error are written
to the logs
Local Unit Testing
• LocalTestServiceHelper provides
– local test environment including GAE services
• Datastore
• XMPP/Mail
• User Management
– Capability to use JUnit framework
Memcache Service
• Distributed in memory cache
• Configurable expiration time but
• Unreliable might be vanished at any time
• Supported Interfaces :
– JACHE (JSR 107: JCACHE – Java Temporary
Caching API)
– The Low-Level Memcache API (documentation)
User Management – Google Accounts
• Optional feature
• Utilize Google Authentication system in your
own application -> focus on business logic
• Access to Google account data -> email, id
• Access constraints based on roles
– Declarative in deployment descriptor (URL
based)
– programmatically
Managing Applications
• Administration Console
@http://appengine.google.com/a/yourdomai
n.com
– Application Dashboard
– Multiple application versions
– Analyzing log files (including admin)
– Analyzing resource usage
Further Readings
• Google App Engine documentation
• GWT documentation
• “Beginning Java Google App” – Kyle Roche,
Jeff Douglas
• “Programming Google App Engine” – Dan
Sanderson