Reaching the Cloud: App Dev from the Ground Up
Still rooted to traditional dev models? Learning the skills and processes to span on-premises and cloud scenarios is fundamental for Visual Studio developers in 2010.
Starting this month, .NET apps and their components can live and access resources in a spectrum of servers and services that spans on-premises to the cloud.
"Windows Azure at its core is Windows," asserted Microsoft's Chief Software Architect Ray Ozzie, during a keynote at the Microsoft Professional Developers Conference 2009 (PDC09) in November, when the Windows Azure cloud-computing platform and SQL Azure relational data storage were officially launched. "It's Windows Server. You should think of it as a vast, homogeneous array of Windows Server hardware and virtualized Windows Server instances, and all these servers are under the control of a sophisticated, highly parallel management system called the Azure Fabric Controller, which you can kind of think of as an extension of System Center's management capabilities in the enterprise," he explained.
"With Windows Azure, Windows Server and System Center, there's one coherent model of managing this infrastructure as a service across Microsoft's public cloud to private cloud to clouds of our partners who host," Ozzie said. He went on to describe Windows Azure for developers as a "model-based extension to Visual Studio" that enables coders to use their existing skills in SQL, IIS, ASP.NET and .NET.
With Microsoft's cloud-computing platform available for production use Jan. 1 -- billing starts in February -- many developers will be asked to explore the opportunities afforded by running apps or components in cloud scenarios.
Spectrum of Possibilities
Yousef Khalidi, a distinguished engineer on the Windows Azure team at Microsoft, highlighted what he called "the spectrum of possibilities" during his PDC09 session, "Bridging the Gap from On -- Premises to the Cloud." With the advent of cloud computing, apps can reside in traditional or virtualized data centers, and private or public (dedicated or multi-tenant) clouds.
"There are plenty of choices across the whole spectrum and we'll continue to support the whole spectrum," said Khalidi. "Moreover, there will always be some data [or] an application set that has to live in a certain part of the spectrum-for example, under lock and key inside of a data center because of regulations, compliance or national laws."
Microsoft has not publicly offered a definitive strategy for private clouds. However, several announcements at PDC09 indicate the company may be headed in that direction.
At PDC09, Microsoft continued to advocate the use of a consistent, next-generation app model across the different environments. "Regardless of location, regardless of where you want to put the thing, the application should fit in a cloud application model," advised Khalidi.
With the cloud app model, he explained, "you have a way to have dynamic, scalable, virtualized resources that can be provided as a service technically over a network connection over the Internet."
Bob Muglia, president of the Server and Tools Business at Microsoft, peppered the audience during his PDC09 keynote with attributes characterizing Microsoft's view of the cloud app model: scale out, service oriented, model driven, self service (no human intervention), always available, multi-tenant, federated and failure resistant. Windows Identity Foundation -- the developer component of the Geneva Framework, which is part of the tooling for building claims-based identity systems -- was released at PDC09.
"News from the PDC was about consolidation, rather than about bold new announcements," says Vishwas Lele, chief technology officer at Applied Information Sciences Inc. "The Windows Azure team heard the feedback from the community and the early adopters and made adjustments accordingly."
Noteworthy among the PDC09 announcements, according to Lele: "The VM [virtual machine]-like support; ability to choose between different classes of Windows Azure instances, i.e. two or four cores; Project Dallas, [which enables] access to a reference data from a collection of providers; and some new Windows Azure storage features including snapshot and CDN [Content Delivery Network]."
The new VM support, expected to become available this year, enables developers to configure their own images and maintain administrative rights.
"So what we'll have in the Windows Azure environment is a set of pre-defined Windows Server images, which have different infrastructures on [them], different versions of .NET and things like that loaded on [them]," explained Muglia during his PDC09 keynote. "And then you'll be able to grab one of those images, mount it and remote desktop into it. You'll have full administrative access to that image, and be able to load whatever software you want on that image, take a virtual machine snapshot of it, and then store it away for future use. And those images become available to you to use as a part of your application infrastructure just as you'd use a standard deploy Windows Azure image."
This type of support is critical for companies that want to migrate existing software configurations to the cloud. Amazon Web Services LLC offers a similar service for Windows Server instances in its Elastic Compute Cloud (EC2).
Move Apps Forward
While VM support will make it easier for developers to move existing configurations to the cloud, the more common scenario for early Windows Azure adopters will be to port ASP.NET apps and their components in an effort to scale out their Web applications. The Windows Azure simulation environment, which consists of a Developer Fabric and Developer Storage, uses IIS7 under the hood to run cloud apps locally.
Jim Nakashima, a Microsoft program manager on the Cloud Tools team, recommends that people start cloud projects by downloading the Web Platform Installer 2.0, which installs the Windows Azure Tools for VS2008, the Windows Azure SDK, IIS7 and dependencies, and SQL Express 2008, if needed. The next step is to get all the patches, particularly those relevant to Windows Communication Foundation (WCF). WCF handles metadata differently in Windows Azure, which necessitates a workaround.
Windows Azure at launch uses .NET 3.5 SP1, and requires developers to install Windows Azure Tools for Visual Studio 2008 or VS2010. The VS2010 beta 2, released in November, provides support for ASP.NET Model-View-Controller (MVC) 2 and F#. The upcoming .NET Framework 4, expected to ship alongside the VS2010 released to manufacturing (RTM) on March 22, is currently in beta, and not supported in Windows Azure or the Windows Azure dev fabric.
A cloud app is built in VS2010 beta 2 by selecting VB or C#, then the Cloud Service node, and clicking on the "Enable Windows Azure Tools" project template. After naming the project, developers can use Web roles (ASP.NET Web app), worker roles (background processing), WCF Service Web Role and CGI Web Role, and, in VS2010, ASP.NET MVC 2 Web Role or F# Worker Role. The cloud app consists of a VM instance for each role instance, service definitions and config files. You can set the configuration for a WebRole by number of instances, VM size, .NET Trust level (full trust or Windows Azure partial trust) and end points (HTTP or HTTPS). Although you can develop locally on 32-bit machines, Windows Azure roles are based on 64-bit processes running on Windows Server 2008.
"A few things are happening under the hood that you might not even think about when I hit F5," said Nakashima, who gave a session at PDC09 entitled "Tips and Tricks for Using Visual Studio 2010 for Building Applications that Run on Windows Azure." "One, we build all your binaries, and then we package them into a format that's specific to Windows Azure, and then we run our development simulation," he explained.
The dev fabric is dynamic. Developers should note that ports are also dynamic in Windows Azure and may change unexpectedly.
Nakashima pointed out the three main differences between an ASP.NET Web app in VS and the ASP.NET Web role running on Windows Azure, but said that these changes, already made by Microsoft, are not always required:
- References added to three libraries (diagnostics, service runtime, storage client)
- Web role .CS file (boilerplate template code for standard default behavior, such as setting up the diagnostic/logging system or to recycle the role when a configuration change occurs)
- Web config file (inject a system diagnostics trace to debug classes)
"For the most part, WCF and ASP.NET, those things all just work on Windows Azure," he said. "We're leveraging IIS under the hood and you're actually running on IIS under the hood. So that's one of the key design points of Windows Azure: You can use tools and the knowledge that you have today developing Microsoft technologies and use those in the cloud. So the development model is very familiar to you."
A notable exception is the way that WCF gets at metadata, which is why it's important to download the patches.
Migrate Data First
Nakashima recommended that developers migrate data first to Windows Azure Storage or SQL Azure and make sure that it's running as expected. Windows Azure Storage, part of the cloud OS, is based on binary large objects (BLOBS), tables and queues. It's a non-relational model designed to support large-scale apps. SQL Azure is a relational database in the cloud, which currently limits storage capacity to 10GB.
To debug your cloud data storage, you can add instances locally that run against production data. Using standard VS debugging, you can debug across instances and across roles.
"You beat on that from a local instance of your app. You just switch the app to use remote data," says Roger Jennings, a developer and author of the OakLeaf Systems blog and "Cloud Computing with the Windows Azure Platform" (Wrox, 2009). However, serious latency may be an issue. "You'll get much better performance when you get both the app and data running in the cloud," he explains. Jennings advises developers to keep computation close to the data whether running locally, on-premises or in the cloud.
SQL Azure is a SQL Server 2008 cluster that maintains an original and two replicas in the same data center. Initially, geo-replication of storage instances will be handled in regional pairs. At press time, only Microsoft's North American data centers -- San Antonio and Chicago -- were operational. The European facilities in Dublin, Ireland-launched on July 1, 2009 -- and Amsterdam, The Netherlands, and the Asian facilities in Singapore and Hong Kong are expected to come online this year.
"A lot of questions weren't really answered at PDC09," says Jennings. "People are going to want to see what the performance implementations of geo-location will be. For example, if you want to keep some of your replicas in Ireland and the original data in San Antonio so you avoid being subject to natural disasters -- how is that going to affect your app's performance?"
He's also frustrated that Microsoft hasn't put forth a timeline for increasing the 10GB limit in SQL Azure. Microsoft has indicated that the storage capacity will increase -- and reasonable failover performance is the reason for the current limit -- but it's not clear when the limit will be lifted and what it will cost, according to Jennings.
"The other issue," he says, "is encryption." Microsoft has "gone silent" on Transparent Data Encryption, which is required to comply with the Health Insurance Portability and Accountability Act.
While you can use VS2008 and SQL Server 2008 Management Studio with SQL Azure, neither tool displays SQL Azure objects. "You can generate a connection string and send SQL commands to it," says Jennings. The VS2010 RTM will enable Server Explorer to work against SQL Azure, according to Microsoft. SQL Server Management Studio 2008 R2, including the Express version's Object Explorer, will also display SQL Azure objects. SQL Azure works against other tools such as T-SQL stored procedures, ADO.NET, ODBC, PHP, JDBC and even Excel.
When you're getting ready to deploy your cloud app, it's important to note that the cloud service package only includes .NET 3.1 SP1, so you need to make sure that you address any other dependencies, Nakashima cautioned. Select Create Service Package (.CSPKG) and Service Config File (.CSCFG) and Publish to the Windows Azure Developer Portal. The IIS Web Deployment Tool 2010 is integrated in VS2010, so that you can publish an app to the staging environment with one click.
Target Components to the Cloud
In addition to understanding a new app model, developers need to decide where apps and their components are going to live.
Microsoft is working on supporting symmetry between the cloud and on-premises over time, said Khalidi. An early example is SQL Server and SQL Azure. SQL Azure Data Sync enables developers to update data so that it's identical between on-premises apps and cloud services.
Kelley Blue Book Co. Inc., a company that Microsoft worked with during the Windows Azure beta program, replaced one of two co-located data centers for its Web site, KBB.com, with Windows Azure and SQL Azure, while running the same .NET application in its on-premises data center with SQL Server on the back-end. The developers set up synchronization in SQL Server Management Studio because the data needs to remain identical between the on-premises applications and the cloud services.
Kelley Blue Book's Director of Enterprise Architecture Andy Lapin, who was onstage during the PDC09 keynote, said: "First, we didn't have to rewrite a lot of code, and we can still maintain a single code base. Second, we can manage our primary data center based on an average load, knowing that we can leverage the cloud in Windows Azure for additional capacity and failover, and only pay for what we use."
When moving sophisticated apps or targeting components to the cloud, developers need to think about topology, cloud readiness, connectivity and management. During his PDC09 session, Microsoft's Khalidi advised:
- Examine app, components and communication paths
- Make the code cloud-ready
- Connect components based on topology
- Be careful with latency and communication boundaries
- Be aware of security and regulations
New Breed of Apps
The vision outlined at PDC09 points to a new breed of apps that span from on-premises to the cloud. The Windows Server AppFabric, released in beta 1 at PDC09, is on-premises technology that extends the Windows Server 2008 IIS management console to support middle-tier services. These services can range from database caching (formerly code-named "Velocity") to workflow and messaging communications (Dublin).
The Windows Azure AppFabric, announced at PDC09 and expected in beta this year, replaces the .NET Services component of the Windows Azure platform, which had gone through multiple iterations since PDC2008. It now provides Access Control Services and an AppFabric Service Bus.
"What AppFabric will do is, it will take and extend the environment that you're very familiar with, with IIS, and provide you with a platform for building scale-out, highly available, middle-tier services such as WCF-based services and Windows Workflow-based services," explained Muglia, when the technology was announced. "And the idea is that this creates an infrastructure, a very easy-to-manage infrastructure where we'll do that failover for you; we'll keep the system highly available, and we'll do balancing between these things so you can build your applications in a straightforward way."
Another new technology at PDC09 designed to facilitate the on-premises and cloud model is called "Project Sydney." According to Muglia, Project Sydney is a "connectivity agent" designed to connect servers inside a corporate data center with Windows Azure services. Expected in beta this year, it will provide a secure connection and low-level network access-ITV6 for point-to-point connection and IPsec for security-between on-premises Windows servers and Azure Services. "Our focus is to make it as easy as possible for you to connect the applications that you're running within your own environment-because you're going to keep doing that for many years-with new applications and parts of applications that you run in the public cloud environment. This is just one of the ways we're doing that," said Muglia.
On the administrative front, Microsoft System Center is at the bottom of the entire Windows stack, according to Muglia: "It will provide over time the ability to connect and manage across these two different environments."
Next-Gen Web Development
Many pundits have already declared 2010 the year of the cloud. As Office Web apps debut alongside Microsoft Office in 2010 and Google Inc. readies the Web-based Chrome OS, Microsoft needs to convince developers that it offers a viable Web solution.WordPress, the popular blogging system developed by Matt Mullenweg, founder of Automattic Inc., was showcased during the PDC keynote to demonstrate Windows Azure running with Apache, MySQL and PHP.
"Growing support for PHP, Java, and MySQL goes to show that Windows Azure is being targeted as a broad, open cloud platform," says Lele. "But PDC09 was missing discussion on some of the pieces that were part of the Windows Azure architecture announced at PDC2008. For instance, SharePoint Online, CRM Online and their relationship to the Windows Azure layer."
In December, Microsoft announced an internal reorganization that combined the Windows Azure and the Windows Server and Solutions Groups into a new Server and Cloud division as part of the Server and Tools Business, headed by Muglia.
"Putting it in with server products is appropriate and better than a separate entity. This is because one of the assets that Microsoft has in the cloud is the ability to weave the strengths of its current on-premises product-line into the nascent Windows Azure and create an integrated strategy-and this strategy can potentially differentiate Microsoft from pure-play cloud entrants," says Al Hilwa, program director, Application Development Software, IDC.
"From an application-development perspective, it's a transition probably on the scale of the shift to .NET," he adds. "Microsoft executed quite effectively, pulling most of its developers with it with .NET and even enlarging and strengthening the franchise." With Windows Azure, the company has to execute as well, if not better, Hilwa predicts. "It's a much more competitive environment now, and Microsoft is in a different position vis-a-vis architectural trends, such as the shift to Web and mobile platforms," he explains.
".NET developers will want to use Windows Azure," Jennings notes, but management will require that dev teams look at other offerings from Amazon Web Services, IBM Corp. and even Fujitsu, which announced its intentions to offer cloud enterprise solutions in Q1. Companies need to be very careful about picking a vendor. Jennings also urges developers to learn how to test scalability in the cloud. Soasta Inc. is among the companies advancing technology in this area with its Cloud Test product. Jennings' advice: Be careful.
"Cloud data storage and cloud programming is good for a limited range of applications, and developers are going to have to be very careful about what they put in the cloud," he says. "If you have applications that are suited to cloud-based virtualization and you can save money, then you better learn how to do it. But you have to have a pretty good size data center to be able to get significant savings by moving from conventional hardware virtualization to cloud-based virtualization."
He also advises starting with Windows Azure and waiting for more direction in 2010 on Microsoft's on-premises implementation. "If you want to write code, you can only write code to Windows Azure and SQL Azure," Jennings concludes. "The other thing that's significant is the promise of this stuff, and Muglia is good at delivering on what he promises."