LANGUAGES: All .NET Languages
TECHNOLOGIES: COM+ | Web Services
VTune Enterprise Analyzer for Web Applications
Uncover the weak link(s) in your distributed three-tier ASP.NET applications.
By Ken McNamee
For most of you, optimizing your ASP.NET applications for performance is an absolute must. But optimizing a three-tier ASP.NET application that involves code distributed on multiple servers via T-SQL stored procedures, Web Services, COM Interop and/or .NET Remoting is an absolute pain. Intel's VTune Enterprise Analyzer for Web Applications can relieve most of that pain by helping you quickly identify the areas of your application that need to be tweaked a little or even completely overhauled.
Let me start by saying that VTune is a very high-end performance analyzer. It's called "Enterprise Analyzer" for a reason, and it really works best when analyzing each tier of the classic three-tier Web application architecture - the Web tier, application or business object tier, and database tier - on its own physical server. If you have only a two-tier Web application, you still will get some useful information from VTune but it might not be worth the price of admission.
The application architecture I used to test VTune is a modified version of Microsoft's Downhill Bikes sample Web application. It involves four servers: the main ASP.NET Web server, a SQL Server, an ASP.NET Web Services server, and a machine that contains two COM DLLs accessed via a COM+ proxy. This is a minimal enterprise-style architecture whose only intent is to demonstrate how VTune can watch multiple servers under load, determine which pieces of the application are being executed at any given time, and aggregate the performance data of those pieces. In case you're wondering, the impact on the system while VTune is collecting data is insignificant.
VTune Enterprise Analyzer is actually composed of two distinct pieces: A server application collects data from all the servers it's watching, and a GUI application allows you to start and stop the data collection and view the results. Installing VTune is fairly straightforward and I encountered no surprises. One caveat, however, is that the collection server and Web servers must all be located on the same network hub. So, analyzing multiple Web farms simultaneously from a single collection server at this time is not possible.
In addition to the network topography, each machine the collection server watches must have a special Windows account created to enable access. This account must be a member of the Administrators group. You also have the option of using a domain account with sufficient permissions for the collection server to do its job.
The first step in using VTune to analyze your application's performance actually has nothing to do with the product. First you should simulate heavy load on your servers using a load-testing tool such as Mercury Interactive's LoadRunner or the Application Center tool included with the Enterprise Architect and Enterprise Developer editions of Visual Studio .NET. A free alternative to these tools is Microsoft's Web Application Stress Tool, which is a little less polished but still works well.
The Tier View
Once you've created your load-testing script, you're ready to fire up VTune. Start by creating a new project and configuring the collection server to watch all the servers that comprise your application (see Figure 1).
Figure 1. Telling VTune which tiers to watch is as easy as giving it the names of the servers and clicking on a few checkboxes.
At this point, you want to start your load tester to simulate a production system, then start the collection process from VTune's GUI application. You can run this for as long as you like, then simply stop the collection server.
You can view the results of the test in several ways: by tier, by machine, by object, or by task. As displayed in Figure 2, the Tier View shows a graph of the entire test and the response time for each tier of the application. This gives you a good, high-level overview of how each tier performed during the lifetime of the test and allows you to identify areas that might need further inspection.
Figure 2. VTune's Tier View gives you a high-level overview of the performance of the application tiers.
The graph also is one part of VTune that falls short of being intuitive; the GUI application has almost no context menus. For instance, using the left mouse button, you can click and drag to highlight a time slice of the graph. Once highlighted, I expected I could right-click and a menu would pop up, showing me what options were available. This didn't happen, and I had to search through the help files to discover that I had to click on a toolbar button named Time Filter to zoom in on the highlighted area. Additionally, although the Tier View is useful, I found myself wishing I could get a little more information out of it, such as seeing what calls were being made as my cursor hovered over the graph or highlighted an area.
Machine, Task, and Object Views
Machine View (see Figure 3) allows you to drill down a little deeper than the aggregated tiers of the application. As its name implies, the Machine View lets you see how each physical server is performing and responding under the load. You can filter out tiers or view them all at once, and you can select which server attributes to include in the graph, such as CPU usage, physical and virtual memory usage, disk I/O, network bandwidth usage, and response time.
Figure 3. The Machine View shows the performance of each server involved in the test.
There is some good information to be found here. I actually prefer to start in this view after running the test because it seems to give me the right balance of high-level overview and low-level detail so I can start pinpointing the problem areas quickly. However, this view is also plagued by the same non-intuitiveness as the Tier View - though, like most idiosyncratic software, it doesn't bother you once you get used to it.
As useful as the Tier and Machine views are, the next two views are really where VTune shines and where ASP.NET developers are going to get the most value for their time, money, and effort. Starting with the Task View (see Figure 4), VTune begins to display information that will be immediately familiar to any developer: URL requests, method calls, and database calls. These types of calls map directly to the physical tiers of the three-tier application architecture.
Figure 4. Detailed performance information about ASP.NET requests and SQL and method calls is displayed in the Task View.
The Task View gives the minimum, average, and maximum response times for all the requests and calls being executed. In addition, it calculates the load of each call, which is the average response time multiplied by the number of times the call was executed. A high load number could mean the item being executed might not be fully optimized and requires some attention.
Clicking on one of the executed items displays a graph outlining the performance of the item over the course of the test. As with the other views, you can highlight a time slice and zoom in for a better look. You either can view the detail for the item in isolation or in relation to the other calls.
One area of frustration I had with this view is its inability to save or export data to another format. This is odd because the File menu contains Export and Save As selections - but they are always disabled when they should be active. The VTune Help files state that these functions should work, but the software is not being cooperative. Finally, the product has a complete lack of context-sensitive integration between the different views, which behave more as separate islands of non-relational data than multiple views of the same data.
Although the Task View allows you to see the collected performance data in a grid, the Object View gives you a detailed perspective of the overall architecture. As you can see in Figure 5, the Object View displays the flow of execution between all the tiers, servers, and objects involved. The main point of this view is to show how everything works together, rather than how everything performs. It's a nice touch, but, more than likely, if you are going through the trouble of building a three-tier architecture, you've created a similar diagram already and probably with a lot more detail.
Figure 5. The Object View displays the relationship between the tiers, servers, and objects.
Get the Most out of VTune
Although VTune has a great deal of built-in functionality, it still requires that you use some common sense and due diligence when it comes to using the application. For example, VTune is not going to give you useful data if the load-testing tool or script are not configured properly. Also, if you know your site's search functionality is performing sluggishly, you need not create a test script that stresses the entire site. So try to be specific about which portions of the site you want to test and analyze. Doing so in small, manageable sections helps prevent information overload and allows you to identify the offending code as quickly as possible. So here are a few tips to help you get the most out of VTune.
Use the Object View to ensure you fully understand the application's architecture before you try to analyze the performance results. You'll probably save yourself a good deal of frustration.
Use the Tier View to see if one tier is monopolizing a majority of the response time. Doing so could save you the trouble of re-indexing your database when all you need is better use of the ASP.NET caching abilities.
Use the Machine View to determine whether your performance data is possibly being skewed by a misbehaving Web or application server. It could also be that the database server simply needs additional memory or processors. Don't waste your time analyzing the code when the hardware is what you really need to upgrade. This type of information can help you determine whether you need to scale out or scale up. In these cases, you should measure the cost of VTune against the cost of making a wrong choice between hardware upgrades, increasing the consulting budget, etc.
Remember to use the Task View to focus on code that has a high Load value. Because Load is calculated as a product of the average response time and number of occurrences, lowering this number might be a little tricky. It might be that the code cannot be optimized to run any faster. But if you can reduce the number of times the code is executed, you might increase the performance of that area significantly.
Changing one thing at a time is possibly the most important tip. Rerun tests to see what benefit, if any, was achieved. Changing multiple items and then retesting might allow you to realize a performance gain, but not a knowledge gain. Sometimes the most important benefit of the optimization process is determining what mistakes were made so you can learn from them and prevent them from recurring.
Intel's VTune Enterprise Analyzer for Web Applications can be an invaluable tool if you need help testing a three-tier application architecture for development performance issues - before they become production performance issues. You also can use VTune in a production environment as a diagnostic tool for when issues arise inexplicably, though Intel hasn't recognized it to be used for that purpose.
The .NET Framework is an outstanding foundation on which to build robust three-tier architectures. But it can still be a very daunting task, and Visual Studio .NET falls a little short when building fully optimized enterprise systems. It's precisely this gap that VTune Enterprise Analyzer is meant to fill, and, when used correctly, it can help you get the most out of your applications.
Ken McNamee is a senior software engineer with RelayHealth Corp., the premier provider of secure, Web-based doctor-patient communication services. Prior to this, he led a team of developers in re-architecting the Home Shopping Network's e-commerce site, HSN.com, to 100 percent ASP.NET with C#. E-mail him at mailto:[email protected].
VTune Enterprise Analyzer for Web Applications is a performance diagnosis tool for analyzing three-tier Web architectures.
- Gives detailed performance information on ASP.NET page response time, calls to SQL Server databases, and DCOM, Web Services, and .NET Remoting calls.
- Requires Windows 2000 with SP2 or greater.
- Requires SQL Server 2000 on the database tier.
- Can be used with either Windows DNA or .NET Web applications.
- Straightforward installation with good instructions.
- Includes four licenses for VTune Performance Analyzer 6.0, which list for $700 apiece.
2200 Mission College Blvd.
Santa Clara, Calif. 95052
Phone: (408) 765-8080
E-mail: mailto:[email protected]
Web Site: http://www.intel.com
Tell us what you think! Please send any comments about this article to [email protected]. Please include the article title and author.