34,79 €
Microsoft's Azure platform has proved itself to be a highly scalable and highly available platform for enterprise applications. Despite a familiar development model, there is a difference between developing for Azure and moving applications and data into the cloud. You need to be aware of how to technically implement large-scale elastic applications. In this book, the authors develop an Azure application and discuss architectural considerations and important decision points for hosting an application on Azure.
This book is a fast-paced introduction to all the major features of Azure, with considerations for enterprise developers. It starts with an overview of cloud computing in general, followed by an overview of Microsoft's Azure platform, and covers Windows Azure, SQL Azure, and AppFabric, discussing them with the help of a case-study.
The book guides you through setting up the tools needed for Azure development, and outlines the sample application that will be built in the later chapters. Each subsequent chapter focuses on one aspect of the Azure platform—web roles, queue storage, SQL Azure, and so on—discussing the feature in greater detail and then providing a programming example by building parts of the sample application. Important architectural and security considerations are discussed with each Azure feature.
The authors cover topics that are important to enterprise development, such as transferring data from an on-premises database to SQL Azure using SSIS, securing an application using AppFabric access control, blob and table storage, and asynchronous messaging using Queue Storage. Readers will learn to leverage the use of queues and worker roles for the separation of responsibilities between web and worker roles, enabling linear scale out of an Azure application through the use of additional instances. A truly "elastic" application is one that can be scaled up or down quickly to match resources to demand as well as control costs; with the practices in this book you will achieve application elasticity.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 276
Veröffentlichungsjahr: 2010
Copyright © 2010 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2010
Production Reference: 1231110
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-849680-98-1
www.packtpub.com
Cover Image by Vinayak Chittar (<[email protected]> )
Authors
Richard J. Dudley
Nathan A. Duchene
Reviewers
Ruslan Konviser
Anton Staykov
Acquisition Editor
James Lumsden
Development Editor
Dhwani Devater
Technical Editor
Gaurav Datar
Indexer
Rekha Nair
Editorial Team Leader
Gagandeep Singh
Project Team Leader
Lata Basantani
Project Coordinator
Rebecca Sawant
Proofreader
Ting Baker
Graphics
Geetanjali Sawant
Production Coordinator
Shantanu Zagade
Cover Work
Shantanu Zagade
Richard J. Dudley has experience in the field of computers, going all way back to PC-DOS 1.1 (of which the original box still sits in a closet), with 128K and dual floppies. He began programming in GW-BASIC, and has used nearly every BASIC variant along the way. He was very active in the Louisville BBS community in the 1980s.
Richard holds a BS in Environmental Science from Allegheny College, and an MS in Biological Sciences from The University of Alabama. He developed his programming skills as a way to record and analyze his data, and later collaborate with other labs as the World Wide Web slowly came into being. Eventually, the dot com boom was too tempting, and Rich left science to be become a full-time developer. Rich spent 10 years as an Enterprise Developer, building and supporting everything from consumer websites to several mission-critical systems integrations, to Crystal-and SSRS-based BI tools, to a number of internal line-of-business applications.
Rich is now a Technology Evangelist for ComponentOne, where his job is to support the user community by working with all the latest Microsoft technologies.
Rich's past employers include The University of Alabama-Birmingham (Research Assistant V), The University of Pittsburgh (Research Specialist II), Spang & Co. (e-Commerce Developer), and Armada Supply Chain Solutions (Senior Application Developer).
You always see an author thank his or her family, and until you write a book, you can't really understand why. Writing a book is time consuming–you spend a lot of time looking out of a window watching the seasons pass by, wishing you were kayaking on the nearby lake, or going for a bike ride, or anything other than being inside staring at a glowing rectangle hoping the words start flowing soon. We've made almost one complete turn around the sun since we started this book, and it is the culmination of a great deal of work.
So, at the risk of sounding clichéd, I have to thank my wife Kathy, and daughter Anna Claire, who can now have her daddy back.
The impetus to write a technical book doesn't come from money–there's a small advance, and if you're really lucky, maybe some royalties. Fame? Not really–if you're popular, maybe a dozen people will tweet about you. The urge to write a book comes from something more fundamental, something our parents instilled in us and we try and instill in our children–sharing. Share your experiences, share what you know, as doing so builds a stronger community. I hope you find what we've done to be useful.
Nathan A. Duchene has been developing in the .NET Framework since 2005, starting with ASP.NET 2.0. He found a need for a website with the features available in ASP.NET, and with some guidance from Richard J. Dudley, quickly developed and published his web application to the world. After experiencing the ease and flexibility offered by .NET to developers, he decided to learn more features, best practices, and tricks to enhance his web application, build new web applications, write and maintain some console applications, and much more.
In 2008, Nathan and Richard developed and entered a web application into a coding contest, which was voted by the community as the second best of all submissions, losing only by a few votes. Winning an MSDN Premium subscription, it allowed Nathan to play with a number of systems and tools, strengthening his knowledge in the development world.
Nathan, along with Richard, was part of a group that gave a presentation on Silverlight 2 in the Windows Azure cloud in 2009. Both technologies were in beta or pre-beta phases, which caused unexpected issues. Even though the application would not work, the talk was a great success in explaining Windows Azure and Silverlight 2 before they were released to the world.
Nathan is currently an Application Developer for a supply chain solutions company based in Pittsburgh, PA. Along with some .NET development, he also develops and administers solutions using Microsoft SQL Server 2000/2005/2008, Microsoft Biztalk Server 2009, and Microsoft Office SharePoint Server 2007.
This is Nathan's first book and has been a tremendous experience from front to back. After being given the opportunity to pass on some knowledge back to the community, he hopes to have the opportunity in the future to write more books for the community. After observing how quickly technology changes, he feels it's important to release up-to-date information for others to make use of. While Nathan and Richard had to re-write numerous chapters along the way to include new features or changes to existing features, the experience was amazing.
I'd like to thank my family and friends for all the support throughout the book process. Not only did they support me, but the encouragement helped me through some rough times when I thought it to be a difficult task to be physically able to write the book with everything else going on at the time. Without my friends and family, I couldn't have made it through this journey. Most importantly, I'd also like to thank my co-author, Richard Dudley. He has been a colleague, a friend, and a mentor over the last eight years. He's shown me opportunities that no one else has and I'm really happy to have him around as a partner in everything we've done. Richard's enthusiasm to help me flourish personally and professionally has had the most meaning in my life recently, and I look forward to working side-by-side with him over the next decades.
Anton Staykov has over nine years of solid experience in developing dynamic software solutions (corporate web portals, rich media sites, e-commerce sites, internal software solutions covering specific business needs), using the latest technologies, including Microsoft .NET, MS SQL Server, PHP, MySQL. Currently he is Technical Evangelist for a world leader in the field of User Interface Development Tools and User Experience services. He is User Group Lead for Windows Azure User Group Bulgaria. Anton is an Engineer in Telecommunications and Master of Science in Internet Software Technologies.
You can visit his blog at: http://blogs.staykov.net/.
Microsoft's Azure platform is an exciting offering in the cloud services market space. Designed to compete with Google AppEngine and Amazon Web Services, Azure stresses a familiar development environment (primarily .NET, SQL Server, and Visual Studio) with a rich set of capabilities. In addition to using Windows Azure to host web applications and services, SQL Azure provides a relational database in the cloud, and Access Control can be utilized to integrate user accounts with identity providers. We can leverage our skills to build powerful applications on Azure with relative ease.
The aim of this book is to gain an understanding of the process, advantages, and challenges of building an application on Azure. We do this by providing in-depth discussion of the platform as we build a sample application.
Chapter 1, Introduction to Cloud Computing, provides an introduction to cloud computing and enterprise applications.
Chapter 2, The Nickel Tour of Azure, is an overview of the service offerings in the Microsoft Azure Platform.
Chapter 3, Setting Up for Development, shows us the tools required for developing applications for Azure and how to set up our development environments.
Chapter 4, Designing our Sample Application, provides the overview of the sample application that will be built throughout the rest of this book.
Chapter 5, Introduction to SQL Azure, provides an introduction to SQL Azure and discusses the differences between SQL Azure and SQL Server 2008. We also create the database objects for our sample application in this chapter.
Chapter 6, Azure Blob Storage, discusses the Blob Storage service and how to interact with blobs using either a .NET client library or REST services. We also create the containers and blobs for our sample application in this chapter.
Chapter 7, Azure Table Storage, discusses the Table Storage service and how to interact with tables using either a .NET client library or REST services.
Chapter 8, Queue Storage, speaks about the Queue Storage service and how to interact with queues using either a .NET client library or REST services. We also create the queues needed for our application in this chapter.
Chapter 9, Web Role, gives an overview of what a web role is, and some of the similarities and differences between a web role and a traditional web application. We also build the portal web role for our sample application in this chapter.
Chapter 10, Web Services and Azure, discusses WCF web services and provides an overview of building a web service. We also build the web service needed for our sample application.
Chapter 11, Worker Roles, speaks about worker roles and many of the functions they can perform. We also build the worker roles for our sample application in this chapter.
Chapter 12, Local Application for Updates, teaches us how to build a Windows Forms application that interacts with our web services.
Chapter 13, Azure AppFabric, provides an overview of the Azure AppFabric, and discusses the capabilities of Access Control and Service Bus. We also configure Access Control for our sample application.
Chapter 14, Azure Monitoring and Diagnostics, discusses the diagnostic monitoring services available in Microsoft Azure, along with how to enable these services in our sample application.
Chapter 15, Deploying to Windows Azure, teaches how to deploy our sample application to Windows Azure and how to change our application's configuration once it is deployed.
For this book, we need a PC running Windows XP or 7. We also need either Visual Studio 2008 or 2010, or if both are not available, we can go for Visual Web Developer 2010 Express Edition. SQL Server 2008 Express also needs to be installed. We need to install the Windows Azure Tools for Microsoft Visual Studio, and depending on the OS and Visual Studio used, there may be some additional hotfixes. A complete list of requirements can be found at http://msdn.microsoft.com/en-us/windowsazure/cc974146.aspx.
If you are a developer or architect who wants to build enterprise-level applications with Azure, but needs to understand more about Azure's capabilities first, this book is for you. As the examples are in .NET, the book will skew to MS-oriented developers. But a lot of what is discussed will be applicable to anyone wanting to work with Azure. No matter what language you use, you provision the application fabric the same way, and all the underlying concepts will be the same. You will need experience with Visual Studio, and some basic SQL Server knowledge.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "Because there are no keys to link tables together, the ADO.NET Data Services methods that deal with links are unavailable to use, including AddLink, DetachLink, and SetLink".
A block of code will be set as follows:
When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "The first setting we need to change is, setting the Script for database engine type option to the SQL Azure Database option, as seen in the following screenshot".
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code for this book
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books–maybe a mistake in the text or the code–we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
Cloud computing is a term that has risen to the top of application development discussions in a very short period of time. Amazon, Google, and Microsoft (among many others), all offer cloud-computing services and are not shy about touting its benefits. If you believe the marketing hype, cloud computing ranks somewhere between revolutionary and the second coming of your favorite prophet. But what exactly is cloud computing, and how does it play into the daily lives of enterprise developers? Let's now try and find some answers.
Before we hop into the cloud, let's talk about who this book is for. Who are "enterprise developers"? In the United States, over half of the economy is small businesses, usually privately owned, with a couple dozen of employees and revenues up to the millions of dollars. The applications that run these businesses have lower requirements because of smaller data volumes and a low number of application users. A single server may host several applications. Many of the business needs for these companies can be met with off-the-shelf software requiring little to no modification.
The minority of the United States economy is made up of huge publicly owned corporations–think Microsoft, Apple, McDonald's, Coca-Cola, Best Buy, and so on. These companies have thousands of employees and revenues in the billions of dollars. Because these companies are publicly owned, they are subject to tight regulatory scrutiny. The applications utilized by these companies must faithfully keep track of an immense amount of data to be utilized by hundreds or thousands of users, and must comply with all matters of regulations. The infrastructure for a single application may involve dozens of servers. A team of consultants is often retained to install and maintain the critical systems of a business, and there is often an ecosystem of internal applications built around the enterprise systems that are just as critical. These are the applications we consider to be "enterprise applications", and the people who develop and extend them are "enterprise developers". The high availability of cloud platforms makes them attractive for hosting these critical applications, and there are many options available to the enterprise developer. This books focuses on Microsoft's cloud development platform named Azure. Throughout this book, we'll develop a simple example application as an introduction to the different facets of Microsoft's Windows Azure platform, and we'll also discuss concepts useful to the enterprise developer, including security and costs, during the course of our application's development.
At its most basic, cloud computing is moving applications accessible from our internal network onto an internet (cloud)-accessible space. We're essentially renting virtual machines in someone else's data center, with the capabilities for immediate scale-out, failover, and data synchronization. In the past, having an Internet-accessible application meant we were building a website with a hosted database. Cloud computing changes that paradigm–our application could be a website, or it could be a client installed on a local PC accessing a common data store from anywhere in the world. The data store could be internal to our network or itself hosted in the cloud. The following diagram outlines three ways in which cloud computing can be utilized for an application. In option 1, both data and application have been hosted in the cloud, the second option is to host our application in the cloud and our data locally, and the third option is to host our data in the cloud and our application locally.
The expense (or cost) model is also very different. In our local network, we have to buy the hardware and software licenses, install and configure the servers, and finally we have to maintain them. All this counts in addition to building and maintaining the application! In cloud computing, the host usually handles all the installation, configuration, and maintenance of the servers, allowing us to focus mostly on the application. The direct costs of running our application in the cloud are only for each machine-hour of use and storage utilization.
The individual pieces of cloud computing have all been around for some time. Shared mainframes and supercomputers have for a long time billed the end users based on that user's resource consumption. Space for websites can be rented on a monthly basis. Providers offer specialized application hosting and, relatively recently, leased virtual machines have also become available. If there is anything revolutionary about cloud computing, then it is its ability to combine all the best features of these different components into a single affordable service offering.
Cloud computing sounds great so far, right? So, what are some of the tangible benefits of cloud computing? Does cloud computing merit all the attention? Let's have a look at some of the advantages:
At the top of the benefits list is probably the low up-front cost. With cloud computing, someone else is buying and installing the servers, switches, and firewalls, among other things. In addition to the hardware, software licenses and assurance plans are also expensive on the enterprise level, even with a purchasing agreement. In most cloud services, including Microsoft's Azure platform, we do not need to purchase separate licenses for operating systems or databases. In Azure, the costs include licenses for Windows Azure OS and SQL Azure. As a corollary, someone else is responsible for the maintenance and upkeep of the servers – no more tape backups that must be rotated and sent to off-site storage, no extensive strategies and lost weekends bringing servers up to the current release level, and no more counting the minutes until the early morning delivery of a hot swap fan to replace the one that burned out the previous afternoon.
Easier disaster recovery and storage management:With synchronized storage across multiple data centers, located in different regions in the same country or even in different countries, disaster recovery planning becomes significantly easier.
If capacity needs to be increased, it can be done quite easily by logging into a control panel and turning on an additional VM. It would be a rare instance indeed when our provider doesn't sell us additional capacity. When the need for capacity passes, we can simply turn off the VMs we no longer need and pay only for the uptime and storage utilization.
Simplified migration:Migration from a test to a production environment is greatly simplified. In Windows Azure, we can test an updated version of our application in a local sandbox environment. When we're ready to go live, we deploy our application to a staged environment in the cloud and, with a few mouse clicks in the control panel, we turn off the live virtual machine and activate the staging environment as the live machine – we barely miss a beat! The migration can be performed well in advance of the cut-over, so daytime migrations and midnight cut-overs can become routine. Should something go wrong, the environments can be easily reversed and the issues analyzed the following day.
Familiar environment:Finally, the environment we're working on is very familiar. In Azure's case, the environment can include the capabilities of IIS and .NET (or Java or PHP and Apache), with Windows and SQL Server or MySQL. One of the great features of Windows is that it can be configured in so many ways, and to an extent, Azure can also be configured in many ways, supporting a rich and familiar application environment.
Cloud computing sounds wonderful so far, but nothing is perfect. There are aspects of cloud computing that will involve compromising, and in some cases, may make cloud computing infeasible for a company; let's have a look at a few of those:
One of the biggest concerns is that we are no longer in control of our application environment. Giving up control over the maintenance of the firewalls, servers, and operating system can be troubling, especially for sensitive institutions such as health or banking. We are now storing data and our application in a publicly accessible space. There is the possibility of a data breach through some means other than our application. To address these two concerns, services and plans calling themselves "private clouds" are beginning to enter the marketplace. These private clouds will partition our space in a secure way from prying eyes but still allow us the level of access, uptime, and backup we desire from the cloud.
With someone else in control of the patch level of the operating system, testing against new updates becomes an ongoing process. None of us have ever had application issues resulting from a security update, right? The good news is, we can have snapshots of production environments, which can be used to test patches. This makes it significantly easier to have a test system that replicates production.
Higher costs:For many web-based applications, the costs for a cloud application are probably higher than standard shared hosting. Based on the pricing announced at PDC 2009, a simple website application with a single instance would cost around $100/month to host, compared to around $5-$20/month for standard shared hosting.
Difficulty with hosting:Finally, in most cases, hosting an application in the cloud is not as simple as just deploying to a remote server. For existing applications, there may be some significant changes, such as replacing local connection strings with a service-oriented architecture, or utilizing high-performance storage such as tables and blobs rather than file system storage. Hopefully, the rest of this book will help diminish any differences between a local and a cloud application.
Cloud computing requires more than just a server room, and the different providers employ different technologies. In all cases, cloud computing relies on data centers in multiple geographic locations, with multiple redundancies of everything. It's quite a challenge to locate an area that is geologically stable and relatively free from severe weather events or other natural disasters, making redundancies of locations, in addition to redundancies of utilities, a necessity.
Cloud data centers have moved away from the "racks-in-a-room" or "raised floor" design of traditional data centers. One of the more common designs for cloud data centers is to modify a shipping container to hold racks of servers, and then linking multiple containers together into a large center. The container-based design is used more for stability, space efficiency, and physical isolation of machines. A forty-foot tall rack of servers would be highly unstable and extremely difficult to manage. But a stack of four containers is very stable, and each container is as easy to manage as a small server room. It's also more efficient to cool a number of small rooms as compared to a giant warehouse.
For Azure, Microsoft has taken the container concept a little farther. Microsoft's Azure containers (called Generation 4 Modular Data Centers or G4MDC) are not based on a shipping container, although the end design resembles one. Technically, Microsoft's containers are classified as air handling units and the servers as heaters. Cooling is achieved by pulling outside air through filters, into the container, and around the servers at high velocity. In fact, some of Microsoft's new data centers won't even have roofs! Each G4MDC unit is completely self-contained with airflow regulation, and its own connections for power and bandwidth. Each 40-foot unit can accommodate up to 2,000 servers, and some of Microsoft's facilities will house 400,000 to 500,000 servers.
Usually, cloudy skies are a bad thing–many a day at the beach has been ruined by an abundance of clouds. But in the case of cloud computing, the more clouds, the better! The number of providers of cloud computing services is increasing, but for the enterprise developer, the three major options at the time of writing are from Google, Amazon, and Microsoft.
