There are many tools available to help you test and monitor the performance of Web applications. Microsoft Visual Studio. NET provides application center test 1.0 (ACT), which simulates a large number of users by opening multiple connections to the Web server and rapidly sending HTTP requests. ASP. NET includes many performance counters that you can use to track application execution. You can also use the built-in ASP. NET tracking feature to track page or application code execution.
The Act design is used to perform stress tests on web servers and analyze the performance and scalability of Web applications. For more information about act, install Visual Studio. NET and open the Act document, or perform a search on msdn in the http://microsoft.com/china/msdn.
Unlike the traditional Active Server Page (ASP) that globally exposes performance counters for the entire server computer, most ASP. NET performance counters are made public for a single application. In the system monitor tool (perfmon ),ASP. NET ApplicationsPerformance objects have counters for a single application. If multiple applications exist on the server, you need to select a specific application instance when selecting a counter for monitoring. However, perfmon has a special_ Total __Application Instance, which combines the counter values of all applications on the server._ Total __Usually the sum of counter values.
ASP. NET also exposes global-only counters, which are not limited to specific application instances. These counters are located inASP. NETUnder the performance object. To view all available ASP. NET counters on a Windows 2000 Server computer, follow these steps.
View available ASP. NET counters on Windows 2000 Server
- From the start button to program, point to administrative tools, and then click performance ".
- In perfmon, click View Report ".
- Click Add ".
- Select ASP. NET applications, select all counters, and click Add ".
- Select "ASP. NET System", select "all counters", and click "add ".
View the ASP. NET counters available on Windows XP computers with IIS installed
- Click Start and then run ".
- In the open text box, enterPerfmonClick OK ".
- In perfmon, click View Report ".
- Click Add ".
- Select ASP. NET applications, select all counters, and click Add ".
- Select "ASP. NET System", select "all counters", and click "add ".
For information about the performance counters of each ASP. NET System and ASP. NET application, see ASP. NET performance counters.
ASP. net contains the tracking function, which can display important execution time information between consecutive Trace Output statements, and information about the server control hierarchy, the amount of view States used, and the display size of controls on the page. For more information about tracing, see ASP. NET tracing.
Because ASP. NET runs on the Common Language Runtime library, it is possible to completely analyze the web page, from the entry point through all the intermediate layer objects to the end. This analysis is impossible in ASP, and it provides excellent tools for ASP. NET performance. In addition, all Analyzer of the Common Language Runtime Library can analyze ASP. NET pages. If you know the Analysis Service of the Common Language Runtime Library, you do not need to standardize your code in advance; this will be done at runtime. For more information about analyzer, see debug and analyze applications.
Analyzer has two main types: Calling attribute analyzer and Sampling Analyzer. The call property analyzer allows you to view all method calls on the page or application, and provides the specific execution time for each method call and its possible sub-method calls. This type of analysis is most useful for analyzing code paths and sorting them as much as possible. However, if the execution runs through any unstandardized code path (for example, when a com or local method is called from ASP. NET), the analyzer cannot track when these methods are called. In this case, the analyzer points them to the last method that contains the canonicalized code. For more information about inclusion of specifications in the code, see debugging and analyzing applications.
The difference between the Sampling Analyzer is that there is no need to standardize the Sampling Analyzer in advance. This analyzer essentially samples the CPU and traces the code content that is being executed at a specified interval or by CPU interruption. Then, it provides users with a view of what code is most frequently executed during that period. This type of analysis is most useful for code troubleshooting, lock/resource contention, and performance bottlenecks.
When you want to perform a stable running analysis, it is best to ignore the overhead of the first request and one-time object initialization. For example, when an ASP. NET page is requested for the first time, the overhead of compiling the page class instance always exists. Once this happens, the performance of subsequent requests will be improved.
For more information about performance monitoring in. NET Framework, see monitoring performance thresholds.