Session Presented at 1st IndicThreads.com Conference On Mobile Application Development held on 19-20 November 2010 in Pune, India
WEB: http://M10.IndicThreads.com
------------
Speaker: Romin Irani
Abstract:
Mobile applications typically present the client side of a hosted application be it an enterprise app or a web application. This session aims to bridge and cover how you can power your mobile applications from the Cloud. The presentation will demonstrate how you can power both a native mobile application (Android) and a mobile web application (HTML based) from the Cloud via REST based HTTP Services.
The session will look at:
a) Advantages of using the cloud for mobile apps, with Google App Engine as an example. We shall build and deploy a simple Google App Engine application in the Cloud live.
b) Develop a simple Android Native Application that is powered by the services developed in (a). Demonstrate the same for a Mobile Web Application
c) Cover WURFL and how the device database can help you serve different content based on the capabilities of the mobile device that accesses your application.
3. 3
What is Cloud Computing?
• An application that you can use
• A computer that you can use
• A network peripheral that you can use
• Storage
• Applications like Gmail, SalesForce, etc
4. 4
What is the ‘Computing’ part?
Servers
Networks
Applications
Storage
Services
5. 5
Define Cloud Computing?
• Cloud computing is a pay-per-use model
for enabling available, convenient, on-
demand network access to a shared pool
of configurable computing resources
(e.g., networks, servers, storage,
applications, services) that can be rapidly
provisioned and released with minimal
management effort or service provider
interaction.
6. 6
5-4-3 Formula
Cloud Computing comprises of
• 5 key characteristics
– On Demand Self Service, Ubiquitous Network Access,
Location Independent Resource Pooling, Elasticity & Pay
Per Use
• 3 delivery models
– SaaS, PaaS, IaaS
• 4 deployment models
– Public, Private, Hybrid & Community
8. 8
IaaS, PaaS and SaaS - Summary
IaaS PaaS SaaS
I will give you a virtual
machine
in the cloud which you can
provision any time you want
I will give you a software
platform which you can use
to build and deploy
application in the cloud
I will provide you with ready
to use applications
You pay for what you use You pay based on usage You just need to log in and
use
You can scale it up or down
whenever you wish
You do not need to pay for
any additional software
You not need to buy
anything
You continue to use the
same set of software
You have no administrative
hassles
You pay only for what you
use
9. 9
Who are the providers?
• Amazon [IaaS]
• SalesForce [SaaS, PaaS]
• Google [SaaS, PaaS]
• Microsoft [SaaS, PaaS]
• Zoho [SaaS]
• And many more …
10. 10
Amazon – Web Services (IaaS)
• Elastic Compute Cloud (EC2)
– Rent computing resources by the hour
– Basic unit of accounting = instance-hour
– Additional costs for bandwidth
• Simple Storage Service (S3)
– Persistent storage
– Charge by the GB/month
– Additional costs for bandwidth
• Several Other services : Virtual Private Cloud,
etc
12. 12
Advantages
• Increase the speed at which application can be
deployed.
• Organizations can respond to change much
faster.
• IT Management is taken care of and you focus
on the application.
• By paying only for what you use - it shifts the
burden of planning for something that you are
not very sure of.
• IT is being delivered as a service via APIs.
13. 13
Disadvantages
• Traditional IT methods are not going to work
• Architectural decisions are in the hands of the
developers
• Programming models/APIs need to be learnt (PaaS)
• Coding needs to be done so as to get maximum value
for what you are paying
• Cloud Interoperability is suspect at this point in time
• Cloud standards/tools are still evolving
• Still need to separate out the hype from the
substance
15. 15
Google App Engine
• It is a PaaS, been around for 2.5 years
• It provides a software stack to develop
web applications
• Python and Java
• Downloadable SDK & Tools
– Eclipse Plugin, Local Server, Local Dashboard
• Specialized Services
• Scalable, Generous Free Quota … more.
17. 17
App Engine Architecture
17
Python /
Java
VM
process
stdlib
app
memcache
datastore
Mail
urlfetch
Services R/O FS
req/resp
Images
XMPP
Cron Jobs
Task Queue
Blob Store
User Service
18. 18
Advantages
• Development without worrying about the deployment
infrastructure
• Single development environment – end to end [Eclipse
based tools]
• Instant deployment, cloud scalability [Eclipse based tools]
• Excellent Monitoring Tools
• Billing : Pay as you use. Generous free quotas that get you
started immediately
• In short: An affordable, efficient and scalable
environment for your web applications.
20. 20
How to use Google App engine
• Download Java 6
• Download Eclipse and Google plug in
• Register a user account in Google
• Register an application
• Create an application (Java) and deploy the
application
• Your app is ready !!
• Monitor Usage & (Modify-Test-Deploy)
21. 21
Sample Application
• Reminder Service
– Monthly Reminders
– Example : FEB – Mom/Dad Anniversary, JUN –
Wife Birthday, JULY – Pay Tax .
– Simple REST like API to fetch details
22. 22
Lets get started!!
Download Java 6
Download Eclipse and Google plug in
Register a user account in Google
Register an application
Create an application (Java) and deploy the
application
Your app is ready !!
Monitor Usage & (Modify-Test-Deploy)
23. 23
Mobile Applications - Development
• Various Mobile OS
• Plenty of Tools / IDEs
• Possible to write many more apps – all
served by a Service Layer powered by the
Cloud
• Native or Web Mobile Applications
26. 26
• On the Server side, a 2-step procedure is used
to deliver the content.
– Identify the Device Capabilities and thereby its
group
• Use of WURFL Device Database
– Server side adaption to deliver the content
accordingly
Thin Client Architecture – Key Points
29. 29
• Build a common REST layer that will expose
functionality over XML/HTTP
• The REST functionality will contain all methods
required i.e. login, get account summary, report data,
payment transactions
• This common REST layer will be used by all Thick
Client applications and Thin Clients
• Thick client applications will use the features available
on the respective handsets.
Thick Client Architecture – Key Points
30. 30
Key to bringing it all together
• Cloud Application -> Service Enablement
• Glue : HTTP, REST , JSON/XML
• One Service layer -> Multiple Mobile
Applications (various platforms)
31. 31
Demos
• Cloud application and Service Layer
• Android Native application
• Web Mobile application
• WURFL Integration for Device detection
– http://wurfl.sourceforge.net/help_doc.php
Everyone has an opinion on what it is
In this session, you will see what my opinion is!
Actually not, what you will be given is a non-opinionated journey into what Cloud Computing is today minus the hype
Along the way, we will do the following:
Demonstrate a real Cloud Computing environment looks at from a developer perspective
Code an application from scratch and deploy it
See how you can write mobile applications that are driven by the services in your cloud application
On Demand Self ServiceA consumer can unilaterally provision computing capabilities, such as server time and network storage, as needed without requiring human interaction with each service's provider.
Ubiquitous network access Capabilities are available over the network and accessed through standard mechanisms that promote use by heterogeneous thin or thick client platforms (e.g., mobile phones, laptops, and PDAs).
Location independent Resource PoolingThe provider's computing resources are pooled to serve all consumers using a multi-tenant model, with different physical and virtual resources dynamically assigned and reassigned according to consumer demand. The customer generally has no control or knowledge over the exact location of the provided resources. Examples of resources include storage, processing, memory, network bandwidth, and virtual machines.
Rapid ElasticityCapabilities can be rapidly and elastically provisioned to quickly scale up and rapidly released to quickly scale down. To the consumer, the capabilities available for rent often appear to be infinite and can be purchased in any quantity at any time.
Pay Per UseCapabilities are charged using a metered, fee-for-service, or advertising based billing model to promote optimization of resource use. Examples are measuring the storage, bandwidth, and computing resources consumed and charging for the number of active user accounts per month. Clouds within an organization accrue cost between business units and may or may not use actual currency.
Cloud Software as a Service (SaaS)The capability provided to the consumer is to use the provider's applications running on a cloud infrastructure and accessible from various client devices through a thin client interface such as a Web browser (e.g., web-based email). The consumer does not manage or control the underlying cloud infrastructure, network, servers, operating systems, storage, or even individual application capabilities, with the possible exception of limited user-specific application configuration settings.
Cloud Platform as a Service (PaaS)The capability provided to the consumer is to deploy onto the cloud infrastructure consumer-created applications using programming languages and tools supported by the provider (e.g., java, python, .Net). The consumer does not manage or control the underlying cloud infrastructure, network, servers, operating systems, or storage, but the consumer has control over the deployed applications and possibly application hosting environment configurations.
Cloud Infrastructure as a Service (IaaS)The capability provided to the consumer is to rent processing, storage, networks, and other fundamental computing resources where the consumer is able to deploy and run arbitrary software, which can include operating systems and applications. The consumer does not manage or control the underlying cloud infrastructure but has control over operating systems, storage, deployed applications, and possibly select networking components (e.g., firewalls, load balancers).
IaaS PaaS SaaS
Last Point :You have to understand that what has happened is that via a credit card, you can now purchase compute cycles, create virtual machines and so on. And you do not need a full time service contract or plan for it in advance
Disadvantages:
Learning a new programming model
Constant monitoring, tweaking, etc as per your usage.
Free Quota : Set by System
Billing : Depends on the User
Free Quota should be enough for most applications to get started
Monitor the application usage to understand how much resources your application is using
Current approach is built using HTML5/JavaScript for high end mobile browsers.
This approach can be extended for lower category of mobiles using XHTML-MP with multiple CSS for different mobiles.
Approach plans to leave the older generation of mobiles using WML.
Single code base approach (except multiple CSS for XHTML-MP approach)
For smart phones, CSS and JavaScript is used to perform Ajax like calls, thereby improving the application responsiveness.
The native application has been built on iPhone OSv3.2 and Android v1.6 for demo purposes.
This would be required to be built on all target devices.
In this approach we could use the different mobile related features using the same server side code.