Contenu connexe


Plus de Microsoft Developer Network (MSDN) - Belgium and Luxembourg(20)


Diagnosing issues in your ASP.NET applications in production with Visual Studio 2012

  1. Diagnosing issues in your ASP.NET applications in production with Visual Studio 2012 Brad Sullivan
  2. Agenda • Challenges in Production • Visual Studio Tools • Remote Debugger • IntelliTrace • Dump Debugger • Profiler • Sources and Symbols
  3. Challenges in Production • Can’t reproduce the issue in a development environment • Can’t run Visual Studio on the production machine • Possibly very limited developer access to production machines • Want to minimize impact to the server • Performance • Availability • Security
  4. Remote Debugger: The Big Hammer • Advantages • Often the fastest way to resolve an issue • Xcopy deployable (%ProgramFiles%Microsoft Visual Studio 11.0Common7IDERemote Debugger) • Configurable Authentication • Disadvantages • Your service becomes unresponsive if you are stopped in the debugger • Requires some firewall configuration
  5. Remote Debugger TCP/IP
  6. Improvements in Visual Studio 2012 • Single Firewall Configuration (Remote Debugger Side) • Can connect across different domains • Symbols load from the Visual Studio side • No need to copy symbol files to your production machine • Faster • No need to choose between x86 and x64
  7. IntelliTrace • A “Back-in-Time” debugger • Configurable logging to trace the state of an application over time • Integrated with the Visual Studio Debugger UI for analysis • Can be run either locally or via command line
  8. IntelliTrace in Production • Download the IntelliTrace Collector • Run it on your production machine • Pick a collection plan • Target the application • Reproduce the issue • Bring the IntelliTrace log back to your development machine • Analyze in Visual Studio to find the bug
  9. IntelliTrace Collection Plans • 2 Default Levels • Calls • Events • Custom? • Requires Editing XML • Can turn individual events on/off • Can include/exclude modules • Change max log file size
  10. Impact on Server Performance • Depends on a number of factors • Number of events collected • Number of modules included in application (startup jitting costs) • Calls data collection • IO
  11. System Center • IntelliTrace is integrated with System Center 2012 SP1 – Operations Manager • Application Performance Monitoring now available in an IntelliTrace format • IntelliTrace Profiling Management Pack allows you to collect IntelliTrace logs directly from the Operations Manager console
  12. Dump Files • Snapshots of the application at a single point in time • Two major types • With Heap – allows full inspection of the state of the app at that point in time • Without Heap – only allows for inspection of the callstacks across all threads • Can be opened directly in VS and debugged just like a regular application • Except no stepping…
  13. Creating Dump Files in Production • Several tools available that can create dump files, including Visual Studio • ProcDump has many qualities that make it ideal for production use • Command line • Xcopy deployable • Provides triggers for dump collection • CPU usage • Memory usage • Exceptions (with filters) • Low impact on system performance • Available through Microsoft SysInternals:
  14. Performance Profiler Overview • CPU Sampling • Shows what parts applications are executing the most frequently • Instrumentation • Records how long functions take to execute and how many times they are executed • .NET Memory Allocation • Tracks what objects are being allocated • Resource Contention • Tracks when threads are contending for the same resource causing slowdowns • Tier Interaction Profiling • Records database queries that go through ADO.NET
  15. Profiling Use • Can be run locally from the IDE • Can be run in production on the command line • Standalone installer included in the Visual Studio Install • “VS_INSTALL_DIRECTORYTeam ToolsPerformance ToolsSetups” • Tier Interaction Profiling • Find performance bottlenecks caused by how your application uses your database • Is used simultaneously with another profiling method (e.g. instrumentation)
  16. Symbols (PDBs) • The debugger, profiler, and IntelliTrace all need symbols to function properly • Symbols provide a mapping between the binaries you are analyzing and the source code that produced them • Also provide information for determining the local variables for a function • Symbol files must exactly match the build that you are diagnosing • It is easy for your development environment to get out of sync with what is in production
  17. Source Indexing • Embeds a command into the symbol file for each source file indexed • Diagnostic tools execute this command to fetch the source file Exact Match
  18. Improved User Experience Better configuration when retrieving indexed sources • Trust a whole symbol file • Trust all symbol files
  19. Using TFS Build • Use TFS build definitions to save symbols and index sources • Builds that are released to production should be saved indefinitely
  20. More Info About Diagnostics ALM Team Blog:
  21. Request Features Uservoice site: