The Transaction Cost Analysis methodology is used to provide mathematical calculations for capacity planning. You can also use TCA principles to find performance bottlenecks on your site. Each operation is isolated and examined. Remember that creating accurate usage profiles is the first step to successful TCA analysis.
The benefit of this paradigm is that you do not have to model your environment the same way that you would using the prototype modeling approach. TCA is far more granular and therefore more flexible. For example, it may allow you to test on hardware that is not the same as your performance environment. Furthermore, you will be able to modify things like your usage profiles without having to run any new tests.
Once you have initial values for your TCA analysis, you will be able to use them for future changes to your site. Rather than analyzing the entire site, you can focus purely on the sections that have changed.
For the purposes of this chapter, we are using the example of CPU utilization. However, the TCA principles can be applied to other costs. For example, you might want to analyze the performance of your SQL Server machine or the memory usage of your Web server.
For more information about the TCA methodology, refer to the following articles:
Page Cost Strategy
This is the strategy that we will be exploring in this chapter. The reason that we will use this method is that it is the most reliable way to test the performance of a CMS site. Depending on your business and your site, you may decide to use one of the other strategies. But even if you do, page cost will be a useful test for you. Page cost is the easiest because the tests are straightforward. You use a stress tool and record the results of one page. There isn't much that can go wrong with this strategy.
Since you have already read the TCA paper listed earlier (you did read it, right?), you have seen the example of a site performing various "operations." In our discussion, you can equate these operations with page cost.
Using Page Cost to Test Your CMS Site
Based on the page types identified for the site, the following tables can be produced. These numbers are based on the fictitious BOTS Consulting site.
Each of these tables represents a page from the usage profile. After using the performance counters to gather the cost of each page, you then average out the cost and calculate the total cost of the site.
What we will now do is create three scripts that hit each page individually. The scripts will be executed such that the processor will be at or near 85% utilization. Keep in mind that most sites try to run their production machines at about 35% utilization. This allows them to scale to a peak load of three times the normal traffic. We are using 85% for these tests to check the performance near the peak load. Having run these scripts, we will record the CPU utilization and the pages-per-second throughput.
Tables 35-2 through 35-4 illustrate the CPU cost for each of the three pages that we are testing. We gather this information by running an ACT script against the URL for the page and then recording the Windows performance counter for CPU utilization.
Calculating Users Based on CPU Capacity
Calculating the number of users that your site can support is one of the key aims of performance testing. In fact, this one measurement is often the catalyst for all performance testing. The formula for calculating CPU capacity is the number of processors multiplied by the megahertz rating of the CPU.
The next number to calculate is the target CPU capacity. This will determine your goal for CPU capacity. You will need to determine what you think your target should be. A value of 80% is often used because it allows some room in case your usage spikes for some period of time. For example, if your site happened to be mentioned by some large news site, you might find that you need that extra 20% of capacity.
It is then a simple matter to determine how many simultaneous users you are able to support on one machine.
Cost Table for Pages
Once you have numbers for each page, you can create a table such as Table 35-5. For this example, we are using fictitious numbers for the BOTS Consulting site, with one 1,000MHz processor.
The total CPU cost for each page is calculated with this formula:
Total CPU cost = (CPU usage x number of processors x CPU speed)/requests per second
Using Usage Profiles for TCA
Now we know the cost of individual pages. Based on our usage profile, we can add in the page distribution numbers, shown in Table 35-6. This determines how much of the traffic we expect each page to carry.
For this example, we will continue to use fictitious numbers from performance testing on the BOTS Consulting site. We will use these numbers to demonstrate how to calculate the user capacity for a CMS site. We will also assume that the Web server has one 1,000MHz processor.
Next we can take our numbers from the CPU cost table (Table 35-5) and add in the data about the distribution of the load (Table 35-6). This gives us the cost of the particular usage profile, shown in Table 35-7. Table 35-8 shows the result of calculating the pages-per-second cost of the distribution profile.
As we learned earlier in this chapter, once you have all this information, you can take your throughput and divide it by the number of clicks for each user. In this example, our site renders roughly 111 pages per second. If our users click 1 page per second, then we could support 111 concurrent users.
Remember that your usage profile could include the rate that your users are clicking through your site. If we found that our IIS logs indicated that the average session length was ten minutes and the average pages per session was 20, then the click rate would be 0.017 pages per second per user. Based on this rate, we could support 6,517 concurrent users (110.79 pages per second / 0.017 pages per second per user).
Now that you have these numbers for a 1,000MHz processor, you could change the processor power to 2,000MHz. Without running any new tests, you would know that you would be able to support 13,034 concurrent users. You could also alter your user profile distributions and calculate the resulting effect on your performance numbers. And finally, you could change the code on one page and then just test the new page. You would not have to run all the other page tests again.