1 / 26

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

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

temira
Download Presentation

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

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Тема 5 Отладка Windows Azure приложений. Сбор диагностических данных. Сергей Байдачный Sergiy.Baydachnyy@microsoft.com Специалист по разработке ПО Майкрософт Украина

  2. Diagnostics: Single Server vs. the Cloud Single Server Cloud Dynamic Environment Multi-instance, elastic capacity Distributed transactions Local Access Infeasible Many nodes Distributed, scaled-out data Service Upgrades • Static Environment • Single well-known instance • Traceable local transactions • Local Access Feasible • All in one TS session • Data & tools co-located • In-Place Changes

  3. Windows Azure Diagnostics • SDK component providing distributed monitoring & data collection for cloud apps • Support Standard Diagnostics APIs • Cloud-Friendly • Manage multiple role instances centrally • Scalable • Built on Windows Azure Storage & used by scale-out Windows Azure platform components • Developer In Control • What to collect & when to collect it

  4. Demo

  5. Windows Azure Diagnostics Configuration Role Instance Role Data collection (traces, logs, crash dumps) Quota enforcement Diagnostic Monitor Local directory storage Windows Data Sources IIS Logs & Failed Request Logs Perf Counters Windows Event Logs

  6. Windows Azure Diagnostics Request upload Role Instance Windows Azure Storage Role Diagnostic Monitor Local directory storage Windows Data Sources Scheduled or on-demand upload

  7. Windows Azure Diagnostics Development Fabric Windows Azure Hosted Service

  8. Windows Azure Diagnostics Development Fabric Windows Azure Hosted Service Diagnostic Manager Desktop Diag Application Controller Code Configure

  9. Activate Windows Azure Diagnostics Generate Data Enable Local Buffering Transfer to Windows Azure Storage How-To

  10. Sample: Activate WA Diagnostics • // This is done for you automatically by • // Windows Azure Tools for Visual Studio • // Add a reference to Microsoft.WindowsAzure.Diagnostics • using Microsoft.WindowsAzure.Diagnostics; • // Activate diagnostics in the role's OnStart() method • public override boolOnStart() • { • // 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"); • ... • }

  11. 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>

  12. Sample: Generate Diagnostics Data • string myRoleInstanceName = • RoleEnvironment.CurrentRoleInstance.Id; • // Trace with standard .Net tracing APIs • System.Diagnostics.Trace.TraceInformation( • "Informational trace from " + myRoleInstanceName); • // Capture full crash dumps • CrashDumps.EnableCollection(true); • // Capture mini crash dumps • CrashDumps.EnableCollection(false);

  13. 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 explicitly • DiagnosticMonitorConfigurationdiagConfig = • DiagnosticMonitor.GetDefaultInitialConfiguration(); • // Add performance counter monitoring • PerformanceCounterConfigurationprocTimeConfig = new • PerformanceCounterConfiguration(); • // Run typeperf.exe /q to query for counter names • procTimeConfig.CounterSpecifier = • @"\Processor(*)\% Processor Time"; • procTimeConfig.SampleRate = System.TimeSpan.FromSeconds(1.0); • diagConfig.PerformanceCounters.DataSources.Add(procTimeConfig); • // Continued on next slide...

  14. 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 • // configuration • DiagnosticMonitor.Start( • "DiagnosticsConnectionString", • diagConfig);

  15. 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> • <failureDefinitionsstatusCodes="200-599"/> • </add> • </traceFailedRequests> • </tracing> • </system.webServer>

  16. Sample: Scheduled Data Transfer • // Start off with the default initial configuration • DiagnosticMonitorConfiguration dc = • DiagnosticMonitor.GetDefaultInitialConfiguration(); • dc.WindowsEventLog.DataSources.Add("Application!*"); • dc.WindowsEventLog.ScheduledTransferPeriod = • System.TimeSpan.FromMinutes(5.0); • DiagnosticMonitor.Start("DiagnosticsConnectionString", dc);

  17. 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. • varddm = new DeploymentDiagnosticManager( • storageAccount, • deploymentID); • varridm = ddm.GetRoleInstanceDiagnosticManager( • roleName, • roleInstanceName); • vardataBuffersToTransfer = DataBufferName.Logs; • OnDemandTransferOptionstransferOptions = • new OnDemandTransferOptions(); • transferOptions.From = DateTime.MinValue; • transferOptions.To = DateTime.UtcNow; • transferOptions.LogLevelFilter = LogLevel.Critical; • GuidrequestID = ridm.BeginOnDemandTransfer( • dataBuffersToTransfer, • transferOptions);

  18. Storage Considerations • Standard WA Storage costs apply for transactions, storage & bandwidth • Data Retention • Local buffers are aged out by the Diagnostic Monitor according to configurable quotas • You control data retention for data in table/blob storage • Query Performance on Tabular Data • Partitioned by high-order bits of the tick count • Query by time is efficient • Filter by verbosity level at transfer time

  19. Feature Summary • Local data buffering • Configurable trace, perf counter, Windows event log, IIS log & file buffering • Local buffer quota management • Query & modify config from the cloud or from the desktop per role instance • Transfer to WA Storage • Scheduled & on-demand • Filter by data type, verbosity & time range • Transfer completion notification • Query & modify from the cloud and from the desktop per role instance • Under the hood • Role runs in Performance Log Users group • Coming Soon: IIS Logs generated in role’s local data directory

  20. Common Diagnostic Tasks • Performance measurement • Resource usage • Troubleshooting and debugging • Problem detection • Quality of Service Metrics • Capacity planning • Traffic analysis (users, views, peak times) • Billing • Auditing

  21. It Works on My Machine! Write Code Hand-offto Test Test Code File Bug Hand-offto Dev Investigate Bug Resolve as “No Repro”

  22. What is IntelliTrace? Today + = Application Instrumentation Log File IntelliTrace • Record • Playback • Rewind = + = IntelliTrace

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

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

  25. Ресурсы • Windows Azure Platform Training Kit (http://msdn.microsoft.com/en-us/wazplatformtrainingcourse.aspx)

  26. Вопросы?

More Related