Conclusion
This chapter discussed how to utilize System Monitor to assist you in performance testing applications and identifying system level bottlenecks. We reviewed several sets of objects and counters one must monitor to find these system level bottlenecks. Understanding System Monitor is critical to successful performance testing and analysis.
Chapter 5
Application Network Analysis
The approach to performing an application network analysis of Web-based applications remains unchanged between operating systems (Microsoft Windows NT, Windows 2000, and Windows XP), development technologies (static HTML, ASP, Windows DNA, and now .NET), and data access technologies (RDO, ADO and ADO.NET). This process has remained consistent because the primary protocol used to communicate over the Internet (TCP/IP) has not changed. With the
Conducting an Application Network Analysis
Many Internet users still use modems that connect at painfully slow speeds, and they probably will for the foreseeable future. The goal of an
application network analysis
is to identify slowly executing pages or code and fix them to provide a better end
As we progress through the chapter, we will answer questions such as these. We will define these terms and provide examples that will help
NOTE
We use the
Network Latency
The simplest definition of network latency is the time it takes for a data packet to move across a network connection. The lower the latency between your Web application tiers, the faster the response times. Latency and bandwidth are two factors that determine the speed of a network connection. An easy way to determine the network latency between your client and a Web application is to use the pathping utility, or other utilities such as the Visual Trace Route feature provided in Application Expert. A PowerPoint presentation of Compuware’s Application Expert can be found on this book’s companion CD.
NOTE
The pathping utility is a command-line tool that combines features of the
ping
and
tracert
commands. To use, open a command prompt and type
pathping
Every local area network (LAN) and wide area network (WAN) connection is constrained by network latency. Factors that cause latency to increase are poor quality network devices, longer distances
|
Connection Speed |
Latency |
Response Time |
|
10 mbps |
10 milliseconds |
0.5 seconds |
|
56 kbps |
200 milliseconds |
6 seconds |
|
56 kbps |
500 milliseconds |
8.5 seconds |
The impact of the additional 300 milliseconds of latency for this particular page view and all associated elements is 2.5 seconds, not 300 milliseconds. The reason for this is latency affects every application round trip.
NOTE
One way to deal with the impact of latency is to locate your Web application closer
Network Round Trips
A network round trip is a client-server request-response pair generated by an application. A
For most application developers, network latency on the Internet is out of their control. This is why it is important to develop applications that use as few round trips as possible to keep response times quick even under high network latency conditions.
Reducing Network Round Trips
The most effective method for reducing round trips is to reduce the number of objects per page. Table 5-2 shows two home pages for major Internet search sites that many of you have probably used before. The first home page has fewer than six objects and loads very quickly. The second home page has approximately 15 objects and loads much more slowly. Notice the difference in the number of round trips that are generated when each of these home pages are loaded.
|
Sites |
Number of Objects |
Number of Round Trips |
|
Search Site 1 (Optimized) |
6 |
8 |
|
Search Site 2 (Slow) |
15 |
19 |
Search Site 1 used in Table 5-2 was able to limit the number of objects to six and has a less than 10-second response time on most 56-kbps connections. They limit the number of objects to six by creating one large graphic at the top of their home page, which consists of eight images. Considering each object
Data Transferred
Data transferred
is the amount of data moved between a client Web browser and Web server and is often measured in kilobytes. The best approach for measuring data transferred is to break down the scenarios within your application by page views including their associated elements. For example, the IBuySpy home page transfers 46 kilobytes of data non-cached the first time you access it and 24 kilobytes of data cached (
|
Measured Value |
Converted Value |
|
8 bits |
1 byte |
|
1 kilobyte |
1024 bytes |
|
1024 kilobytes |
1 megabyte |
Reducing the Quantity of Data Transferred
There are several techniques for reducing the amount of data being transferred between Internet Explorer and the IIS
HTTP Compression is a built-in feature of IIS and Internet Explorer. This tool works well for static content like HTM files, HTML files, CSS files, JS files, and uncompressed images. However, with dynamic content you may run into some problems, such as pages rendering incorrectly or becoming non-functional. There is also additional overhead associated with resources on your IIS server if you choose to use IIS compression. By default, HTTP Compression is disabled and can be enabled using the WWW Service Master Properties Services tab, shown in Figure 5-1.
Figure 5-1. Enabling IIS compression
Once HTTP Compression is enabled, you must specify the file types to be compressed by editing the metabase . The following steps show how to edit the metabase settings to compress static TXT, JS, CSS, DOC, and XLS files:
Enable HTTP Compression as shown in Figure 5-1.
Open a command prompt and navigate to the adminscripts folder.
Execute the following command: cscript.exe
Execute the following command: cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcFileExtensions “txt” “js” “css” “doc” “xls”
Execute the following command: iisreset.exe /restart
Another method to trim down the amount of data transferred between the browser and IIS tier is to package the data more tightly by removing all unnecessary characters and white space from your code. This is particularly useful around
NOTE
If you are very conscious about reducing your page
Reducing the number of objects on your page will decrease the amount of data transferred. Many sites use images for bullets and text instead of using formatted text. By limiting the number of elements and using colored text and background colors to make sections of the page stand out, you can reduce the amount of data transferred and network round trips.
Images make a Web site or application more visually appealing but there is a significant performance cost associated with using them. Use Graphics Interchange Format (GIF) images whenever possible. Using optimized or compressed images will reduce the amount of data transferred and typically does not impact the clarity of your pictures much. Most high quality imaging software suites will include a tool to optimize and compress your image files. Reuse images for your company logo, navigational bars or other images that are used throughout your application. Make sure you use the exact same
NOTE
Make sure you set the height and width attributes of each image. It will load faster because the Internet Explorer client does not have to determine the dimensions.
Processing Delay
When client requests
Reducing Processing Delays
The most common way to speed the response time of your application is to reduce application-processing delays. This is accomplished by speeding up slowly executing ASPX, Managed Code, and poor SQL code. More details are available in the IIS, Managed Code, and SQL sections of this book. As discussed earlier in the “Identifying Application Processing Delays” section, by using Network Monitor display data view or Application Expert bounce diagrams, you can identify whether or not your page view and associated elements have processing delays and which tier is causing it.
With .NET applications you can enable tracing on your ASPX pages. After you request an ASPX page with your browser, the statistics and timing will be located at the bottom of your page view. To enable tracing at the page level, add the ASPX page directive Trace=“True” , as shown in Figure 5-2.
Figure 5-2. Enabling tracing on ASPX pages
With standard ASP applications, you can use timers in your code to identify problems. Simply add timing variables throughout your script and write the values to a text file. This method of ASP profiling will allow you to narrow processing delays to a particular function or line of code. This book’s companion CD includes examples of the ASP timing code for VBScript and JScript, which are called ACETimerVB.doc and ACETimerJS.doc. Many times these delays are
NOTE
A simple profiling approach is to insert
response.end
in your ASP page where you suspect the processing is occurring. When this ASP page is loaded, the script will exit when this command is executed, exposing your processing delay. If no delay occurred, move the
response.end
command farther down in your ASP page and load again. Eventually you will narrow down the portion of your script causing the processing delay.
The
Response Times
In reference to performing an application network analysis, response time refers to how long it takes data to travel from the client’s initial request to the completion of the request. Improving performance of your application is synonymous with reducing the overall response time for each of your application’s page views including associated elements. Some factors that constrain response times are a high number of round trips, low bandwidth, end users with high latency connections, a large amount of data transferred, and processing delays on the IIS code, managed code, or SQL code. We describe the process of using Application Expert to quickly calculate response times later in this chapter.
Response time acceptability depends on a variety of factors including the type of application, the function of each requested page within the application, the bandwidth and latency of your Internet connection. For instance, a requested page that has no interaction with a back-end database (that is, a static page view) or has a small amount of content should load faster than requested pages that are heavy in content or constantly retrieve or update data from a database (that is, a dynamic page view) will be slower. Table 5-4 shows the response times we consider acceptable when performing an application network analysis. Low response times represent applications with small static page views or very light interaction with a database. High response times represent applications with large page views or heavy interaction with a database.
|
Connection Speed |
Low Response Time |
High Response Time |
|
Low speed (modems) |
10 seconds |
15 seconds |
|
High speed (DSL, cable, or higher) |
5 seconds |
10 seconds |
User Scenarios
User scenarios are a collection of page views, including their associated elements, that implement business or functional processes. For example, searching the IBuySpy site (discussed in Chapter 3) is a good example of a real-world user scenario. The search scenario consists of several steps, such as loading the home page, entering a search string, clicking the GO button, selecting a product from the search results and viewing the product detail page. This scenario consists of two page views. Instead of capturing the entire user scenario, we recommend you conduct this analysis by separating the scenario into distinct user actions, like clicking a button or link to submit a form that makes a request to the Web server. The reason we isolate the user scenarios into separate page views or user actions is to help identify the exact causes of slow response times.
Identify User Scenarios
The IBuySpy .NET sample application utilizes typical e-commerce functionality. In the following example we have broken the search user scenario into three separate page views, including their associated elements:
The user views the home page, loading the Home.aspx or Default.aspx page.
The user enters a search string in the search field and clicks GO, loading the “SearchResults.aspx” page.
The user selects or clicks a product returned by the search, loading the ProductDetails.aspx page.
If your application is already deployed, you can identify scenarios by either focusing on pages that users have complained about, or by walking through the application and identifying pages that load or execute more slowly. The second method requires that every application page is hit. In some applications this may be unreasonable. However, if you have never performed an application network analysis on the application, this is a good way to establish a response time baseline. Also, if you are working on a new application, this method is more useful because you can identify and fix poorly performing pages before going live.
Now that we have defined the terminology, the next section of this chapter describes the tools available with which to conduct an application network analysis.