Tuesday, August 30, 2011

When Worlds Collide: HTML5 Meets The Cloud

What does The New Web have to do with Cloud Computing? More than you might think. When two revolutions are taking place in parallel, they are bound to influence each other.

Two big revolutions are happening right now that greatly affect web applications: HTML5 and devices are transforming the front end, and cloud computing is transforming the back end. Together these revolutions allow us to create rich, take-anywhere immersive experiences backed by on-demand, elastic services running at global scale. What do HTML5 and the cloud have to do with each other? Are they merely complementary or do they impact each other? Should architects consider them individually or jointly when designing web solutions? Let’s find out.

Separate But Equal?

At first glance, it would appear the front end and the back end of a web application are rather cleanly separated. After all, whether a web client is traditional or running on a device, it’s still going to interact with the web server using HTTP(S). Similarly, you might think the primary impact of running a web server in the cloud as opposed to on-premise or in a hosted data center is that it’s merely at a different address. One could argue that this separation is a good thing, allowing front ends and back ends to be modernized independently, in a demonstration of loose coupling that would make SOA and REST aficionados proud.

These observations are true but only to a point. If HTML5 and cloud were only about putting our software in different places, we could say they are complementary in the benefits they provide but don’t really affect each other. There’s so much more involved than location, however! Both revolutions are changing the way people use software and the characteristics expected of software. Let’s review the core tenets of each and then discuss how they affect each other.

Core Tenets of The New Web

Just when it seemed the web couldn’t gain any more importance or become a deeper part of our lifestyles, our massive love affair with devices and social networking has tightened its grip on us further. HTML5’s promise to be a lingua franca for web applications is backed by massive momentum from industry and community alike. It’s fueled by the same “write once, run anywhere” passion that put Java on the map over a decade ago. Going forward, proprietary web client software and plug-ins are going to find less and less surface area in which to run. While device hardware and server platforms remain proprietary, removing the proprietary element of web client software is causing developer communities formerly separated along vendor lines to blend.

The emerging notion of a modern web application is one that excels in experience, relevance, ubiquity, continuity, and availability. It should provide a compelling and immersive multimedia experience that is animated, interactive, and responsive. It should integrate with your social networks to make its functionality highly relevant to you and those important to you. It should be able to run on a PC browser, tablet, or phone—not as separate implementations but a single implementation that adapts intelligently to screen size and supports mouse, keyboard, and touch interaction equally well. It should recognize that users will often use more than one device to access an application and provide continuity of identity, state, and data across sessions. It should permit disconnected operation and still be able to provide useful functionality. In short, modern web applications are rich, take-anywhere applications.

Core Tenets of the Cloud

Cloud computing makes the world’s finest data centers available to just about anyone, leveling the playing field for small business, individuals, and developing nations. It brings a radical shift in the economics, flexibility, and capability of IT. The cloud’s consumption-based pricing model does away with traditional start-up hurdles such as rigorous capacity planning and capital expenditures to purchase hardware; instead you have an approachable monthly bill where you only pay for what you use and only use what you need. You’re under no term commitment and can start and stop using the cloud as you wish, preserving your freedom to experiment and change your plans without penalty or obligation. The cloud’s elastic nature allows you to scale your application up or down as you wish in response to current or anticipated changes in load. A sophisticated cloud platform like Windows Azure automates many IT tasks such as patching and delivers significant services beyond mere hosting and data storage.

The emerging notion of a modern cloud application or service is one that excels in elastic scale, global presence, and high availability. It should scale up as needed to service demand and scale down when not needed to reduce cost. It should be available everywhere and anywhere, leveraging multiple data centers and content delivery networks to provide universal access with good performance. It should leverage redundancy and the smart infrastructure of cloud data centers to protect the availability of applications and the fidelity of data—a highly distributed environment in which lessened dependence on state, transactions, and resource locking is necessary. In short, modern cloud applications are on-demand, elastic, and run at global scale.

The Interplay

Given how major these transformations are, there can’t help but be cross-over effects since both are components of the same thing, a web application, and must work together. Let’s first of all recognize that old or new, certain aspects of any application must be designed with the entire solution in view: that includes security, reliability, and scale. Here are some ways in which the changing front end forces design changes on the back end or vice-versa:

1. Where a web application lives is changing. The shift is toward more of the application residing on the web client side than in the past. Conversely, that means there is less on the server side.

2. Where data lives is changing. HTML5 client applications have local storage available to them. This can affect the data model and design of web service interfaces. You might for example return more data to a capable client with local storage than to a simplistic one.

3. Changing behaviors on the web client side require matching services on the server side. For example, a web application that supports disconnected operation likely needs additional web services on the back end to support syncing.

4. Web services can be consumed client-side as well as server-side. Historically, integrations to external web services (such as a shipping service) tended to be implemented on the server side except for special cases such as maps and mash-ups. In these days of highly capable web clients it sometimes makes more sense for the web client to consume those services directly rather than going through its web server to do so.

5. A web application that permits a user to switch between multiple devices while maintaining continuity of identity and state will require special attention on the server side. This is at tension with other forces that are pulling more of the application and data over toward the client side.

6. The global presence a cloud application can have permits a web client to connect to the nearest deployment or failover to an alternative deployment. The Windows Azure Traffic Manager can be used to automate both of those scenarios.

7. Web applications can retrieve content via a content delivery network to benefit from locale-based caching through a network of edge servers.

8. Cloud identity services can do the heavy lifting on identity, allowing a web application to easily support and federate a variety of domain or web identity providers. For example, Windows Azure’s Access Control Service has built-in support for Google, Yahoo!, and Windows Live ID.

9. Data stored in the cloud can be directly retrieved by the web client instead of routing through the web server if desired. To again use Windows Azure as an example, file-oriented data in Blob Storage can be accessed as Internet URLs with fine control over access permissions.

10. Cloud computing services often require different handling from on-premise intranet services including the need for retry policies. Web clients need sufficiently robust web service invocation.

11. The back end can be fractured. Some web applications have no need for a centralized back end in the traditional sense and instead access a series of services—potentially a combination of your application services, cloud platform services, and external services—with the client application controlling the overall context and workflow.

Here’s a diagram of a traditional web application. The web client side is thin, using HTML, CSS, and JavaScript and possibly some plug-ins and proprietary technologies including Silverlight. The web server or server farm uses a web server platform, ASP.NET on Windows Server in this case.

In contrast, the diagram below shows a modern version of the application that is using HTML5 on the front end and cloud computing (Windows Azure) on the back end. While the overall arrangement does not look terribly different, this application is light years ahead of the traditional one. The web client uses only open standards and can run on PC browsers as well as touch devices like tablets and phones. The server runs in one or more cloud data centers and boasts global presence, mammoth ability to scale, and high availability. A larger portion of the application is on the web client side. The web client consumes not only its own services but cloud platform services.

We’re not saying here that HTML5 and cloud computing must be mutually adopted, merely that HTML5 affects more than the front end and cloud computing affects more than the back end. When you do embrace both, however, you can create truly remarkable web experiences that run anywhere and everywhere.

In closing, we have seen that HTML5 and cloud computing are transforming web applications in a major way. The unfortunate tendency to think of these areas as being separate and unrelated belies the profound impact they are collectively having on web application design. Architects need to consider their web applications in totality and not fall into the trap of modernizing the front end or the back end without considering the inevitable impact on the rest of their solution. HTML5 and cloud computing are both revolutionizing the web. You don’t have to use them together, but there’s every reason to do so: Viva La Revolucion!

Next: When Worlds Collide #2: HTML5 + Cloud = Elasticity²