Date post: | 15-Jan-2015 |
Category: |
Documents |
Upload: | microsoft-developer-network-msdn-belgium-and-luxembourg |
View: | 1,264 times |
Download: | 0 times |
Diagnosing issues in your ASP.NET applications in production with Visual Studio 2012Brad [email protected]
Agenda
• Challenges in Production• Visual Studio Tools• Remote Debugger• IntelliTrace• Dump Debugger• Profiler
• Sources and Symbols
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
Remote Debugger: The Big Hammer• Advantages• Often the fastest way to resolve an issue• Xcopy deployable (%ProgramFiles%\Microsoft Visual Studio 11.0\
Common7\IDE\Remote Debugger)• Configurable Authentication
• Disadvantages• Your service becomes unresponsive if you are stopped in the
debugger• Requires some firewall configuration
Remote Debugger
Client Side Server Side
Visual Studio
msvsmon.exe
TCP/IP
YourApp.exe
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
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
IntelliTrace in Production
• Download the IntelliTrace Collectorhttp://www.microsoft.com/en-us/download/details.aspx?id=30665
• 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
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
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
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
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…
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:
http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx
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
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_DIRECTORY\Team Tools\Performance Tools\Setups”
• Tier Interaction Profiling• Find performance bottlenecks caused by how your application uses
your database• Is used simultaneously with another profiling method (e.g.
instrumentation)
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
Source Indexing
• Embeds a command into the symbol file for each source file indexed
• Diagnostic tools execute this command to fetch the source file
Binary
Symbol File
Exact Match Source
Command
Source File
Improved User Experience
Better configuration when retrieving indexed sources• Trust a whole symbol file• Trust all symbol files
Using TFS Build
• Use TFS build definitions to save symbols and index sources
• Builds that are released to production should be saved indefinitely
More Info About Diagnostics
ALM Team Blog: http://blogs.msdn.com/b/visualstudioalm/
Request Features
Uservoice site: http://visualstudio.uservoice.com/