Отладка Windows Azure приложений. Сбор диагностических...

26
Отладка Windows Azure приложений. Сбор диагностических данных. Сергей Байдачный [email protected] Специалист по разработке ПО Майкрософт Украина Тема 5

description

Тема 5. Отладка Windows Azure приложений. Сбор диагностических данных. Сергей Байдачный [email protected] Специалист по разработке ПО Майкрософт Украина. Diagnostics: Single Server vs. the Cloud. Single Server. Cloud. Dynamic Environment Multi-instance, elastic capacity - PowerPoint PPT Presentation

Transcript of Отладка Windows Azure приложений. Сбор диагностических...

Page 1: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Отладка Windows Azure приложений. Сбор диагностических данных.Сергей Байдачный[email protected]Специалист по разработке ПОМайкрософт Украина

Тема 5

Page 2: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Diagnostics: Single Server vs. the CloudSingle Server

Static EnvironmentSingle well-known instanceTraceable local transactions

Local Access FeasibleAll in one TS sessionData & tools co-locatedIn-Place Changes

CloudDynamic Environment

Multi-instance, elastic capacityDistributed transactions

Local Access InfeasibleMany nodesDistributed, scaled-out dataService Upgrades

Page 3: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Windows Azure DiagnosticsSDK component providing distributed monitoring & data collection for cloud appsSupport Standard Diagnostics APIsCloud-Friendly

Manage multiple role instances centrallyScalable

Built on Windows Azure Storage & used by scale-out Windows Azure platform components

Developer In ControlWhat to collect & when to collect it

Page 4: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Demo

Page 5: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Windows Azure Diagnostics

Role

Role Instance

Diagnostic Monitor

Configuration

Quota enforcement

Local directory storage

Data collection

(traces, logs, crash dumps)

Windows Data

SourcesIIS Logs & Failed Request

LogsPerf Counters

Windows Event Logs

Page 6: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Windows Azure Diagnostics

Role

Role Instance

Diagnostic Monitor

Local directory storage

Request upload

Windows Azure Storage

Scheduled or on-demand upload

Windows Data

Sources

Page 7: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Windows Azure Diagnostics

Windows AzureHosted Service

DevelopmentFabric

Page 8: Отладка  Windows Azure  приложений. Сбор диагностических данных.

DevelopmentFabric

Windows Azure Diagnostics

Windows AzureHosted Service

Controller Code

Desktop Diag ApplicationDiagnosti

c Manager

Configure

Page 9: Отладка  Windows Azure  приложений. Сбор диагностических данных.

HOW-TO

Activate Windows Azure DiagnosticsGenerate DataEnable Local BufferingTransfer to Windows Azure Storage

Page 10: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Sample: Activate WA Diagnostics

// This is done for you automatically by // Windows Azure Tools for Visual Studio

// Add a reference to Microsoft.WindowsAzure.Diagnosticsusing Microsoft.WindowsAzure.Diagnostics; // Activate diagnostics in the role's OnStart() methodpublic override bool OnStart(){ // Use the connection string contained in the // application configuration setting named // "DiagnosticsConnectionString” // If the value of this setting is // "UseDevelopmentStorage=true" then will use dev stg DiagnosticMonitor.Start("DiagnosticsConnectionString"); ...}

Page 11: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Sample: Web.Config Changes

<!– This is automatically inserted by VS. The listener routes System.Diagnostics.Trace messages to Windows Azure Diagnostics.--><system.diagnostics> <trace> <listeners> <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics"> <filter type="" /> </add> </listeners> </trace></system.diagnostics>

Page 12: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Sample: Generate Diagnostics Data

string myRoleInstanceName = RoleEnvironment.CurrentRoleInstance.Id;

// Trace with standard .Net tracing APIsSystem.Diagnostics.Trace.TraceInformation( "Informational trace from " + myRoleInstanceName); // Capture full crash dumpsCrashDumps.EnableCollection(true);// Capture mini crash dumpsCrashDumps.EnableCollection(false);

Page 13: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Sample: Enable Local Data Buffering

// Managed traces, IIS logs, failed request logs, // crashdumps and WA diags internal logs are buffered // in local storage by default. Other data sources must be // added explicitlyDiagnosticMonitorConfiguration diagConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();

// Add performance counter monitoringPerformanceCounterConfiguration procTimeConfig = new PerformanceCounterConfiguration();

// Run typeperf.exe /q to query for counter namesprocTimeConfig.CounterSpecifier = @"\Processor(*)\% Processor Time";procTimeConfig.SampleRate = System.TimeSpan.FromSeconds(1.0);

diagConfig.PerformanceCounters.DataSources.Add(procTimeConfig);

// Continued on next slide...

Page 14: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Sample: Enable Local Data Buffering

// Continued from previous slide... // Add event collection from the Windows Event Log// Syntax: <Channel>!<xpath query> // http://msdn.microsoft.com/en-us/library/dd996910(VS.85).aspx diagConfig.WindowsEventLog.DataSources.Add("System!*");

// Restart diagnostics with this custom local buffering // configurationDiagnosticMonitor.Start( "DiagnosticsConnectionString", diagConfig);

Page 15: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Sample: Web.Config Changes<!-- You can optionally enable IIS failed request tracing. This has some performance overhead A service upgrade is required to toggle this setting.--><system.webServer> <tracing> <traceFailedRequests> <add path="*"> <traceAreas> <add provider="ASP" verbosity="Verbose" /> <add provider="ASPNET" areas="Infrastructure,Module,Page,AppService" verbosity="Verbose" /> <add provider="ISAPI Extension" verbosity="Verbose"/> <add provider="WWW Server" verbosity="Verbose"/> </traceAreas> <failureDefinitions statusCodes="200-599"/> </add> </traceFailedRequests> </tracing></system.webServer>

Page 16: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Sample: Scheduled Data Transfer

// Start off with the default initial configurationDiagnosticMonitorConfiguration dc = DiagnosticMonitor.GetDefaultInitialConfiguration();

dc.WindowsEventLog.DataSources.Add("Application!*");

dc.WindowsEventLog.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(5.0);

DiagnosticMonitor.Start("DiagnosticsConnectionString", dc);

Page 17: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Sample: On-Demand Data Transfer// On-Demand transfer of buffered files.// This code can live in the role, or on the desktop,// or even in another service.var ddm = new DeploymentDiagnosticManager( storageAccount, deploymentID);var ridm = ddm.GetRoleInstanceDiagnosticManager( roleName, roleInstanceName);var dataBuffersToTransfer = DataBufferName.Logs;OnDemandTransferOptions transferOptions = new OnDemandTransferOptions();transferOptions.From = DateTime.MinValue;transferOptions.To = DateTime.UtcNow;transferOptions.LogLevelFilter = LogLevel.Critical;Guid requestID = ridm.BeginOnDemandTransfer( dataBuffersToTransfer, transferOptions);

Page 18: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Storage ConsiderationsStandard WA Storage costs apply for transactions, storage & bandwidthData Retention

Local buffers are aged out by the Diagnostic Monitor according to configurable quotasYou control data retention for data in table/blob storage

Query Performance on Tabular DataPartitioned by high-order bits of the tick countQuery by time is efficientFilter by verbosity level at transfer time

Page 19: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Feature SummaryLocal data buffering

Configurable trace, perf counter, Windows event log, IIS log & file bufferingLocal buffer quota managementQuery & modify config from the cloud or from the desktop per role instance

Transfer to WA StorageScheduled & on-demandFilter by data type, verbosity & time rangeTransfer completion notificationQuery & modify from the cloud and from the desktop per role instance

Data SourceDefault Configuration How to Configure Format

Trace logsEnabled, stored locally

Diag API, Trace listener Table

Performance Counters Disabled Diag API TableWindows Event Logs Disabled Diag API Table

Infrastructure LogsEnabled, stored locally Diag API Table

IIS LogsEnabled, stored locally Diag API, Web.config Blob

IIS Failed Request Logs Disabled Diag API, Web.config BlobApplication Crash Dumps Disabled Diag API, Crash API BlobArbitrary Logs & Files Disabled Diag API Blob

> Under the hood> Role runs in Performance Log Users group> Coming Soon: IIS Logs generated in role’s local data directory

Page 20: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Common Diagnostic Tasks

Performance measurementResource usageTroubleshooting and debuggingProblem detectionQuality of Service MetricsCapacity planningTraffic analysis (users, views, peak times)BillingAuditing

Page 21: Отладка  Windows Azure  приложений. Сбор диагностических данных.

It Works on My Machine!

File Bug

Resolve as

“No Repro”

Hand-offto Test

Test Code Hand-offto Dev

Investigate Bug

Write Code

Page 22: Отладка  Windows Azure  приложений. Сбор диагностических данных.

What is IntelliTrace?

+ =

Application Instrumentation Log File

Today

+ ==

IntelliTrace • Record• Playback• Rewind

IntelliTrace

Page 23: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Демонстрация

Page 24: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Как получить доступ к облаку

Azure.comДоступ возможен через MSDNДоступ на 24 часа через http://dev-club.in.uaДоступ на 30 дней – письмо мне

Page 25: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Ресурсы

Windows Azure Platform Training Kit (http://msdn.microsoft.com/en-us/wazplatformtrainingcourse.aspx)

Page 26: Отладка  Windows Azure  приложений. Сбор диагностических данных.

Вопросы?