41
Deploying and Monitoring Windows Azure Application Wely Lau ([email protected] ) Microsoft MVP, Windows Azure Solutions Architect, NCS Blog : http://wely-lau.net

MS Cloud Day - Deploying and monitoring windows azure applications

  • Upload
    spiffy

  • View
    3.820

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: MS Cloud Day - Deploying and monitoring windows azure applications

Deploying and Monitoring Windows Azure Application

Wely Lau ([email protected]) Microsoft MVP, Windows AzureSolutions Architect, NCSBlog : http://wely-lau.net

Page 2: MS Cloud Day - Deploying and monitoring windows azure applications

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.

Page 3: MS Cloud Day - Deploying and monitoring windows azure applications

Agenda

• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task• Q & A

Page 4: MS Cloud Day - Deploying and monitoring windows azure applications

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)

Page 5: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 6: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 7: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 8: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 9: MS Cloud Day - Deploying and monitoring windows azure applications

Deployment Environments• Two Environments to choose from• Nearly Identical…

– <servicename>.cloudapp.net– <deploymentID>.cloudapp.net

• VIP Swap between them

Page 10: MS Cloud Day - Deploying and monitoring windows azure applications

Agenda

• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task• Q & A

Page 11: MS Cloud Day - Deploying and monitoring windows azure applications

Various Techniques Deploying to the Cloud

• Windows Azure Portal

• Visual Studio 2010

• Windows Azure Service Management Cmdlets

Page 12: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 13: MS Cloud Day - Deploying and monitoring windows azure applications

Visual Studio• Deploy a management

certificate• Connect to your service account• Publish inside of VS2010• Easy integration with IntelliTrace

and Storage

Page 14: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 15: MS Cloud Day - Deploying and monitoring windows azure applications

demo

Deploy through Visual Studio

Deploy through PowerShell

Page 16: MS Cloud Day - Deploying and monitoring windows azure applications

Agenda

• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task • Q & A

Page 17: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 18: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 19: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 20: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 21: MS Cloud Day - Deploying and monitoring windows azure applications

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!

Page 22: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 23: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 24: MS Cloud Day - Deploying and monitoring windows azure applications

demo

Web Deploy

VIP Swap

Page 25: MS Cloud Day - Deploying and monitoring windows azure applications

Agenda

• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task• Q & A

Page 26: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 27: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 28: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 29: MS Cloud Day - Deploying and monitoring windows azure applications

Sample Results

Page 30: MS Cloud Day - Deploying and monitoring windows azure applications

Visualizing the data

Page 31: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 32: MS Cloud Day - Deploying and monitoring windows azure applications

Remote Desktop

Page 33: MS Cloud Day - Deploying and monitoring windows azure applications

Remote Desktop

LBIN_0

IN_0

IN_1

IN_2

IN_1

Remote Forwarder

Port 3389

Internal Port 3389

Role 1 Role 2

Page 34: MS Cloud Day - Deploying and monitoring windows azure applications

demo

Remote Desktop to Windows Azure

Installing Program on Windows Azure

Page 35: MS Cloud Day - Deploying and monitoring windows azure applications

Agenda

• Basic Concept• Deploying • Upgrading • Monitoring • Start-up Task• Q & A

Page 36: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 37: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 38: MS Cloud Day - Deploying and monitoring windows azure applications

demo

Installing through Start-up Task

Page 39: MS Cloud Day - Deploying and monitoring windows azure applications

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

Page 40: MS Cloud Day - Deploying and monitoring windows azure applications

Q & A

Any questions?

Page 41: MS Cloud Day - Deploying and monitoring windows azure applications

Thank you!

Wely Lau ([email protected]) Microsoft MVP, Windows AzureSolutions Architect, NCSBlog : http://wely-lau.net