Windows Azure Cloud Service
Name
Title
Organization
Session Objectives and Takeaways
Describe Windows Azure Cloud Service
Understand Model and Terminology
What is a Cloud Service?
A container of related service roles
Web Role Worker Role
Roles and Instances
Roles are defined in a At runtime each Role
Hosted Service will execute on one or
A role definition specifies: more instances
VM size
A role instance is a set of code,
Communication Endpoints
Local storage resources configuration, and local data, deployed
etc. in a dedicated VM
Roles and Instances
Example Hosted Service configuration with a single web role and a single worker role
HOSTED SERVICE
WEB ROLE WORKER ROLE
VM1 VM2 VM3 VM4 VM1 VM2 VM3 VM4
VM5 VM6 VM7 VM8 VM5 … VMn
VM9 … VMn
The High Scale Application Archetype
Windows Azure provides a ‘pay-as-you-go’ scale out application platform
Intelligent Network Load Balancer
Network Activation
Stateless Web and/or Application Servers
Stateless ‘Worker’ Machines
Async Activation
Key/Value Partitioned Shared
State Tier Queues
Datastores RDBMS Filesystem
Windows Azure SDKs and Tools
.Net Java
Visual Studio Tools Eclipse Tools
Client Libraries for .Net Client Libraries for Java
Node.js php
PowerShell Tools Command Line Tools
Node.js for Windows Client Libraries for php
IISNode
Client Libraries for Node.js
Windows Azure for .Net Developers
Visual Studio 2010/2012 Windows Azure SDK for .Net
Project Templates
Windows Server 2008, Windows 7 or
Model & Config Tooling
Windows 8
Package & 1 Click Deploy
SQL Express 2005+
Debugging Support
Storage Explorer .NET 3.5 SP1+
Server Explorer Development Fabric
IntelliTrace Support Development Storage
Profiling Support .NET APIs
Worker Role Patterns
Queue Polling Worker
Poll and Pop Messages within while(true) loop
E.g. Map/Reduce pattern, background image processing
Listening Worker Role
Create TcpListener or WCF Service Host
E.g. Run a .NET SMTP server or WCF Service
External Process Worker Role
OnStart or Run method executes Process.Start()
Startup Task installs or executes background/foreground process
Custom Role Entry Point (executable or .Net assembly)
E.g. Run a database server, web server, distributed cache
Web Role
All features of a worker role + IIS 7, 7.5 or IIS 8.0*
ASP.NET 3.5 SP1, 4.0 or 4.5* – 64bit
Hosts
Webforms or MVC
FastCGI applications (e.g. PHP)
Multiple Websites
Http(s)
Web/Worker Hybrid
Can optionally implement RoleEntryPoint *with Windows Server 2012
Understanding Packaging and Config
Windows Azure Services are described by two important artifacts:
Service Definition (*.csdef)
Service Configuration (*.cscfg)
Your code is zipped and packaged with definition (*.cspkg)
Encrypted(Zipped(Code + *.csdef)) == *.cspkg
Windows Azure consumes just (*.cspkg + *.cscfg)
Service Definition
Describes the shape of your
Windows Azure Service
Defines Roles, Ports, Certificates, Configuration Settings,
Startup Tasks, IIS Configuration, and more…
Can only be changed by upgrades
or new deployments
Service Definition
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="WebDeploy" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebUX">
<Startup>
<Task commandLine="..\Startup\EnableWebAdmin.cmd" executionContext="elevated" taskType="simple" />
</Startup>
<Imports>
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder"/>
</Imports>
<Sites>
<Site name="Web">
<Bindings>
<Binding name="HttpIn" endpointName="HttpIn"/>
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="HttpIn" protocol="http" port="80"/>
<InputEndpoint name="mgmtsvc" protocol="tcp" port="8172" localPort="8712"/>
</Endpoints>
Service Configuration
Supplies Runtime Values
(Scale, Config Settings, Certificates to use, VHD, etc.)
Can be updated any time through Portal or API
Service Configuration
<?xml version="1.0"?>
<ServiceConfiguration serviceName="WebDeploy" xmlns="http://schemas.microsoft.com/serviceHosting/2008/10ServiceConfiguration">
<Role name="Webux">
<Instances count="1"/>
<ConfigurationSettings>
<Setting name="DiagnosticsConnectionString" value="UseDevelopmentStorage=true/>
<Setting name="Microsoft.WindowsAzure.plugins.RemoteAccess.Enabled" value="True"/>
<Setting name="Microsoft.WindowsAzure.plugins.RemoteAccess.AccountUsername" value="dunnry"/>
<Setting name="Microsoft.WindowsAzure.plugins.RemoteAccess.AccountEncryptedPassword" value="MIIBrAYJKoZIhvcNAQcDoIIB"/>
<Setting name="Microsoft.WindowsAzure.plugins.RemoteAccess.AccountExpiration" value="2010-12-23T23:59:59.0000000-07"/>
<Setting name="Microsoft.Windows Azure.Plugins.RemoteForwarder.Enabled" value="True"/>
<ConfigurationSettings>
<Certificate>
<Certificates name="Microsoft.WindowsAzure.Plugins.remoteAccess.PasswordEncryption" thumbprint="D6BE55AC439FAC6CBEBAF"/>
</Certificate>
</Role>
</ServiceConfiguration>
VM Size in Windows Azure
Windows Azure
Supports Various VM Sizes
Size set on Role in Service Definition - All instances of role will be of equal size
Service can have multiple roles
Balance of Performance per node vs. High Availability from multiple nodes
Size CPU Cores CPU Speed RAM Local Storage Cost (USD)
Extra Small Shared 1.0 GHz 768M 20GB .02
Small 1 1.6 GHz 1.75GB 225GB .12
Medium 2 1.6 GHz 3.5GB 490GB .24
Large 4 1.6 GHz 7GB 1,000GB .48
Extra large 8 1.6 GHz 14GB 2,040GB .96
Choosing Your VM Size
Don’t just throw Scale out Some scenarios
big VMs at every architectures have will benefit from
problem natural parallelism more cores
Where moving data >$
parallel overhead
Test various More small E.g. Video processing,
Stateful services (DBMS)
configurations instances == more
under load redundancy
Local Storage
Role instances have available disk storage
Use LocalStorage element
in service definition
Name
CleanOnRoleRecycle
Size
Persistent but not guaranteed durable
Good for cached resources or temporary files
Windows Azure Storage Drives provide
guaranteed durable storage
Local Storage
DEFINE IN CONFIG
<LocalResources>
<LocalStoragename="myLocalDisk" sizeInMB="10"
cleanOnRoleRecycle="false" />
</LocalResources>
USE IN CODE
string rootPath = RoleEnvironment.GetLocalResource["myLocalDisk"].RootPath;
DirectoryInfo di = new DirectoryInfo(rootPath);
foreach(di.EnumerateFiles())
….
Upgrading Your Application
VIP Swap:
Uses Staging and Production environments
Allows to quickly swap environments
Production: v1 Staging: v2, after swap then Production: v2 Staging: v1
In-Place Upgrade
Performs a rolling upgrade on live service
Entire service or a single role
Manual or Automatic across update domains
Cannot change Service Model
VIP Swap
NETWORK LOAD BALANCER
ROLE
Staging
Production Staging
Production
VM1 VM2 VM1 VM2 PACKAG
E
VM3 VM4 VM3 VM4
Summary
Cloud Service is for multi-tier online services
Service model defines service shape
Service configuration defines service scale
Selectable VM Sizes
Upgrading and Deployment
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of
Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.