SlideShare a Scribd company logo
1 of 35
Download to read offline
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

What's hot

watir-webdriver
watir-webdriverwatir-webdriver
watir-webdriver
Amit DEWAN
 
Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter Bootstrap
Kevingo Tsai
 

What's hot (20)

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

Similar to Play Framework on Google App Engine - Productivity Stack

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

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

More from Marcin Stepien

More from Marcin Stepien (6)

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

Recently uploaded

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 

Play Framework on Google App Engine - Productivity Stack