You are on page 1of 3

An Introduction to

Performance Testing
By Leslie Segal

running the additional virtual users? time.


As with regression testing, it seems (Expect to need about one PC for each
that everyone today is looking for a per- 200-250 virtual users). Creating and executing scripts using per-
formance testing tool that will take care formance test tools is extremely easy to
of all of their performance testing needs. Some companies assume that the rela- do. At most, they take about half a day to
As it turns out (as with most testing), the tionship of real users to virtual users is master the basic record and playback
tool is the least important piece of the 1:1. They look at the cost of the tools and concepts. The hard part is figuring out
effort. Performance testing is 90% analy- then make the decision not to do any per- what to script and then what to do with
sis and 10% tool implementation. formance testing, because they feel that the copious data that will be generated in
However, unlike most other testing, per- their perceived risk by not doing the test- order to reach the right conclusions about
formance testing is nearly impossible to ing will cost them less than buying the the true performance of your system.
perform without a tool. tool. This can prove to be a very costly
mistake, as many e-business Web sites Performance Testing
Almost all of the performance testing have found out (painfully so). In addition
to saving money, understanding your real Overview
tools on the market today are based upon
the concept of simulating the traffic from users and their correlation to virtual users
will allow you to generate more accurate First, let’s take a look at performance
real users with virtual users. You know testing in general. Functional testing is a
that you need a performance test tool, but scripts and, in turn, more precise results.
One of the pitfalls of performance testing fairly easy concept to grasp and the
how many virtual users do you really results are fairly concrete. Most function-
need to test the performance of your is that - just like with functional test
automation - you can create really bad al tests pass or fail, as the expected result
application? What defines a virtual user? is very black and white. Performance
What is the correlation of real users to scripts. However, in the case of perform-
ance testing, you may think (and have run testing on the other hand is neither con-
virtual users? If I can write a test script crete nor black and white. What does
using one virtual user that will log onto scripts that show) your Web site can sup-
port 1,000 concurrent users, when in real- ‘passing’ mean for a performance test?
my system as 100 different users, what Does it mean that with 300 simultaneous
does a virtual user really mean? It is ity, ten users executing a particular func-
tion may cripple your site. users hitting a site, if the average
important to have the answers to these response time is less than ten seconds,
questions before you begin performance then it passes? What if the maximum
testing; the purpose of this article is to The performance of your system should
be measured in three areas: response time is 90 seconds and the stan-
help you understand why. dard deviation is 35 seconds? Does the
Response Time – how long does it take test still pass? For some, passing means
Why should you even care about what a that with n concurrent users on their site,
virtual user is? For one thing, almost all the system to respond to a request for a
piece of information; it doesn’t crash. The (first) hard part in
of the performance tools have a pricing embarking upon performance testing is to
structure based upon the number of virtu- define what you want to measure and
al users that you license. The cost of a Throughput – how much activity can the
system support, often measured in trans- then what criteria you will use for deter-
license for 250 virtual users is signifi- mining whether or not the test passes.
cantly less than one for 2,500 virtual actions or hits/second; and,
users. So, if you don’t really need 2,500 We sat down with one client to discuss
virtual users, why spend the additional Round Trip Time – how long does the
entire user requested transaction take, exactly what their criteria were; in per-
money on both the tool and all of the formance testing their site, what was it
hardware that you will need to support including connection and processing
queries, but you don’t have a lot of mem-
ory in your application server, the first
scripts that you write may just be queries
to the database. On the other hand, if you
know that certain processes in your appli-
cation are CPU intensive, you may want
to create scripts that kick off these
processes and then try and perform other
tasks while the CPU is busy.

Before you create the scripts to test your


performance, you also need to understand
how your users will actually use the sys-
tem. What are typical scenarios users per-
form? If you already have a live Web site,
using a tool like WebTrends® will pro-
Figure 1: Expected Performance Response vide you with useful user profile infor-
mation. If you aren’t sure how users will
take you to get through the intersection tem. The principles of queuing theory are
use your application, then you need to
where the accident occurred) is increas- beyond the scope of this article.
make some guesses based upon their
ing, but you aren’t even moving. You are
behaviors in similar environments. John
not doing anything except standing still. Understanding Your Musa has written many articles and
It is not until three of the cars in front of
you have moved that you can even think System and Creating a books on the subject of creating opera-
tional profiles. Operational profiles are
about moving. At this point, your travel Transaction/User Profile extremely useful in helping to analyze the
time is extremely long and you start to
probable transactions to your application.
crawl through the intersection. This also So what does all this have to do with vir-
explains why when you are in car number tual users? A lot. Before you can begin to If you are also trying to determine the
50, by the time you pass through the create scripts to be executed by the virtu- maximum load that your Web site will
intersection, you have no idea what hap- al users, you need a basic understanding need to support, it is often useful to visit
pened and why you were stuck in traffic of your system. If you understand the your competitors’ Web sites. They will
for so long to begin with. hardware architecture (NT server, UNIX often boast of their traffic (especially if
server, load balancing, firewalls, separate they are selling ad time on their Web
So what does being stuck in traffic have database server, number of CPUs and site). We have found Web sites that boast
to do with the performance of your appli- memory, etc.) of your system and the that they received 200 million hits in the
cation? Plenty. They are both governed implementation (use of proxies, indexing last 30 days. That gives you a good start-
by basic queuing theory. Your application in the database, load balancing algo- ing place from which to measure.
takes requests; if the requests come in rithms, etc.) then you can assess where Assuming a linear distribution of those
faster than they can be processed, the probable bottlenecks will occur and start 200 million hits (note that a linear distri-
application will start to queue them up. your performance testing in these areas. bution is extremely unlikely, but it’s a
That’s when the properties of queues and
start), then the 200,000,000/ 30 days =
queuing theory take over to explain the For example, if you know that your appli- 6666667 hits/day = 277778 hits/hour =
behavior (or non-behavior) of your sys- cation will be asked to perform a lot of 4630 hits/sec. While the traffic to some
Figure 2: Actual Performance Response Approaching a Bottleneck web sites may be indeed be linear over a
particular period of time (8AM-8PM), an
exponential, or Poisson distribution may
be more realistic.

Creating the scripts involves defining a


scenario, or transaction, that your user
will execute. A scenario may be com-
prised of one or more transactions and a
transaction may invoke one or more hits.
For example, one transaction may be
defined as loading the home page.
Actually executing this transaction may
generate 1-50 hits. (We have seen home
pages that load so many GIF files that
they literally account for 75 hits.) Next,
you need to assess how many times this
scenario will be executed over a defined
90
they logon, a 2K “chunk” is sent every
five minutes. They also receive a 10K 80

“chunk” every ten minutes. 70

60
Determining the transaction profile 1 sigma
(assuming linear distributions): 50

40

‹One transaction every 5 minutes x 30

10,000 users = 10,000 transactions / 5


20
minutes = 2,000 / 1 minute = 33.33 / 1
second. 10 2 sigma
avg
0

‹One transaction every 10 minutes x


10,000 users = 10,000 transactions/ 10 Figure 4: Is Average Good Enough?
minutes = 1,000 transactions/ minute = the following two sets of data is essen- less than 30 seconds. You need to corre-
16.67 / 1 second tially the same – five seconds: late the 500 virtual users to the real users
on your site. Sometimes it makes more
‹Total traffic per second = 33.33 + 16.67 ‹Data Set # 1: 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 sense to plot the response times against
= 50 transaction (hits) / second the number of hits to the site, as in Figure
‹Data Set #2: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 6.
If the response time for each transaction
is 10 seconds, then we need 500 virtual If you are the user in data set 2 that This graph portrays a possible bottleneck
users to generate a load of 50 transac- always takes ten seconds, you don’t real- at a throughput rate of 31 hits/sec. After
tions/second (50 transactions/sec * 10 ly care that the average response is five that threshold, the response time starts
seconds = 500 unique transactions) seconds. (See Figure 4.) increasing. The throughput of 31 hits per
Buying a 500 virtual user license was second may correlate to n “real” users,
much more palatable than a 10,000 virtu- If the maximum and minimum response but it may not. It may correlate to 500
al user license, and certainly a better times deviate from the average response real users loading a homepage, but only
option than not testing at all. time, then it is also important to graph 100 real users logging on to the system.
and analyze the maximum response times
Data: The End Result – along with the averages or to plot the There is no easy formula for determining
standard deviations of the responses. the number of virtual users that you need
What Does it Mean? (See Figure 5.) to adequately performance test your site.
There are no rules of thumb. Each site
Once you’ve determined the profiles of This graph also helps visualize the pain must be analyzed to determine what is
your real users, created your virtual user that the user with the maximum response reality and what is virtual. In the end
scripts and run them, you will be the time is experiencing. The maximum what really matter is the reality of your
proud owner of profuse amounts of data response time is also going to be closer to company and your job.
with a variety of interpretations and many the potential bottleneck in your system.
questions about whether the tests passed Leslie Segal, President, Testware
or failed. One of the more common met- Plotting virtual users against response Associates, Inc.
rics used in measuring performance is the time (especially when there is not a 1:1
average response time. The average correlation between real and virtual References:
response time is fine - unless you are the users) can be misleading and result in dif- The Practical Performance Analyst, Neil
one user that pulled the average response Gunther, McGraw-Hill, 1998.
ferent impressions of the actual perform-
time higher. Average is the sum of all of ance of the application. For example, this Web Server Technology, Nancy Yeager
the response times divided by the number graph shows that with 500 concurrent vir- and Robert McGrath, Morgan Kaufmann
of values. The average response time for tual users, your system response time is Publishers, 1996
Figure 5: Average Response Time Figure 6: Average Response Time
Plotted with Standard Deviation Plotted with Hits/Second

Average Response w/ std deviation 60.00

50.00
80
40.00
60
seconds

30.00
40
20.00
20
10.00
0
0.00
1 50 100 150 200 250 300 400 500 600 70

You might also like