Profiling the Performance of SharePoint Applications
If your SharePoint applications are performing slowly or inefficiently, the profiling features in Visual Studio can help you identify code and other elements that are adversely affecting performance.
Profiling Tools Overview
Profiling describes the process of observing and recording the performance behavior of your application as it runs. Profiling can uncover problems such as bottlenecks, inefficient code, and memory allocation issues, which result in applications running slowly or using too much memory. For example, profiling can identify hotspots in your code–segments of code that are frequently called and can slow down the overall performance of your application. Once identified, hotspots can often be optimized or eliminated.
Visual Studio provides several profiling tools in the integrated development environment (IDE) to help identify and locate these kinds of performance issues. The profiling tools work the same for SharePoint projects as they do for other Visual Studio projects. The Profiling Tools Performance Wizard leads you through the creation of a performance session using the tests you select. A performance session is a set of configuration data used for collecting performance information from an application, along with the results of one or more profiling runs. Performance sessions are stored in your project folder and can be viewed in Performance Explorer. For more information about the available profiling methods, see Understanding Profiling Methods.
After creating and running a profile analysis on your application, a report provides details about the performance of the application. This report can include items such as a graph of CPU usage over time, a hierarchical function call stack, or a call tree. The exact report contents can vary, depending on the type of test you run, such as sampling or instrumentation. For more information, see Profiling Tools Report Overview.
Performance Session Process
To profile an application, begin by using the Profiling Tools Performance Wizard to create a performance session. On the menu bar, choose Analyze, Launch Performance Wizard to open the Profiling Tools Performance Wizard. The wizard leads you through entering the required information for your performance session, such as the profile method you want and the application you want to profile. For more information, see How to: Profile a Web Site or Web Application Using the Performance Wizard. Alternatively, you can use command-line options to set up and run a performance session. For more information, see Using the Profiling Tools From the Command-Line. If you want to manually configure a performance session from the ground up, see How to: Manually Create Performance Sessions with the Profiling Tools. You can also create a performance session from a unit test. To do this, in the Test Results window, open the shortcut menu for the unit test, and then choose Create Performance Session.
After you set up a performance session, the session configuration is saved, the server is configured to provide profiling data, and the application runs. As you use the application, performance data is written to a log file. Performance sessions are listed in Performance Explorer under the Targets folder. After a performance session run completes, its report is listed under the Reports folder in Performance Explorer. To view the report, open it in Performance Explorer. To view or configure the properties of a performance session, open its shortcut menu in Performance Explorer, and then choose Properties. For more information about specific performance session properties, see Configuring Performance Sessions for Profiling Tools. For information about interpreting the performance session results, see Analyzing Profiling Tools Data.
Demonstrates how to perform a sampling profile analysis on a SharePoint application.