74
Google App Engine for Java Lars Vogel http://www.vogella.de Twitter: http://www.twitter.com/vogella

Google App Engine for Java

Embed Size (px)

DESCRIPTION

Overview of the Google App Engine for Java.

Citation preview

Page 1: Google App Engine for Java

Google App Engine for Java

Lars Vogel

httpwwwvogellade

Twitter httpwwwtwittercomvogella

About Lars

Works for SAP as product owner of a

SCRUM team

Privately active in the Open Source

Community

Eclipse committer received the Eclipse

Top Contributor community award 2010

Webmaster of httpwwwvogellade with

more then 15 000 visitors per day

Lars Vogel

httpwwwvogellade

Twitter vogella

Why do I quality

bull Two popular tutorials in the internet about Google App Enginendash httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

ndash httpwwwvogelladearticlesGoogleAppEnginearticlehtml

bull Published an article about robots on the App Engine in the (german) Eclipse Magazin

bull Was technical editor for a Google App Engine Book (unpublished)

What is cloud computing for me

What is the Google App Engine

Development for GAE with Java

Persistence without SQL

Tools - A fool with a tool is still a fool

App Engine Services

Testing on the cloud

And of course coding

A typical system setup

OS +Application Server + DB

You need scaling

Application Server

Database

Application Server Application Server

So you are fine right

Designed for peek consumption

Time

Utilization

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 2: Google App Engine for Java

About Lars

Works for SAP as product owner of a

SCRUM team

Privately active in the Open Source

Community

Eclipse committer received the Eclipse

Top Contributor community award 2010

Webmaster of httpwwwvogellade with

more then 15 000 visitors per day

Lars Vogel

httpwwwvogellade

Twitter vogella

Why do I quality

bull Two popular tutorials in the internet about Google App Enginendash httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

ndash httpwwwvogelladearticlesGoogleAppEnginearticlehtml

bull Published an article about robots on the App Engine in the (german) Eclipse Magazin

bull Was technical editor for a Google App Engine Book (unpublished)

What is cloud computing for me

What is the Google App Engine

Development for GAE with Java

Persistence without SQL

Tools - A fool with a tool is still a fool

App Engine Services

Testing on the cloud

And of course coding

A typical system setup

OS +Application Server + DB

You need scaling

Application Server

Database

Application Server Application Server

So you are fine right

Designed for peek consumption

Time

Utilization

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 3: Google App Engine for Java

Why do I quality

bull Two popular tutorials in the internet about Google App Enginendash httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

ndash httpwwwvogelladearticlesGoogleAppEnginearticlehtml

bull Published an article about robots on the App Engine in the (german) Eclipse Magazin

bull Was technical editor for a Google App Engine Book (unpublished)

What is cloud computing for me

What is the Google App Engine

Development for GAE with Java

Persistence without SQL

Tools - A fool with a tool is still a fool

App Engine Services

Testing on the cloud

And of course coding

A typical system setup

OS +Application Server + DB

You need scaling

Application Server

Database

Application Server Application Server

So you are fine right

Designed for peek consumption

Time

Utilization

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 4: Google App Engine for Java

What is cloud computing for me

What is the Google App Engine

Development for GAE with Java

Persistence without SQL

Tools - A fool with a tool is still a fool

App Engine Services

Testing on the cloud

And of course coding

A typical system setup

OS +Application Server + DB

You need scaling

Application Server

Database

Application Server Application Server

So you are fine right

Designed for peek consumption

Time

Utilization

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 5: Google App Engine for Java

A typical system setup

OS +Application Server + DB

You need scaling

Application Server

Database

Application Server Application Server

So you are fine right

Designed for peek consumption

Time

Utilization

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 6: Google App Engine for Java

You need scaling

Application Server

Database

Application Server Application Server

So you are fine right

Designed for peek consumption

Time

Utilization

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 7: Google App Engine for Java

So you are fine right

Designed for peek consumption

Time

Utilization

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 8: Google App Engine for Java

Designed for peek consumption

Time

Utilization

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 9: Google App Engine for Java

Cloud computing tries to solve this

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 10: Google App Engine for Java

What is a cloud computing not

Putting one or more computer in the

internet is not necessary cloud

computing

That is just a server in

the internet

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 11: Google App Engine for Java

What is a cloud computing

Cloud computing is Web-based

processing whereby shared resources

software and information are provided to

computers and other devices (such as

smartphones) on demand over the

Internet

Super blabla this means nothing

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 12: Google App Engine for Java

Cloud some kind of abstracting from the hardware and providing resources on demand

Time

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 13: Google App Engine for Java

What types of cloud computing do we have

Infrastructure as a Service -gt Amazon

Platform as a Service -gt Google App

Engine

Software as a service -gt Salesforcecom

MyERP

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 14: Google App Engine for Java

Google App Engine

Scalable Infrastructure

GAE allows you to host

webapplications on the

Google infrastructure

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 15: Google App Engine for Java

Scalable Infrastructure

Amazon provides virtual servers

App Engine provides an

interface to program against

App Engine give no access to

the underlying system

hardware

Difference to Amazons

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 16: Google App Engine for Java

Run your app on the Google Infrastructure

Scalable Infrastructure

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 17: Google App Engine for Java

Google handles the infrastructure eg hardware failures security

patches OS upgrades

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 18: Google App Engine for Java

Sometimes there are issues

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 19: Google App Engine for Java

and the usage of App Engine is freehellip within limits

in any case you only pay for what your use

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 20: Google App Engine for Java

Google App Engine ndash Free Hosting

Scalable Infrastructure10 Applications per User

5 Million Pageviews are free per month

Approx 65 hours of CPU and 1 Gigabyte of inbound and outbound traffic

100 hits per secs (non-billing) and 500 for billing enabled applications

httpcodegooglecomintlen-ENappenginedocsbillinghtml

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 21: Google App Engine for Java

How does Google run thousands of thousands Java apps at the same

time

They donrsquothellip applications which are

not actively used will be frozen and

saved to big table

Initial startup time

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 22: Google App Engine for Java

App Engine Architecture

App Engine FrontEnd

App Engine FrontEnd

App Engine FrontEnd

AppServer AppServer AppServer

Load Balancer

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 23: Google App Engine for Java

So it scales

but what

about

Platform as a

service

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 24: Google App Engine for Java

Writing Java Webs application is hard

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-engine-java-

groovy-baby

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 25: Google App Engine for Java

To write a Java Web application

bull Install prepare the server

bull Install Configure the database

bull Setup the webcontainer

bull Develop your application

bull Package your application into a WAR file

bull Deploy it on your server

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 26: Google App Engine for Java

developing a Java Web application from scratch is really

really slow due to the initial setup required

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 27: Google App Engine for Java

Google App Engine ndash

Programming Languages

Python

Java-isch

Scala Groovy JRuby JPython

hellip

Still some issues with Grails

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 28: Google App Engine for Java

Servlets and JSPs

A servlet is a Java class which answers a

HTTP request within a web container

JavaServer Pages (JSP) are files which

contains HTML and Java code The web

container compiles the JSP into a servlet at

the first time of accessing this JSP

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 29: Google App Engine for Java

Possible Web Frameworks on GAE

Basically all Java Web

frameworks eg JSP

Servlets based

GWT JSF Struts Wicket

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 30: Google App Engine for Java

App Engine can be more then just a web application platform

Scalable Infrastructure

Doesnlsquot have to be a webapplication can be a backend for Android or iPhones

Can be used to do some serious number crunching

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 31: Google App Engine for Java

Develop according to Java standards

from Guillaume Laforge and Patrick Chanezon httpwwwslidesharenetglaforgegoogle-app-

engine-java-groovy-baby

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 32: Google App Engine for Java

Session Support

Turned off by default

appengine-webxml

ltsessions-enabledgttrueltsessions-enabledgt

Persistent and distributed

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 33: Google App Engine for Java

Configuration

webxml

appengine-webxml

- allows several versions of your app

- can define static content -gt super fast

- can define system variables

- enable ssl and http sessions

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 34: Google App Engine for Java

Development Tools

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 35: Google App Engine for Java

DevApp Server

Scalable Infrastructure

Emulates the Google App Engine

its service and restrictions

Based on Jetty

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 36: Google App Engine for Java

Eclipse

Scalable Infrastructure

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 37: Google App Engine for Java

Deployment

Scalable Infrastructure

Run your application on appplication-

idappspotcom or on your own

domain

Command line or Eclipse based

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 38: Google App Engine for Java

Logging

javautilloggingLogger

Systemout and Systemerr are also logged

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 39: Google App Engine for Java

Performance

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 40: Google App Engine for Java

Be fast

You have to be fast

bull 30 seconds to respond

bull Otherwise comgoogleapphostingapiDeadlineExceededException

Google helps you that as its optimize its infrastructure all the time

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 41: Google App Engine for Java

Example for recent performance work

Byte code used to enhanced dynamically now App Engine does this this statically

JIT and GC improvements

Example Work on reflection

Data from Google IO 2010

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 42: Google App Engine for Java

Limits

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 43: Google App Engine for Java

Limits

No native threads ndash but Tasks

No sockets

No write access to file system

No Native code

Not all standard Java classes available (white list)

Processes must finish without 30 secs (Tasks Chainshellip)

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 44: Google App Engine for Java

Compartibility is increasing

Whitelist is growing

More and more libraries are supported

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 45: Google App Engine for Java

AppStat - Servlet filter in webxml

ltfiltergt

ltfilter-namegtappstatsltfilter-namegt

ltfilter-

classgtcomgoogleappenginetoolsappstatsAppstats

Filterltfilter-classgt

ltinit-paramgt

ltparam-namegtlogMessageltparam-namegt

ltparam-valuegtAppstats available

appstatsdetailstime=IDltparam-valuegt

ltinit-paramgt

ltfiltergt

ltfilter-mappinggt

ltfilter-namegtappstatsltfilter-namegt

lturl-patterngtlturl-patterngt

ltfilter-mappinggt

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 46: Google App Engine for Java

Access AppStats

ltservletgtltservlet-namegtappstatsltservlet-namegtltservlet-

classgtcomgoogleappenginetoolsappstatsAppstatsServletltservlet-classgt

ltservletgtltservlet-mappinggt

ltservlet-namegtappstatsltservlet-namegtlturl-patterngtappstatslturl-patterngt

ltservlet-mappinggt

ltsecurity-constraintgt

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 47: Google App Engine for Java

AppStat

Source httpgoogleappengineblogspotcom201003easy-performance-

profiling-withhtml

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 48: Google App Engine for Java

Datastore

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 49: Google App Engine for Java

Storing data

Application can store data in memory memcache or the

datastore

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 50: Google App Engine for Java

Datastore

The datastore is App Engines non-relational database

Uses internally Bigtable which is a key-value store

Read Write Consistent and distributed

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 51: Google App Engine for Java

Datastore

The performance of a query depends only on the size of your result set It does not depend on the total number of data entries

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 52: Google App Engine for Java

Data Store

Based on BigTable

Sorted Map no Joins

Schemaless

Transactional

Low-level APIs

JDO and JPA

Blobstore

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 53: Google App Engine for Java

Datastore via JDO

Data ClassesPersistenceCapablepublic class Employee

Persistentprivate String name

PersistenceManagerPersistenceManager pm = PMFget()getPersistenceManager()pmmakePersistent(employee)pmclose

Retrieval and Queriesemployee = pmgetObjectById(Employeeclass key)Query query = pmnewQuery(Employeeclass ldquoname = namerdquo)ListltEmployeegt results = (ListltEmployeegt) queryexecute(Smith)

RelationsPersistent(mappedBy = employeeldquo)private ListltContactInfogt contactInfoSets

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 54: Google App Engine for Java

Indexes

bull App Engine builds indexes for several simple queries by default

bull If you run a query that filters on multiple entity properties or orders results by multiple properties you will need an index for that query

bull datastore-indexesxml in WEB-INF

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 55: Google App Engine for Java

Indexes

bull Every query you run in the SDK automatically gets indexed

bull Stored in applications datastore-indexesxml (Java)

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 56: Google App Engine for Java

Other storage possibilities

BlobstoreMemcache

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 57: Google App Engine for Java

Memcache

Cache data to avoid re-doing expensive operations

Fast

Developer can define a time-limit but App Engine may remove the data earlier -gt do not rely on the availability

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 58: Google App Engine for Java

Blogstore

Store Upload and serve large files (lt=2GB per blob)

Read only

Application can read blobs as if there are local files

Requires billing enabled

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 59: Google App Engine for Java

App Engine Services

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 60: Google App Engine for Java

Caching

Channel API (push to client comet)

URL Fetching

Mail

Instant Messaging (XMPP)

Image Manipulation

User Management

Background Tasks

Map (no Reduce)

XMPP (Chat)

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 61: Google App Engine for Java

Testing

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 62: Google App Engine for Java

Testing

Local Testing

- equal functionality as the cloud

- not equal in scale

- LocalServiceTestHelper(hellipservices to be tested)

Cloud Testing

- serving HTTP requests

- scalable and fast

- all limits apply which apply for standard application

-

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 63: Google App Engine for Java

Local Testing

Similar to standard Java testing

- JUnit TestNG Selenium

Difference Some classes require a certain

App Engine setup eg the datastore

AppEngine Testing API

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 64: Google App Engine for Java

Datastore Initialize your local environment

private final

LocalServiceTestHelper helper =

new

LocalServiceTestHelper(new

LocalDatastoreServiceTestConfig

())

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 65: Google App Engine for Java

Use the local test Datastore

DatastoreService ds = DatastoreServiceFactorygetDatastoreService()

assertEquals(0 dsprepare(new Query(yam))countEntities(withLimit(10)))

dsput(new Entity(yam))

dsput(new Entity(yam))

assertEquals(2 dsprepare(new Query(yam))countEntities(withLimit(10)))

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 66: Google App Engine for Java

APIProxy

Register your own class as proxy for

the GAE API calls and interfere them

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 67: Google App Engine for Java

Future

GAE 14

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 68: Google App Engine for Java

App Engine Future I

Running JVM (3 instances)

WarmupRequest via appengine-webxml

The Channel API is now available for all users

Task Queue has been officially released

Deadline for Task Queue and Cron requests has been raised

to 10 minutes

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 69: Google App Engine for Java

URL Fetch allowed response size has been increased up to

32 MB Request size is still limited to 1 MB

Added a low-level AysncDatastoreService for making calls to

the datastore

asynchronously

The whitelist has been updated to include all classes from

javaxxmlsoap

Source httpgroupsgooglecomgroupgoogle-appenginebrowse_threadthread0f90ef8dda3b8400

App Engine Future II

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 70: Google App Engine for Java

MySQL planned

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 71: Google App Engine for Java

Photo credits Please add httpwwwsxchuphoto to the number if not specified

bull Cloud 1309726

bull Agenda 187747

bull Guy pulling the white wall httpwwwsxchuphoto702367

bull Balloon httpwwwsxchuphoto566242

bull Critical guy httpwwwsxchuphoto1173019

bull Question mark in the box 1084632 and 1084633

bull Hammer 604247

bull Server 175983

bull Turtle 1198861

bull Thinking Guy 130484

bull Picked Fence 695054

bull Performance 765733

bull Tools 1197009

bull Open Door httpwwwsxchuphoto1228296

bull Paper Chart httpwwwsxchuphoto565681

bull Binary httpwwwsxchuphoto1072645

bull Footprint httpwwwsxchuphoto442696

bull Old Computer httpwwwsxchuphoto1028528

bull Carton httpwwwsxchuphoto502161

bull Eye httpwwwsxchuphoto933394

bull Guitar playing man httpwwwsxchuphoto 894247

bull Brown bag 250762

bull Future 1139530

bull Guy reading book 406547

bull Money House 1097251

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 72: Google App Engine for Java

Thank you

For further questions

LarsVogelgmailcom

httpwwwvogellade

httpwwwtwittercomvogella

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 73: Google App Engine for Java

Hands-on Tutorial

The following tutorials give an intro to GAEJ using servlets and JSPlsquos

httpwwwvogelladearticlesGoogleAppEngineJavaarticlehtml

httpcodegooglecomintlde-DEappenginedocsjavagettingstarted

httpwwwvogelladearticlesGoogleAppEnginearticlehtml

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US

Page 74: Google App Engine for Java

License amp Acknowledgements

bull This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 30 Germany License

ndash See httpcreativecommonsorglicensesby-nc-nd30dedeeden_US