Introduction to Cloud and Mobile
If you’ve bought something online from Amazon.com or posted to Facebook, you have accessed a cloud as an end user. This article explains how you can access cloud services from mobile devices as an app developer.
The term "cloud" is often loosely used in two senses — to represent "resources somewhere in the internet," as well as "the network and switching fabric that you travel over to reach those resources". In this article, we use the term cloud exclusively in the first sense — a cloud is the computing and storage resources in a data center. Using that definition, there are many different clouds, and clouds are not interchangeable. Facebook’s cloud serves Facebook services to Facebook members. Amazon’s cloud sells products to Amazon customers.
Hardware and software in a cloud
To appreciate how to use the cloud, let’s start by reviewing the hardware and software pieces that comprise a cloud. At its most basic, a cloud is a data center containing disk farms, application servers, load balancers, gateways, switches, networking fabric, etc. to connect them to each other and to the internet.
Any of this equipment can be requested from a central pool by customers. Data center system administrators will then reconfigure the IT infrastructure to fulfill the request. The customer accesses the hardware through an IP address range, assigned by the data center operator. The customer pays by the hour for all the equipment under his control.
This kind of basic cloud is termed "Infrastructure as a Service" (IaaS). Notice that no software is provisioned. The customer is responsible for providing, installing, and maintaining their own software stack. Computing resources may be provided as physical hardware, or (more usually) in the form of virtual machines running on physical hardware, so let’s discuss that for a minute.
The role of virtual machines
A virtual machine (VM) is a completely isolated guest operating system, running on a host computer. The guest operating system within each VM may be the same as the host operating system, or it may be different. For example, the Parallels product supports a VM environment with Windows as a guest environment, running on a Mac OS X host. Parallels provides Mac users with access to legacy Windows applications. Power users can create a separate VM for each Windows app — one VM image for Internet Explorer, another for Word, and so on. By running in separate VMs, an app crash will only halt that VM, and not all instances of Windows apps. It costs more in memory and licenses, but it saves hours of recovery and set-up time.
VMs work well for desktop computers, but the technique really comes into its own on servers in the cloud. Here, the standard approach is to provide hardware not directly as a physical server, but as one or more VMs that run on the server. Renting one VM-with-memory running on a server is considerably cheaper than renting the entire server. A typical VM is configured with 512 MB of RAM, 1 GB of swap, and four 2.67-GHz CPU cores. That resource in the cloud is available for 5 cents per hour.
Platform as a Service, and Software as a Service
The data center operator can provide VMs that are pre-loaded with as much or as little software as the customer wants. For example, the customer may request VMs that are pre-loaded with an operating system, such as Red Hat Enterprise Linux. The customer may also request a web server such as Apache web server, or some load balancing software to be provisioned. When some operating software is included in the cloud delivered, the product is termed "Platform as a Service" (PaaS). PaaS often comes with guarantees of scalability. If the customer’s demand for virtual machines is too large to run on one VM (e.g. because their website has become very popular), additional VMs will automatically be started up to meet the demand, then taken offline when no longer needed. The customer will be charged on a pro rata basis for the resources used.
Figure 1: Cloud = server farm + VMs + web services accessed via URLs
Just as PaaS builds on top of IaaS, there is an additional layer of sophistication on top of PaaS. Known as "Software as a Service" (SaaS), this type of cloud comes with the entire stack of software, including the end user application, preinstalled on the VM. As an example, the end user application in the case of the Gmail mail service is an email client that runs in a browser. Applications are run as a service that clients access through a URL. The app service is delivered from within a VM running on the physical host server.
SaaS has become a common delivery model for most business applications. Every leading enterprise software company today has a SaaS strategy (if they don’t, they are not a leading enterprise software company.
Significance for mobile
The key insight is that cloud makes enormous storage and computing resources available very cheaply and as a commodity or utility. These resources are easily accessed through URLs over the network. When the https protocol is used, all communications are securely encrypted. For developers and enterprises, the benefits of using the cloud include easy deployment, automatic scalability to meet demand, and freedom from provisioning or managing data centers.
The significance for mobile device users is you can connect to that network from anywhere your device has a data or Wi-Fi connection. That means that you have access to the vast resources from almost anywhere you are likely to be. You can use the server storage and computing resources from wherever you have a data or Wi-Fi connection. The benefits are seen across the whole spectrum from individual end users to multi-national enterprises. Take-up by industry has been swift.
Web services
Web services are the most popular protocol for accessing the cloud. The term "web service" refers to a unit of code, hosted on a web server, that will be executed when someone browses a particular URL. The results of running that code are delivered back in the form of renderable HTML (when a person requests the web service) or JSON/XML (when another computer requests the web service).
The significance for mobile developers is that you can very easily use existing web services in your apps. You can write additional web services that live in your company’s cloud, and invoke them from your apps. It’s conceivable that your mobile app can be reduced to a thin client offering UI only, getting all of the semantic content by invoking web services in the cloud. Such apps are quicker and cheaper to write, compared with apps that contain business logic. It is much simpler, quicker and cheaper to update business logic concentrated on servers, than to update individual apps on mobile devices.
Push from server
Android 2.2 (API level 8, Froyo) introduced a new service to help developers send data from servers to their applications on Android phones. Android Cloud to Device Messaging (C2DM) makes it easier for mobile applications to sync data with servers. The cloud can now reach out to the mobile device and say, "Hey, sync yourself to get up to date!"
Connectivity
Data connectivity is an absolute requirement for using cloud services from mobile devices. App developers have to include this into their designs. If data or Wi-Fi connections are not available, ideally the app should cache user input for later batch upload. Similarly, Google Maps lets users download and cache maps for up to a 10-mile radius around a chosen location. The map is then available regardless of your cellular signal.
As well as network access, the cloud also depends on network performance. Cloud performance is limited by the latency and bandwidth of the network connection between server and client. The move to mobile devices will spur pressure for faster data rates. Speed is currently hindering home users from moving all their data into the cloud, and never again worrying about backups, sharing, or remote access.
Cloud futures
The cloud is for (nearly) everyone, consumers and enterprises, large and small. It delivers compelling economic benefits through sharing IT infrastructure. The cloud should be like any utility — it comes to you through a socket in the wall and is so reliable you don’t notice it. Most enterprises will find it cheaper to lease access to someone else’s commercial cloud service (unless they have a special reason to run their own cloud, like privacy in the banking and finance sector).
Cloud use is currently big, and getting even bigger. Gartner Group reports that SaaS sales were expected to jump 20% over the previous year and total more than $12 billion in 2011. The cloud has made a very large debut. As part of ongoing growth, we expect to see increased use of Service Oriented Architectures and web services. Forward-looking organizations will adopt an SOA approach to designing new systems to keep their options open, regardless of cloud plans.
The cloud has steadily increased in sophistication and service levels over the past few years. With Software as a Service now an established protocol for accessing apps, it’s clear that the economic and administrative benefits of cloud computing combined with mobile devices are ready for widespread use today.
Peter van der Linden
Android Technology Evangelist
Created: June 11, 2012
ECCN 5E991.NR: In accordance with United States Export Administration Regulations (EAR), and specifically the Commerce Control List (CCL), this item has been classified 5E991.NR. Export or re-export of this commodity and compliance with the U.S. Export Administration Regulations is ultimately the responsibility of the exporter. For more detailed information related to export or re-export of this item, please consult the EAR at http://www.access.gpo.gov/bis/ear/ear_data.html.