SlideShare a Scribd company logo
smart.biz.plsmart.biz.pl
Play with GAE
1
Productivity stack: Play Framework
on Google App Engine
Polish Java User Group
Kraków
2016-04-05
@marcinstepien
www.smart.biz.pl
smart.biz.plsmart.biz.pl
Marcin Stępień
Developer, Consultant
marcin@smart.biz.pl
@marcinstepien
linkedin.com/in/marcinstepien
www.smart.biz.pl
2005
www.whenvi.com
2014
2
smart.biz.plsmart.biz.pl
❖ App Engine intro, scaling & limitations
❖ Play Framework stuff
❖ GAE abstraction
❖ How do this two things work together
❖ Play 2 on GAE?
❖ Trade-offs
3
Play Framework + GAE
smart.biz.pl
Play
Framework
Google App
Engine
4
smart.biz.pl
Play
Framework
Google App
Engine
5
Productivity
smart.biz.pl
Google Cloud
Compute EngineApp Engine
PaaS IaaS
6
smart.biz.pl
Building blocks
App Engine PaaS
7
Build tools
Scalable
Infrastructure
smart.biz.pl
Scaling is simplified
8
One tier of servers
Instances:
- capacity
- max / min #
- manual / autoscale
- warm up /
decommission
- traffic splitting
Internet
smart.biz.pl
Just a drawing
9
Internet
load balancer frontend servers backed servers data store
You will not deal with that
smart.biz.pl
GAE Limitations
10
Security sandbox
● Java class whitelist
● Java 7
● Servlet API 2.5
○ no real async WS calls
● No raw socket connections
○ no SMTP etc.
○ Url Fetch service instead
Scalability
● Frontend calls are limited to
30s
● Scheduled Jobs limited to
10min
● Url Fetch limited to max 60s
● Do not share object in session
● NoSQL datastore *
● 200 indexes
smart.biz.plsmart.biz.pl
https://cloud.google.com/appengine/docs/the-appengine-environments
11
GAE Environments
smart.biz.pl
Play 1, Play 2, Ninja, Spark … Spring Boot, JHipster
Java micro frameworks
12
smart.biz.pl
Play 1 Play 2
2008 released 2013
Java first service Scala first, Java
Groovy templates Scala
1 GAE module -
by community
maintenance mode*
developed
by authors
and community
by 3rd part. commerce support
by authors
and 3rd part.
Play Framework versions
13
smart.biz.pl
There is no HttpServletRequest, HttpSession etc.
Not a JEE Framework
14
GAE module wraps Play app into .war file
smart.biz.pl
There is no server side session
Share Nothing
15
smart.biz.plsmart.biz.pl
#pass value to next request in flash scope
flash.put(“key”, object);
#store in encrypted user cookie, Strings only, 4kb
session.put(“key”, “value”);
#store object in cache
Cache.store(“key”, object, “1h”);
16
Share Nothing
smart.biz.pl
hot swapping on dev, just hit F5
+
auto scaling on prod
Share Nothing
17
smart.biz.pl
GAE gives 2 types. Transparent use for Play developer.
Distributed Cache
18
smart.biz.pl
But not on GAE with Servlet 2.5 spec
Play is asynchronous
19
smart.biz.plsmart.biz.pl
#com.ning.http.client.AsyncHttpClient
#not on GAE servlet API 2.5
Promise<HttpResponse> res1, res2;
res1 = WS.url("http://example1").getAsync();
res2 = WS.url("http://example2").getAsync();
...
#synchronous call works fine
WS.url("http://example").get();
#Json parser
WS.url("http://example").getJson();
20
WS calls are wrapped in URL fetch
smart.biz.pl
Siena module instead of GAE JPA
Data store: Active Record pattern
21
smart.biz.plsmart.biz.pl
public class Employee extends Model {
@Id public Long id;
public String fullName;
public Department dep;
}
public class Department extends Model {
@Id public Long id;
@Url public String website;
public Date launched;
}
22
Data store abstraction
smart.biz.plsmart.biz.pl
Employee adam = new Employee(“Adam”);
Adam.dep = department;
adam.save();
welcome(adam);
23
Active Record
smart.biz.plsmart.biz.pl
public class Employee extends Model {
@Id public Long id;
public String fullName;
#no Joins, dep stores only id field
public Department dep;
#retrieves and maps into object
public String getDepWebsite() {
#dep.website is null until you call .get()
return dep.get().website;
}
}
24
Fetching data, no joins
smart.biz.plsmart.biz.pl
public class Employee extends Model {...
public static List<Employee> getAll(Long depId) {
return all().filter(“dep”, new Department(depId))
.fetch();
}
public static Query<Employee> all() {
return all(Employee.class);
}
25
Querying
smart.biz.pl
Controller is tied to HTTP protocol
RESTful
26
smart.biz.plsmart.biz.pl
#http method, app url (regex), controller method
GET /employee/{id} Employees.user
POST /employee/ Employees.create
PUT /employee/{id} Employees.update
DELETE /employee/{id} Employees.delete
GET /employee/show-{id} Employees.show
GET /employee/list Employees.list
27
Routing
smart.biz.plsmart.biz.pl
#controller methods are static for Play v. < 1.4
public class Employees extends App {
public static void create(Employee em) {
em.save();
show(em.id); #HTTP 302 redirect
}
#template is chosen by convention
public static void show(Long id) {
#object passed into Employees/show.html
render(Employee.get(id));
}
public static void list() {
renderJSON(Employee.all());
}
}
28
Controller
smart.biz.pl
Data store, Logging, Cache, Gmail, WS calls etc.
GAE Abstraction
29
Is implemented in Play. GAE SDK is hidden.
smart.biz.pl
GAE tooling
30
BigQuery, Security scans, Performance scans, alerts
.
smart.biz.pl
2. Environment (Java 8, Servlet 3.0 +)
Play 2 on GAE ?
31
1. Deployable .war file
smart.biz.plsmart.biz.pl
https://github.com/play2war/play2-war-plugin
32
Play 2 on GAE: war
smart.biz.plsmart.biz.pl
https://cloud.google.com/appengine/docs/flexible/custom-runtimes/
https://cloud.google.com/appengine/docs/flexible/java/dev-jetty9-and-apis
33
Play 2 on GAE: run
Services only via public APIs...Jetty 9 + docker configuration
Flexible runtime Custom runtime
smart.biz.pl
Trade-offs
34
Pros
● Faster deployment
● Scaling
● Google Infrastructure
● maintenance + analytic tools
○ BigQuery etc.
● Abstraction
○ You are not tied with
GAE SDK
Cons
● Sandbox limitations
● Not truly asynchronous on
basic GAE
● Servlet container lowers
application performance
● Watch out for test coverage
smart.biz.plsmart.biz.pl
marcin@smart.biz.pl
@marcinstepien
35
Thank you

More Related Content

PDF
Play framework And Google Cloud Platform GCP.
PDF
Play Framework on Google App Engine
PDF
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...
PDF
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
PDF
Introduction in the play framework
PDF
Play vs Grails Smackdown - Devoxx France 2013
PDF
Clojure Web Development
PDF
Play Framework workshop: full stack java web app
Play framework And Google Cloud Platform GCP.
Play Framework on Google App Engine
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Introduction in the play framework
Play vs Grails Smackdown - Devoxx France 2013
Clojure Web Development
Play Framework workshop: full stack java web app

What's hot (20)

PDF
Play Framework vs Grails Smackdown - JavaOne 2013
PDF
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
PDF
Modern Web Application Development Workflow - EclipseCon France 2014
PDF
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
PPT
watir-webdriver
PDF
A Gentle Introduction to Angular Schematics - Angular SF 2019
PPT
Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
PDF
WordPress 2017 with VueJS and GraphQL
PDF
Web Performance Part 4 "Client-side performance"
PPTX
Playframework + Twitter Bootstrap
PPTX
Ci of js and apex using jasmine, phantom js and drone io df14
PDF
"13 ways to run web applications on the Internet" Andrii Shumada
PDF
How to Build a Better JIRA Add-on
PPTX
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
PDF
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
PDF
Game of Streams: How to Tame and Get the Most from Your Messaging Platforms
PPT
Choosing a Java Web Framework
PDF
Choosing a Javascript Framework
PPTX
High Performance Snippets
PDF
Max Voloshin - "Organization of frontend development for products with micros...
Play Framework vs Grails Smackdown - JavaOne 2013
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Modern Web Application Development Workflow - EclipseCon France 2014
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
watir-webdriver
A Gentle Introduction to Angular Schematics - Angular SF 2019
Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
WordPress 2017 with VueJS and GraphQL
Web Performance Part 4 "Client-side performance"
Playframework + Twitter Bootstrap
Ci of js and apex using jasmine, phantom js and drone io df14
"13 ways to run web applications on the Internet" Andrii Shumada
How to Build a Better JIRA Add-on
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Game of Streams: How to Tame and Get the Most from Your Messaging Platforms
Choosing a Java Web Framework
Choosing a Javascript Framework
High Performance Snippets
Max Voloshin - "Organization of frontend development for products with micros...
Ad

Similar to Play Framework on Google App Engine - Productivity Stack (20)

PDF
Powerful Google developer tools for immediate impact! (2023-24 C)
PDF
From Idea to App (or “How we roll at Small Town Heroes”)
PPT
Open Source Web Technologies
PPTX
Introducción al SharePoint Framework SPFx
PPT
Google Gears
PDF
Front End Development for Back End Java Developers - Jfokus 2020
PDF
Powerful Google Cloud tools for your hack
PPT
Google App Engine for Java
PPT
OGCE Project Overview
PPTX
Fast by Default
PPTX
OSGi with the Spring Framework
PPT
Scripting Oracle Develop 2007
PPTX
What's New for Developers in SharePoint 2010
PPTX
PHP on Windows and on Azure
PPTX
How NOT to get lost in the current JavaScript landscape
PPT
Google Cloud Developer Challenge - GDG Belgaum
PDF
How Google Cloud Platform can help in the classroom/lab
PDF
Introduction to serverless computing on Google Cloud
PPTX
Branding SharePoint from Prototype to Deployment - Workshop
PPT
The Web on OSGi: Here's How
Powerful Google developer tools for immediate impact! (2023-24 C)
From Idea to App (or “How we roll at Small Town Heroes”)
Open Source Web Technologies
Introducción al SharePoint Framework SPFx
Google Gears
Front End Development for Back End Java Developers - Jfokus 2020
Powerful Google Cloud tools for your hack
Google App Engine for Java
OGCE Project Overview
Fast by Default
OSGi with the Spring Framework
Scripting Oracle Develop 2007
What's New for Developers in SharePoint 2010
PHP on Windows and on Azure
How NOT to get lost in the current JavaScript landscape
Google Cloud Developer Challenge - GDG Belgaum
How Google Cloud Platform can help in the classroom/lab
Introduction to serverless computing on Google Cloud
Branding SharePoint from Prototype to Deployment - Workshop
The Web on OSGi: Here's How
Ad

More from Marcin Stepien (6)

PDF
CEK 7 Language Models and Power Laws. Complexity Explorers Krakow.
PDF
Natural born algorithms. Complexity Explorers Krakow.
PDF
Limits of AI. The Gödelian argument. Complexity Explorers Krakow.
PDF
Randomness from Determinism. Complexity Explorers Krakow.
PDF
Complexity Explorers Krakow - Computer Science & Philosophy
PDF
Functional Programming in Java - Code for Maintainability
CEK 7 Language Models and Power Laws. Complexity Explorers Krakow.
Natural born algorithms. Complexity Explorers Krakow.
Limits of AI. The Gödelian argument. Complexity Explorers Krakow.
Randomness from Determinism. Complexity Explorers Krakow.
Complexity Explorers Krakow - Computer Science & Philosophy
Functional Programming in Java - Code for Maintainability

Recently uploaded (20)

PPT
Project quality management in manufacturing
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Geodesy 1.pptx...............................................
PDF
composite construction of structures.pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
additive manufacturing of ss316l using mig welding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Welding lecture in detail for understanding
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Project quality management in manufacturing
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Lecture Notes Electrical Wiring System Components
Geodesy 1.pptx...............................................
composite construction of structures.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
additive manufacturing of ss316l using mig welding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Welding lecture in detail for understanding
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Lesson 3_Tessellation.pptx finite Mathematics
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...

Play Framework on Google App Engine - Productivity Stack