Upload
spiffy
View
3.820
Download
1
Embed Size (px)
DESCRIPTION
Citation preview
Deploying and Monitoring Windows Azure Application
Wely Lau ([email protected]) Microsoft MVP, Windows AzureSolutions Architect, NCSBlog : http://wely-lau.net
Wely Lau Windows Azure MVP / Solutions Architect, NCS Pte Ltd
Microsoft Cloud Day
Deploying and Monitoring Windows Azure Application
Wely is the first Windows Azure MVP in Southeast Asia.
In NCS, he focuses on Cloud Computing, specifically on Windows Azure Platform. Performing cloud consultancy,
architecting cloud solution, designing cloud framework, and delivering cloud training are his day-to-day activities.
This session learn how we can deploy application to Windows Azure , install program on Windows Azure, and how do we monitor our application on Windows Azure.
Agenda
• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task• Q & A
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• Contains metadata needed by the Windows Azure
environment to understand the requirements of your application.
• 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 Configuration• Sets values for the configuration settings defined in
the service definition file and specifies the number of instances to run for each role.
• Supplies Runtime Values (Scale, Config Settings, Certificates to use, VHD, etc.)
• Can be updated any time through Portal or API
Fault and Upgrade Domains• Fault Domains
– Represent groups of resources anticipated to fail together• i.e. Same rack, same server
– Fabric spreads instances across fault domains– Default of 2
• Upgrade Domains– Represents groups of resources that will be upgraded together– Specified by upgradeDomainCount in ServiceDefinition– Default of 5
• Fabric splits Upgrade Domains across Fault Domains and Across Roles
Fault and Upgrade Domains Visualized
Rack
Web Role
VM
VM
Worker Role
VM
VM
Fault Domain
Rack
Web Role
VM
VM
Worker Role
VM
VM
Fault Domain
U/G Domain #1
U/G Domain #2
U/G Domain #1
U/G Domain #2
Deployment Environments• Two Environments to choose from• Nearly Identical…
– <servicename>.cloudapp.net– <deploymentID>.cloudapp.net
• VIP Swap between them
Agenda
• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task• Q & A
Various Techniques Deploying to the Cloud
• Windows Azure Portal
• Visual Studio 2010
• Windows Azure Service Management Cmdlets
Windows Azure Portal• http://windows.azure.com• You must create an Azure account, then a service, and
then you deploy your code.• VS builds two files.– Encrypted package of your code– Your config file
Visual Studio• Deploy a management
certificate• Connect to your service account• Publish inside of VS2010• Easy integration with IntelliTrace
and Storage
Windows Azure Service Management Cmdlets
• Set of PowerShell cmdlets• http://archive.msdn.microsoft.com/azurecmdlets
• Wraps Management REST API and Diagnostics API• Enables building of sophisticated deployment scripts• Works with rest of .NET CLR
demo
Deploy through Visual Studio
Deploy through PowerShell
Agenda
• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task • Q & A
Upgrading Windows Azure Application• Deployment Consideration
– Downtime tolerance– VIP Address– Cost
• Various options– Delete & Recreate– In Place Upgrade– Web Deploy– VIP Swap– DNS Swap*
• Sometimes you MUST delete a deployment– Changes in endpoints, VM size, and binding– Try to minimize by specifying what you might need in advance
Hosted Service
Delete & Recreate• Down time between deployments• You can change almost everything in your app• 1 X your instance cost• New VIP
Deployment v1
Web RoleVM
Worker Role
VMVMVM
Deployment v2
Web Role Worker RoleVMVM
VMVM
In Place Upgrade
• Reuses existing VMs (Preserves VM state i.e. local cache data)
• Can update a single role• 1 X your instance cost• Cannot change the service definition– size, endpoints, roles, etc.
• Utilizing Upgrade Domain to avoid downtime
In Place Upgrade
Load Balancer:
Prod
Rack
Web Role
VM
VM
Worker Role
VM
VM
Rack
Web Role
VM
VM
Worker Role
VM
VM
#1
#2
#1
#2
Web Deploy• Newly built-in in SDK 1.4.1• Quickly push incremental changes• Caveats:– Only applicable for single instance
web role– Changes made will not be
persistence– Development and testing purpose,
not production!
Hosted Service
VIP swap • Easier to undo• Requires 2 identical environments• Cannot update endpoints• 2 X your instance cost• Happen very fast– Typically within 1 mins Deployment v1
Web RoleVM
Worker Role
Load Balancer:
Prod
Stage
VM
VMVM
Prod
Stage Deployment v2
Web RoleVM
Worker Role
VMVMVM
Hosted Service (bar.cloudapp.net)
Hosted Service (foo.cloudapp.net)
DNS Swap• Use DNS as another layer of abstraction• Requires your own domain name• 2 X your instance cost• Updating the domain record is not immediate• New VIP
Deployment
Web Role
VMWorker Role
VM
VM
VM
DNS:whatever.com
Deployment
Web Role
VMWorker Role
VM
VM
VM
demo
Web Deploy
VIP Swap
Agenda
• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task• Q & A
Diagnostic: Common Task & Challenges
• Common Diagnostic Task• Performance measurement • Troubleshooting and debugging • Capacity planning• Traffic analysis (users, views, peak times)• Billing & Auditing
• Challenges in the Cloud• Many instances• Local storage is not persistence• They move around• Massive amount of data• Can’t remote desktop in
• now you can do it with SDK >= 1.3
Windows Azure Diagnostic API
• Collects diagnostic data from your instances and copies it to a storage account• IIS Logs, Crash Dumps, FREB Logs• Arbitrary log files• Performance Counters• Event Logs• Debug/Trace statements• Infrastructure events
• MonAgentHost.exe is started automatically by default.• Listener wired up in app/web.config• Need to define a storage account connection string
How does it work? Role Instance Starts Diagnostic Monitor Starts Monitor is configured
Imperatively at Start time Remotely any time
Monitor buffers data locally User can set a quota (FIFO)
User initiates transfer to storage Scheduled or On Demand
Where to store?
Role
Role Instance
Diagnostic Monitor
Local directory storage
Data Source Default DestinationTrace Logs Enabled Azure TableDiagnostic Infrastructure Logs Enabled Azure Table
IIS Logs Enabled Blob
Performance Counters Disabled Azure Table
Windows Event Logs Disabled Azure Table
IIS Failed Request Logs Disabled Blob
Crash Dumps Disabled Blob
Sample Results
Visualizing the data
Diagnostics Considerations• Volume of Data Storage– Standard costs apply for transactions, storage &
bandwidth• Reaction Time• $ Cost
Monitoring 5 Performance Counters every 5 seconds for 100 instances costs > $260 US dollar per month
Remote Desktop
Remote Desktop
LBIN_0
IN_0
IN_1
IN_2
IN_1
Remote Forwarder
Port 3389
Internal Port 3389
Role 1 Role 2
demo
Remote Desktop to Windows Azure
Installing Program on Windows Azure
Agenda
• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task• Q & A
Windows Azure Startup Tasks• Includes scripts that automate the preparation and
configuration of roles • Scenarios: Perform short, unattended setups on role startup.
E.g.• COM Component• Registry Key• Configuring a Windows Server Role, such as IIS• Installation
start /w pkgmgr /iu:IIS-ASP
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-}" /v "IsInstalled" /t REG_DWORD /d 0 /f
winrar-x64-40b7.exe /s
Startup.cmd
Windows Azure Startup Tasks
<WebRole name="foo"> <Startup> <Task commandline="relative\path\ToSetupExecutable" executionContext="limited|elevated" taskType="simple|foreground|background"/> </Startup></WebRole>
Task Types:• Simple [Default] – System waits for the task to exit before any
other tasks are launched• Background – System does not wait for the task to exit• Foreground – Similar to background, except role is not restarted
until all foreground tasks exit
demo
Installing through Start-up Task
Resources
• Windows Azure Platform Training Course• http://msdn.microsoft.com/en-us/wazplatformtrainingcourse.aspx
• Building, deploying, and managing Windows Azure Applications• http://channel9.msdn.com/Events/PDC/PDC10/CS03
• Deploying, Troubleshooting, Managing and Monitoring Applications on Windows Azure• http://www.msteched.com/2010/Europe/COS324
• Windows Azure CmdLet• http://archive.msdn.microsoft.com/azurecmdlets
• Remote Desktop to Windows Azure• http://tinyurl.com/azure-remote-desktop
• Custom Domain Name in Windows Azure• http://tinyurl.com/azure-custom-domain
Q & A
Any questions?
Thank you!
Wely Lau ([email protected]) Microsoft MVP, Windows AzureSolutions Architect, NCSBlog : http://wely-lau.net