SlideShare a Scribd company logo
Google App Engine
Assoc.Prof. Dr.Thanachart Numnonda
 Asst.Prof. Thanisa Kruawaisayawan

    Mini Master of Java Technology
                KMITL
               July 2012
Agenda
What is Cloud Computing?

What is Google App Engine?

Google App Engine for Java

Google App Engine Development cycle
What is Cloud Computing?
Cloud computing : Definition (Wikipedia)

   Cloud Computing is Internet-based computing,
whereby shared resources, software, and information
  are provided to computers and other devices on
          demand, like the electricity grid.
Cloud computing characteristics
Massive, abstracted infrastructure
Dynamic allocation, scaling, movement of applications
Pay per use
No long-term commitments
OS, application architecture independent
No hardware or software to install
Grid to Cloud Evolution
Web 2.0 & Cloud Computing
Web 2,0 concentrate on the private user and clouds
 are decscendents of data centers which services the
 enterprise
Web 2.0 promote SaaS
Web 2.0 needs massive scaling technologies
User centric Web 2.0 companies (Twitter, Slideshare)
 are relying on Cloud Services
ISP to Cloud Evolution
Software as a Service (SaaS)
SaaS is at the highest layer and features a complete
 application offered as a service, on-demand,
via multitenancy — meaning a single instance of the
 software runs on the provider’s infrastructure and
 serves multiple client organizations.
Platform as a Service (PaaS)
The middle layer, or PaaS, is the encapsulation of a
 development environment abstraction and the
 packaging of a payload of services
PaaS offerings can provide for every phase of software
 development and testing, or they can be specialized
 around a particular area, such as content management
Infrastructure as a Service (IaaS)
IaaS is at the lowest layer and is a means of delivering basic
 storage and compute capabilities as standardized services
 over the network.
Servers, storage systems, switches,routers, and other
 systems are pooled (through virtualization technology, for
 example) to handle specific types of workloads — from batch
 processing to server/storage augmentation during peak loads.
Google App Engine
Deployment Model
Public Cloud: provider refers to the cloud platform that
 targets any types of customers.
Private Cloud: infrastructure that’s hosted internally, targeting
 specific customers or sometimes exclusively within an
 organization.
Hybrid Cloud: the combination of public and private clouds,
 or sometimes on-premise services.
IaaS & PaaS: Developer's Perspectives
IaaS normally provides up to O/S level as your choice; for
 example Amazon Web Services (AWS) offers several types of
 Operating Systems such as Windows Server, Linux SUSE, and
 Linux Red Hat. Developer need to install own middleware,
 database, etc.
PaaS, given that the database server, VM, and web server VM
 are readily provisioned,
Setting Up App in IaaS




Source:http://acloudyplace.com/2012/01/comparing-iaas-and-paas-a-developers-perspective/
Setting Up App in PaaS




Source:http://acloudyplace.com/2012/01/comparing-iaas-and-paas-a-developers-perspective/
PaaS for Java
Amazon Elastic Beanstalk
CloudBees
Cloud Foundry
Google App Engine
Heroku for Java
Red Hat OpenShift
PaaS for Java: Comparison
PaaS for Java: Comparison




Source: http://www.infoq.com/articles/paas_comparison
What is Google App Engine?
Google App Engine : Definition (Wikipedia)

It is a platform for hosting web applications in Google-
      managed data centers. It is cloud computing
    technology which virtualizes applications across
            multiple servers and data centers.
Google App Engine
Running your web application in Google infrastructure
Support different runtime environments
  Java (JRE 6 with limitation, Servlet 2.5, JDO, JPA)
  Python (2.5.2)
Apps run in sandbox.
Automatic scaling and load balancing
No server restart, no network issues
Hosting Java web apps traditionally
Not so popular except enterprise
High rates as compared to PHP hosting
Shared Tomcat instance among users
Restrictions on any time deployments due to shared
 server
Dedicated hosts works fine but they are costly
You end up with all this
Google App Engine
Google Datacenters at Dallas, Oregon
GAE Architecture
GAE Physical Deployment Diagram
Architecture : Application Server
Distributed web hosting platform
Distributed Datastore
Distributed memcache
Specialized services
Google Apps + your apps
Google App Engine for Java
GAE/J
Was released on April 08 with Python support. Java
 included on August 09
App Engine for Java : One Year




Source: What’s Hot in Java for App Engine Google Con 2010
GAE Java Runtime Environment
Java 6 VM
Servlet 2.5 Container
HTTP Session support (need to enable explicitly)
JDO/JPA for Datastore API
JSR 107 for Memcache API
javax.mail for Mail API
javax.net.URLConnection for URLFetch API
Java Standards on GAE
Services by App Engine
Memcache API – high performance in-memory key-value cache
Datastore – database storage and operations
URLFetch – invoking external URLs
Mail – sending mail from your application
Task Queues – for invoking background processes
Images – for image manipulation
Cron Jobs – scheduled tasks on defined time
User Accounts – using Google accounts for authentication
Limitations
Programming Model : Application runs in sandbox and
 can not
  Write to file system
  Make arbitrary network connections
  Use multiple threads/processes
  Perform long-lasting processing
  Permissions
  Know about other instances/applications
Quotas (Requests, In/Out bandwidth, CPU time, API
 calls)
GAE Datastore
GAE Datastore
Storing data and manipulation
Based on Bigtable
Bigtable is proprietary and hidden from the app developers
Not a relational database (No SQL)
GQL (Google Query Language) to query
Stores data as entities
Distribution, replication, load balancing behind the scene
Need to use JDO/JPA
User Service : Google Accounts
Google Accounts are encouraged as the preferred
 authentication mechanism for App Engine
   – It assumes that all users have a Google Account
   – Google authentication for private domains isn’t available yet
Access to Google account data -> email, id
The Development Server simulates Google Accounts
Access constraints based on roles
User API : Example
import com.google.appengine.api.users.*;
 import com.google.appengine.api.users.*;

UserService userService == UserServiceFactory.getUserService();
 UserService userService    UserServiceFactory.getUserService();
User user == userService.getCurrentUser();
 User user    userService.getCurrentUser();
String navBar;
 String navBar;
if (user == null) {{
 if (user == null)
     navBar == "<p>Welcome! <a href="" ++ userService.createLoginURL("/")
      navBar    "<p>Welcome! <a href=""    userService.createLoginURL("/")
     +"">Sign in or register</a> to customize.</p>";
      +"">Sign in or register</a> to customize.</p>";
}} else {{
    else
    navBar == "<p>Welcome, "" ++ user.getEmail() ++ "! You can <a href=""
     navBar    "<p>Welcome,       user.getEmail()    "! You can <a href=""
    +userService.createLogoutURL("/") +"">sign out</a>.</p>";
     +userService.createLogoutURL("/") +"">sign out</a>.</p>";
}}
URLFetch API
Invoking external URLs from your application over HTTP and
 HTTPs
import java.net.*;
 import java.net.*;
import java.io.*;
 import java.io.*;

URL url == new URL("htp://...");
 URL url    new URL("htp://...");
InputStream inp == new InputStreamReader(url.openStream());
 InputStream inp    new InputStreamReader(url.openStream());
BufferedReader reader == new BufferedReader(inp);
 BufferedReader reader    new BufferedReader(inp);
String line;
 String line;
while ((line == reader.readLine()) != null) {{
 while ((line    reader.readLine()) != null)
 //do something
  //do something
}}
reader.close();
 reader.close();
Mail API
Send emails on the behalf of app administrator to the Google
 account use.
You can not receive emails
import javax.mail.*;
 import javax.mail.*;

Session session == Session.getDefaultInstance(new Properties(), null);
 Session session    Session.getDefaultInstance(new Properties(), null);
InternetAddress admins == new InternetAddress("admins");
 InternetAddress admins    new InternetAddress("admins");
Message msg == new MimeMessage(session);
 Message msg    new MimeMessage(session);
msg.setFrom(admins);
 msg.setFrom(admins);
msg.addRecipient(Message.RecipientType.TO, admins);
 msg.addRecipient(Message.RecipientType.TO, admins);
msg.setSubject("subject");
 msg.setSubject("subject");
msg.setText("text");
 msg.setText("text");

Transport.send(msg);
 Transport.send(msg);
Memcache Service
Distributed in memory cache, better than DataStore
Key-value pair mapping
Configurable expiration time but
Unreliable might be vanished at any time
Supported Interfaces :
   – JACHE (JSR 107: JCACHE – Java Temporary Caching API)
   – The Low-Level Memcache API
Memcache API : Example

import static java.util.Collections.emptyMap;
 import static java.util.Collections.emptyMap;
import javax.cache.*;
 import javax.cache.*;

CacheFactory cacheFactory == CacheManager.getInstance().getCacheFactory();
 CacheFactory cacheFactory    CacheManager.getInstance().getCacheFactory();

Cache cache == cacheFactory.createCache(emptyMap());
 Cache cache    cacheFactory.createCache(emptyMap());

cache.put(key, value);
 cache.put(key, value);
cache.get(key);
 cache.get(key);
Task Queues API
Perform background processes by inserting tasks into queues.
Instructions need to be mention in file queue.xml, in the WEB-INF/ dir

import com.google.appengine.api.labs.taskqueue.Queue;
 import com.google.appengine.api.labs.taskqueue.Queue;
import com.google.appengine.api.labs.taskqueue.QueueFactory;
 import com.google.appengine.api.labs.taskqueue.QueueFactory;
import com.google.appengine.api.labs.taskqueue.TaskOptions;
 import com.google.appengine.api.labs.taskqueue.TaskOptions;

// ...
 // ...
TaskOptions taskOptions ==
 TaskOptions taskOptions
TaskOptions.Builder.url("/send_invitation_task")
 TaskOptions.Builder.url("/send_invitation_task")
   .param("address", "juliet@example.com")
    .param("address", "juliet@example.com")
   .param("firstname", "Juliet");
    .param("firstname", "Juliet");
Queue queue == QueueFactory.getDefaultQueue();
 Queue queue    QueueFactory.getDefaultQueue();
queue.add(taskOptions);
 queue.add(taskOptions);
Cron Jobs
Up to 20 scheduled tasks per app
Cron jobs (scheduled tasks) supported in cron.xml in WEB-INF dir
Schedule instructions contain Englis-like format
<?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
<cronentries>
 <cronentries>
<cron>
 <cron>
<url>/listbooks</url>
 <url>/listbooks</url>
<description>Repopulate the cache every day at
 <description>Repopulate the cache every day at
5am</description>
 5am</description>
<schedule>every day 05:00</schedule>
 <schedule>every day 05:00</schedule>
</cron>
 </cron>
</cronentries>
 </cronentries>
Images API
Manipulation of images
Transformation of images
Changing image formats
GAE Development Cycle
GAE Development Cycle
Getting Started
The application owner must have a Google Account to
 get the tools regardless of language.
Use Java 6 for development.
Eclipse and Netbeans have official plugins.
Both SDKs ship with a Development Web Server that
 runs locally and provides a sandbox almost identical to
 the real run-time.
Software Development Kit
App Engine SDK
  – Includes web server (Jetty)
  – Emulates all the GAE services
SDK includes an upload tool to deploy app to GAE
Command line tools included.
Google Plugin for Eclipse
Development Environment
Development Server
Application lifecycle
 management
Eclipse/NetBeans plugins /
 Firefox plugin (GWT).
Google Plugin for Eclipse
Development Server
   http://localhost:8888
Development Server Admin Console
       http://localhost:8888/_ah/admin
Deployment Environment
Application is deployed as .war which contains.
Deployment is integrated in IDE
Deploy multiple version of the application at the same
 time
Your app lives at
   – <app_id>.appspot.com or
   – Custom domain with Google Apps
Running your app on Google
http://<version>.<appid>.appspot.com/some/path
Managing Applications
Administration Console
 http://appengine.google.com/a/yourdomain.com
Application Dashboard
Multiple application versions
Analyzing log files (including admin)
Analyzing resource usag
GAE Dashboard
Resources
Google App Engine at a glance, Stefan Christoph
Developing Java Based Web Applications in
Google App Engine, Tahir Akram, Dec. 2009
Google App Engine, Patrick Chanezon, Mar 2010
Thank you

  thananum@gmail.com
  twitter.com/thanachart
www.facebook.com/thanachart

More Related Content

PPTX
Cs6703 grid and cloud computing unit 3
KEY
Introduction to Google App Engine
PPTX
Google App Engine
PPTX
Networking in cloud computing
PPT
System models for distributed and cloud computing
PDF
Cloud computing system models for distributed and cloud computing
PPTX
CLOUD COMPUTING SERVICES - Cloud Reference Modal
PPT
3. challenges
Cs6703 grid and cloud computing unit 3
Introduction to Google App Engine
Google App Engine
Networking in cloud computing
System models for distributed and cloud computing
Cloud computing system models for distributed and cloud computing
CLOUD COMPUTING SERVICES - Cloud Reference Modal
3. challenges

What's hot (20)

PDF
Cloud Computing Architecture
PPTX
Virtual machine security
PPT
Cloud Computing Security Challenges
PPTX
Scheduling in Cloud Computing
PDF
CS8791 Cloud Computing - Question Bank
PPTX
Fault tolerance in distributed systems
PPT
Cloud deployment models
PPT
distributed shared memory
PDF
Evolution of Cloud Computing
PPT
Clock synchronization in distributed system
PPTX
Virtualization in cloud computing
PPT
Legal issues in cloud computing
PPT
Introduction to Google App Engine
PPTX
Vision of cloud computing
PPTX
Mobile cloud Computing
DOC
Naming in Distributed System
DOC
IOT Reference Model.doc
PPT
Virtualization in cloud computing ppt
Cloud Computing Architecture
Virtual machine security
Cloud Computing Security Challenges
Scheduling in Cloud Computing
CS8791 Cloud Computing - Question Bank
Fault tolerance in distributed systems
Cloud deployment models
distributed shared memory
Evolution of Cloud Computing
Clock synchronization in distributed system
Virtualization in cloud computing
Legal issues in cloud computing
Introduction to Google App Engine
Vision of cloud computing
Mobile cloud Computing
Naming in Distributed System
IOT Reference Model.doc
Virtualization in cloud computing ppt
Ad

Viewers also liked (20)

PPTX
Managing Security and Delivering Performance in the Cloud
PDF
Business Strategy and Policy For Next Generation: Social Media Related DC
PPTX
Driving Business Growth in the Age of Innovation
PDF
Thai IT Trade Delegation to Tokyo, Japan 11-16 November 2012
PDF
Zero Downtime Migration
PPT
Backdrop ballroom c
PDF
Thai IT Delegation to Japan 2012
PDF
Google Web Toolkit
PPTX
ซอฟต์แวร์ไทยสู่เวทีโลกด้วย Windows azure overview
PDF
Thai Software Companies at CommunicAsia 2012
PDF
Presentation ให้นักศึกษา ม.ขอนแก่น ที่มาเยี่ยมชม Software Park ในวันที่ 17 ต....
PPT
Spin intro-v6
PDF
แถลงข่าว “บริษัทซอฟต์แวร์ไทยผงาดขึ้นแท่นที่ 1 ในอาเซียน”
PDF
Introduction to Datastore
PDF
List of CMMI's companies in Thailand
PPT
Business model
PPTX
Key success factors for managing software business
PDF
Software Park Thailand Newsletter (Thai) Vol2/2556
PDF
Technology Trends
PDF
นวัตกรรมที่ควรเรียนรู้ในศตวรรษที่ 21
Managing Security and Delivering Performance in the Cloud
Business Strategy and Policy For Next Generation: Social Media Related DC
Driving Business Growth in the Age of Innovation
Thai IT Trade Delegation to Tokyo, Japan 11-16 November 2012
Zero Downtime Migration
Backdrop ballroom c
Thai IT Delegation to Japan 2012
Google Web Toolkit
ซอฟต์แวร์ไทยสู่เวทีโลกด้วย Windows azure overview
Thai Software Companies at CommunicAsia 2012
Presentation ให้นักศึกษา ม.ขอนแก่น ที่มาเยี่ยมชม Software Park ในวันที่ 17 ต....
Spin intro-v6
แถลงข่าว “บริษัทซอฟต์แวร์ไทยผงาดขึ้นแท่นที่ 1 ในอาเซียน”
Introduction to Datastore
List of CMMI's companies in Thailand
Business model
Key success factors for managing software business
Software Park Thailand Newsletter (Thai) Vol2/2556
Technology Trends
นวัตกรรมที่ควรเรียนรู้ในศตวรรษที่ 21
Ad

Similar to Google App Engine (20)

PDF
Java Web Programming on Google Cloud Platform [1/3] : Google App Engine
PDF
Java Web Programming Using Cloud Platform: Module 10
PPTX
Google Cloud Platform
PPTX
CloudPlatforms-Cloud PLatforms evaluation
PDF
Introduction to Google's Cloud Technologies
PDF
Javaedge 2010-cschalk
PDF
What's new in App Engine and intro to App Engine for Business
PDF
Introduction to Google Cloud Platform Technologies
PPT
Google App Engine for Java
PPTX
Google App Engine
PDF
App Engine Overview Cloud Futures Publish
PDF
Google App Engine for Java v0.0.2
PDF
Cloudy in Indonesia: Java and Cloud
PPTX
Google apps engine
PPTX
Google apps engine
PDF
Aloha on-rails-2009
PDF
App Engine Presentation @ SFJUG Sep 2010
PPT
Developing Java Web Applications In Google App Engine
PDF
Don Schwarz App Engine Talk
PDF
Google Developer Days Brazil 2009 - Java Appengine
Java Web Programming on Google Cloud Platform [1/3] : Google App Engine
Java Web Programming Using Cloud Platform: Module 10
Google Cloud Platform
CloudPlatforms-Cloud PLatforms evaluation
Introduction to Google's Cloud Technologies
Javaedge 2010-cschalk
What's new in App Engine and intro to App Engine for Business
Introduction to Google Cloud Platform Technologies
Google App Engine for Java
Google App Engine
App Engine Overview Cloud Futures Publish
Google App Engine for Java v0.0.2
Cloudy in Indonesia: Java and Cloud
Google apps engine
Google apps engine
Aloha on-rails-2009
App Engine Presentation @ SFJUG Sep 2010
Developing Java Web Applications In Google App Engine
Don Schwarz App Engine Talk
Google Developer Days Brazil 2009 - Java Appengine

More from Software Park Thailand (20)

PDF
Smart industry Vol.33/2561
PDF
Softwarepark news Vol.7/2561
PDF
Software Park Newsletter Thai Vol 3/25561
PDF
Smart Industry Vol.23
PDF
Solfware park Newsletter Vol 3/2013 Eng Version
PDF
Software Park Thailand Newsletter Vol 3/2556
PDF
Software Park Thailand Newsletter (Eng) Vol3/2012
PDF
Software Park Thailand Newsletter (Eng) Vol5/2013
PDF
Software Park Thailand Newsletter (Thai) Vol4/2555
PDF
Thai ICT Trad Mission CommunicAsia 2013 (18-21 June 2013)
PDF
Smart Industry Vo.22/2556"E-transaction กระตุ้นธุรกิจอีคอมเมิร์สโต"
PDF
Software newsletter
PDF
Smart industry Vol. 21/2556
PDF
Software Park Newsletter 2/2554 "แท็บเล็ต สมาร์ทโพน โมบายแอพพลิเคชั่น ดาวเด่น...
PDF
Software Park Newsletter Vol. 4/2012 English Version
PDF
Thai IT Business Develop,emt Delegation to Tokyo, Japan, 2012
PDF
Thai IT Business Development Delegation to Tokyo, Japan: November 2012
PDF
Smart industry Vol. 20/2555
PDF
Technology Trends : Impacts to Thai Industries
PDF
Cloud Thailand Alliance
Smart industry Vol.33/2561
Softwarepark news Vol.7/2561
Software Park Newsletter Thai Vol 3/25561
Smart Industry Vol.23
Solfware park Newsletter Vol 3/2013 Eng Version
Software Park Thailand Newsletter Vol 3/2556
Software Park Thailand Newsletter (Eng) Vol3/2012
Software Park Thailand Newsletter (Eng) Vol5/2013
Software Park Thailand Newsletter (Thai) Vol4/2555
Thai ICT Trad Mission CommunicAsia 2013 (18-21 June 2013)
Smart Industry Vo.22/2556"E-transaction กระตุ้นธุรกิจอีคอมเมิร์สโต"
Software newsletter
Smart industry Vol. 21/2556
Software Park Newsletter 2/2554 "แท็บเล็ต สมาร์ทโพน โมบายแอพพลิเคชั่น ดาวเด่น...
Software Park Newsletter Vol. 4/2012 English Version
Thai IT Business Develop,emt Delegation to Tokyo, Japan, 2012
Thai IT Business Development Delegation to Tokyo, Japan: November 2012
Smart industry Vol. 20/2555
Technology Trends : Impacts to Thai Industries
Cloud Thailand Alliance

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Machine learning based COVID-19 study performance prediction
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectral efficient network and resource selection model in 5G networks
Digital-Transformation-Roadmap-for-Companies.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Network Security Unit 5.pdf for BCA BBA.
Dropbox Q2 2025 Financial Results & Investor Presentation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Reach Out and Touch Someone: Haptics and Empathic Computing

Google App Engine

  • 1. Google App Engine Assoc.Prof. Dr.Thanachart Numnonda Asst.Prof. Thanisa Kruawaisayawan Mini Master of Java Technology KMITL July 2012
  • 2. Agenda What is Cloud Computing? What is Google App Engine? Google App Engine for Java Google App Engine Development cycle
  • 3. What is Cloud Computing?
  • 4. Cloud computing : Definition (Wikipedia) Cloud Computing is Internet-based computing, whereby shared resources, software, and information are provided to computers and other devices on demand, like the electricity grid.
  • 5. Cloud computing characteristics Massive, abstracted infrastructure Dynamic allocation, scaling, movement of applications Pay per use No long-term commitments OS, application architecture independent No hardware or software to install
  • 6. Grid to Cloud Evolution
  • 7. Web 2.0 & Cloud Computing Web 2,0 concentrate on the private user and clouds are decscendents of data centers which services the enterprise Web 2.0 promote SaaS Web 2.0 needs massive scaling technologies User centric Web 2.0 companies (Twitter, Slideshare) are relying on Cloud Services
  • 8. ISP to Cloud Evolution
  • 9. Software as a Service (SaaS) SaaS is at the highest layer and features a complete application offered as a service, on-demand, via multitenancy — meaning a single instance of the software runs on the provider’s infrastructure and serves multiple client organizations.
  • 10. Platform as a Service (PaaS) The middle layer, or PaaS, is the encapsulation of a development environment abstraction and the packaging of a payload of services PaaS offerings can provide for every phase of software development and testing, or they can be specialized around a particular area, such as content management
  • 11. Infrastructure as a Service (IaaS) IaaS is at the lowest layer and is a means of delivering basic storage and compute capabilities as standardized services over the network. Servers, storage systems, switches,routers, and other systems are pooled (through virtualization technology, for example) to handle specific types of workloads — from batch processing to server/storage augmentation during peak loads.
  • 13. Deployment Model Public Cloud: provider refers to the cloud platform that targets any types of customers. Private Cloud: infrastructure that’s hosted internally, targeting specific customers or sometimes exclusively within an organization. Hybrid Cloud: the combination of public and private clouds, or sometimes on-premise services.
  • 14. IaaS & PaaS: Developer's Perspectives IaaS normally provides up to O/S level as your choice; for example Amazon Web Services (AWS) offers several types of Operating Systems such as Windows Server, Linux SUSE, and Linux Red Hat. Developer need to install own middleware, database, etc. PaaS, given that the database server, VM, and web server VM are readily provisioned,
  • 15. Setting Up App in IaaS Source:http://acloudyplace.com/2012/01/comparing-iaas-and-paas-a-developers-perspective/
  • 16. Setting Up App in PaaS Source:http://acloudyplace.com/2012/01/comparing-iaas-and-paas-a-developers-perspective/
  • 17. PaaS for Java Amazon Elastic Beanstalk CloudBees Cloud Foundry Google App Engine Heroku for Java Red Hat OpenShift
  • 18. PaaS for Java: Comparison
  • 19. PaaS for Java: Comparison Source: http://www.infoq.com/articles/paas_comparison
  • 20. What is Google App Engine?
  • 21. Google App Engine : Definition (Wikipedia) It is a platform for hosting web applications in Google- managed data centers. It is cloud computing technology which virtualizes applications across multiple servers and data centers.
  • 22. Google App Engine Running your web application in Google infrastructure Support different runtime environments Java (JRE 6 with limitation, Servlet 2.5, JDO, JPA) Python (2.5.2) Apps run in sandbox. Automatic scaling and load balancing No server restart, no network issues
  • 23. Hosting Java web apps traditionally Not so popular except enterprise High rates as compared to PHP hosting Shared Tomcat instance among users Restrictions on any time deployments due to shared server Dedicated hosts works fine but they are costly
  • 24. You end up with all this
  • 26. Google Datacenters at Dallas, Oregon
  • 34. Google Apps + your apps
  • 35. Google App Engine for Java
  • 36. GAE/J Was released on April 08 with Python support. Java included on August 09
  • 37. App Engine for Java : One Year Source: What’s Hot in Java for App Engine Google Con 2010
  • 38. GAE Java Runtime Environment Java 6 VM Servlet 2.5 Container HTTP Session support (need to enable explicitly) JDO/JPA for Datastore API JSR 107 for Memcache API javax.mail for Mail API javax.net.URLConnection for URLFetch API
  • 40. Services by App Engine Memcache API – high performance in-memory key-value cache Datastore – database storage and operations URLFetch – invoking external URLs Mail – sending mail from your application Task Queues – for invoking background processes Images – for image manipulation Cron Jobs – scheduled tasks on defined time User Accounts – using Google accounts for authentication
  • 41. Limitations Programming Model : Application runs in sandbox and can not Write to file system Make arbitrary network connections Use multiple threads/processes Perform long-lasting processing Permissions Know about other instances/applications Quotas (Requests, In/Out bandwidth, CPU time, API calls)
  • 43. GAE Datastore Storing data and manipulation Based on Bigtable Bigtable is proprietary and hidden from the app developers Not a relational database (No SQL) GQL (Google Query Language) to query Stores data as entities Distribution, replication, load balancing behind the scene Need to use JDO/JPA
  • 44. User Service : Google Accounts Google Accounts are encouraged as the preferred authentication mechanism for App Engine – It assumes that all users have a Google Account – Google authentication for private domains isn’t available yet Access to Google account data -> email, id The Development Server simulates Google Accounts Access constraints based on roles
  • 45. User API : Example import com.google.appengine.api.users.*; import com.google.appengine.api.users.*; UserService userService == UserServiceFactory.getUserService(); UserService userService UserServiceFactory.getUserService(); User user == userService.getCurrentUser(); User user userService.getCurrentUser(); String navBar; String navBar; if (user == null) {{ if (user == null) navBar == "<p>Welcome! <a href="" ++ userService.createLoginURL("/") navBar "<p>Welcome! <a href="" userService.createLoginURL("/") +"">Sign in or register</a> to customize.</p>"; +"">Sign in or register</a> to customize.</p>"; }} else {{ else navBar == "<p>Welcome, "" ++ user.getEmail() ++ "! You can <a href="" navBar "<p>Welcome, user.getEmail() "! You can <a href="" +userService.createLogoutURL("/") +"">sign out</a>.</p>"; +userService.createLogoutURL("/") +"">sign out</a>.</p>"; }}
  • 46. URLFetch API Invoking external URLs from your application over HTTP and HTTPs import java.net.*; import java.net.*; import java.io.*; import java.io.*; URL url == new URL("htp://..."); URL url new URL("htp://..."); InputStream inp == new InputStreamReader(url.openStream()); InputStream inp new InputStreamReader(url.openStream()); BufferedReader reader == new BufferedReader(inp); BufferedReader reader new BufferedReader(inp); String line; String line; while ((line == reader.readLine()) != null) {{ while ((line reader.readLine()) != null) //do something //do something }} reader.close(); reader.close();
  • 47. Mail API Send emails on the behalf of app administrator to the Google account use. You can not receive emails import javax.mail.*; import javax.mail.*; Session session == Session.getDefaultInstance(new Properties(), null); Session session Session.getDefaultInstance(new Properties(), null); InternetAddress admins == new InternetAddress("admins"); InternetAddress admins new InternetAddress("admins"); Message msg == new MimeMessage(session); Message msg new MimeMessage(session); msg.setFrom(admins); msg.setFrom(admins); msg.addRecipient(Message.RecipientType.TO, admins); msg.addRecipient(Message.RecipientType.TO, admins); msg.setSubject("subject"); msg.setSubject("subject"); msg.setText("text"); msg.setText("text"); Transport.send(msg); Transport.send(msg);
  • 48. Memcache Service Distributed in memory cache, better than DataStore Key-value pair mapping Configurable expiration time but Unreliable might be vanished at any time Supported Interfaces : – JACHE (JSR 107: JCACHE – Java Temporary Caching API) – The Low-Level Memcache API
  • 49. Memcache API : Example import static java.util.Collections.emptyMap; import static java.util.Collections.emptyMap; import javax.cache.*; import javax.cache.*; CacheFactory cacheFactory == CacheManager.getInstance().getCacheFactory(); CacheFactory cacheFactory CacheManager.getInstance().getCacheFactory(); Cache cache == cacheFactory.createCache(emptyMap()); Cache cache cacheFactory.createCache(emptyMap()); cache.put(key, value); cache.put(key, value); cache.get(key); cache.get(key);
  • 50. Task Queues API Perform background processes by inserting tasks into queues. Instructions need to be mention in file queue.xml, in the WEB-INF/ dir import com.google.appengine.api.labs.taskqueue.Queue; import com.google.appengine.api.labs.taskqueue.Queue; import com.google.appengine.api.labs.taskqueue.QueueFactory; import com.google.appengine.api.labs.taskqueue.QueueFactory; import com.google.appengine.api.labs.taskqueue.TaskOptions; import com.google.appengine.api.labs.taskqueue.TaskOptions; // ... // ... TaskOptions taskOptions == TaskOptions taskOptions TaskOptions.Builder.url("/send_invitation_task") TaskOptions.Builder.url("/send_invitation_task") .param("address", "juliet@example.com") .param("address", "juliet@example.com") .param("firstname", "Juliet"); .param("firstname", "Juliet"); Queue queue == QueueFactory.getDefaultQueue(); Queue queue QueueFactory.getDefaultQueue(); queue.add(taskOptions); queue.add(taskOptions);
  • 51. Cron Jobs Up to 20 scheduled tasks per app Cron jobs (scheduled tasks) supported in cron.xml in WEB-INF dir Schedule instructions contain Englis-like format <?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?> <cronentries> <cronentries> <cron> <cron> <url>/listbooks</url> <url>/listbooks</url> <description>Repopulate the cache every day at <description>Repopulate the cache every day at 5am</description> 5am</description> <schedule>every day 05:00</schedule> <schedule>every day 05:00</schedule> </cron> </cron> </cronentries> </cronentries>
  • 52. Images API Manipulation of images Transformation of images Changing image formats
  • 55. Getting Started The application owner must have a Google Account to get the tools regardless of language. Use Java 6 for development. Eclipse and Netbeans have official plugins. Both SDKs ship with a Development Web Server that runs locally and provides a sandbox almost identical to the real run-time.
  • 56. Software Development Kit App Engine SDK – Includes web server (Jetty) – Emulates all the GAE services SDK includes an upload tool to deploy app to GAE Command line tools included.
  • 57. Google Plugin for Eclipse
  • 58. Development Environment Development Server Application lifecycle management Eclipse/NetBeans plugins / Firefox plugin (GWT).
  • 59. Google Plugin for Eclipse
  • 60. Development Server http://localhost:8888
  • 61. Development Server Admin Console http://localhost:8888/_ah/admin
  • 62. Deployment Environment Application is deployed as .war which contains. Deployment is integrated in IDE Deploy multiple version of the application at the same time Your app lives at – <app_id>.appspot.com or – Custom domain with Google Apps
  • 63. Running your app on Google http://<version>.<appid>.appspot.com/some/path
  • 64. Managing Applications Administration Console http://appengine.google.com/a/yourdomain.com Application Dashboard Multiple application versions Analyzing log files (including admin) Analyzing resource usag
  • 66. Resources Google App Engine at a glance, Stefan Christoph Developing Java Based Web Applications in Google App Engine, Tahir Akram, Dec. 2009 Google App Engine, Patrick Chanezon, Mar 2010
  • 67. Thank you thananum@gmail.com twitter.com/thanachart www.facebook.com/thanachart