Professional Documents
Culture Documents
CONTENTS Summary
Summary 2 Why load test? Simple. To determine how many customers your website
Planning Your Test 2 or application will supportbefore you find out the hard way, with
When and how long to test? 2 degraded performance or an outage, usually when its least convenient.
How many tests should you run? 3 Quick tidbit: More often than not, people greatly over-estimate their
Real or Virtual Browsers? 3 capacity. Many are shocked when they get their first set of load test
results. They realize theres a lot to do to prepare for a full production
How much load should
release. To make all that work less daunting, this white paper breaks load
you test with? 3
testing down into the following key milestones and activities:
Calculating Concurrent Users 3
Test Data and Server/Network Planning
Monitoring 3 Configuration
Configuration 3
Scripting
Where do you expect your traffic to
come from? 3 Execution
How should you apply your user load Analysis
during the test? 4
By following the best practices weve developed over thousands of tests,
Where do users spend the most time
on your site? 4 you can make your load tests smoother and more productive. Even better,
youll help protect your brand and bottom line. With so much at stake,
How long do users take when
proven methods can make a big difference.
navigating your site? 4
Do you use third party vendors? 5
What Makes a Good Script? 5
Planning Your Test
Content Validation Combined with When and how long to test?
Proper Use of WaitForPageToLoad 5 As you launch a new application or prepare for peak Web trafficsay
Setting Proper Timeouts 5 the winter holidays are coming and youre enhancing your shopping
cartload testing should be part of your overall project plan. The ideal
Optimization of Locators 5
time to run your first test is after User Acceptance Testing (UAT) is
Pause Times 5
complete, but prior to moving the application into production. Based on
Randomization 5 our experience, you need to allow for an absolute minimum of 2-3 weeks
Test Execution 5 for planning, scripting and execution. Many people try to compress
Execution checklist 5 this time, but believe us, there are no magic tricks. Its an incremental
process, requiring careful review and time for your development team to
Successful transactions 6
address any problems.
Page views 6
Page load times 6 How many tests should you run?
Errors 6 Based on our work with hundreds of customers over the years, weve
Throughput 6 found that three is the magic number.
Analysis 6 The first test provides you a benchmark and snapshot of your sites
High-level results 6 current performance. This will always yield recommendations for
Digging deeper: load times 7 improvement.
Digging deeper: errors 7 The second test validates all the changes made after the first test and
Tracking down errors 7 identifies any remaining bottlenecks. Youll probably make additional
Examples 7 tweaks.
Other Considerations 8 The third test is your applications final pre-launch validation. Ideally,
In Closing 8 youll uncover its peak Performance point.
Neustar, Inc. 2
Neustar Web Performance Management
Of course, your mileage may vary here. Some people can Thats 10 steps x 1,000 transactions = 10,000 page views.
complete this process with just two tests, but weve found its Lets also assume that we expect each page load to take 5
best to start with three and run additional ones as needed. seconds and the user to wait 5 seconds on each page. This
would give us a total session time of 10 steps x 10 seconds=
Real or Virtual Browsers? 100 seconds. Plugging in 10,000 pages per hour and 100
Thanks to cloud computing, its now cost effective to load test seconds for the session time plus the desired test time (we
a website using real browsers. Real browsers let you create a generally recommend 60 minutes), you get a concurrent user
more life-like load profile, unlike virtual browsers that simply count of approximately 278. Now you know how many users
mimic a browsers http request/response sequence. This is are needed to complete your key transactions.
especially true when testing AJAX and Flash/Flex. With
real browsers, youll also be able to script your scenarios for Test Data and Server/Network Monitoring
your tests faster. In most cases, we highly recommend going To avoid errors during testing, be sure to create an accurate
with the real thing. data set. This can be time-consuming, so start early. It often
means creating individual user IDs for website login or a
How much load should you test with? selection of products available on your site.
The answer comes down to whether you need a stress
test or a load test. The former will find your application Also, make sure you have a plan to monitor everything
infrastructures breaking point, exposing traffic bottlenecks. supporting your applicationnetwork devices, Web servers
The size of the test is based upon the expected total amount and application and database servers. Load testing will
of infrastructure traffic. The rule of thumb: approximately 250 give you all the key front-end metrics. To get the most out
concurrent users for each CPU core that processes front- of your test, youll want to cross-correlate this information
end Web server requests. (This can vary depending on many closely with the performance counters from these various
factors, but 250 is a good starting point.) For example, if you components.
had a new application with 2 front-end Web servers installed
on a quad-core machine, a reasonable load would be 2,000 Configuration
concurrent users (250 users x 2 machines x 4 cores). With your planning firmly in place, youre ready to start load
In contrast, a load test reveals the volume of page views or testing. So whats the best way to configure your test? Lets
transactions your site can accommodate. You can obtain look at all the pieces.
this type of information from Web analytics data such as
Omniture or Google Analytics. Generally, the target volume is Where do you expect your traffic to come
based on the applications peak hour of usage. For example, from?
say 50,000 pages are loaded in your peak hour and you expect Whether this is a new or existing website, you probably have
a 20% increase in traffic in the next few months. Think about a feel for where your visitors will be coming from. A site like
targeting a total load of 75,000 pages views, so you can Amazon will have visitors from around the world, whereas
determine the apps ability to serve up to and above the target the government site for a province in Canada will see mostly
page view count. local traffic. The point is, when running your load test you
want to have users coming from various regions, attempting
Calculating Concurrent Users to emulate your normal traffic. For example, if you were
Its helpful to use a calculator to determine the number of looking to get more users from Asia, it would be worrisome
concurrent users needed to reach your target load. First, if you saw the pages taking twice as long to load from that
though, lets explain the difference between a concurrent access point. All this data will help you forge a better user
user and a unique user. A concurrent user runs through a experience.
transaction from start to finish, then repeats until the test
If you dont have the capacity to apply load from the most
is over. A unique user, on the other hand, is simply a single
important locations, you can also test from other far-flung
execution of a concurrent user or the completion of one
locations. For example, if you need to add Tokyo to get the
transaction (execution of the test script from start to finish).
load you want in your test, here are a few steps you can
Depending on a number of factors, concurrent users are able
take. Find the page load time from Washington, D.C (lets
to generate the traffic equivalent of thousands of unique
say its 2 seconds when there is no load on the site). Then
users over the course of a standard test.
test from Tokyo (lets say the page load time is 4 seconds
Say you have a 10-step checkout process and you want to with no load). This lets you know that Tokyo has a 2 second
ensure the site can handle 1,000 checkouts in one hour. lag, which can help you better interpret results from your
Neustar, Inc. 3
Neustar Web Performance Management
Duration Max Users Type For this example you would want to create 4 test scripts as
2 100 RAMP follows:
4 100 CONSTANT 1. User comes to the homepage and then exits
2 200 RAMP
4 200 CONSTANT 2. User browses a category and then exits
2 300 RAMP 3. User browses for a product and adds that product to the
4 300 CONSTANT cart and then exits
2 400 RAMP
4 400 CONSTANT 4. User browses the site for a product and adds the product to
2 500 RAMP the cart and then checks out
4 500 CONSTANT Once you create the scripts, you apply a percent of the load to
2 600 RAMP each script based on real site traffic. Your checkout process
4 600 CONSTANT may not be able to handle 2,000 concurrent users, but you
2 700 RAMP may never have more than 5% of your users checking out.
4 700 CONSTANT Meaning, the checkout function would need to handle only
2 800 RAMP 100 concurrent users.
4 800 CONSTANT
2 900 RAMP How long do users take when navigating your
4 900 CONSTANT
site?
2 1000 RAMP
4 1000 CONSTANT The next thing to consider is how fast you want the scripts to
execute. By using computers we have removed the human
This basically shows 20 total intervals, 10 ramps and 10 element of looking over the page and figuring out where to
constants. During each ramp, users are added until the click next. We have scripted this and can click the next link
Max User count is reached. During each constant, users are the moment a page has loaded. To better approximate reality
executing scenarios constantly. Whenever users finish a you should consider adding user think time to scripts. If you
scenario or encounter an error, they will immediately start have the right analytics data available, you can figure out
another scenario, loading the site at a constant level. how long a user spends on the home page before making a
selection. As a rule, we use a function that randomizes the
You could apply 1,000 users at the beginning and run them
think time between 3 and 7 seconds after every page load.
over the course of the full hour, but you will get data that only
tells you about 1,000 users. Using the ramp methodology
allows you to pinpoint when events occur.
Neustar, Inc. 4
Neustar Web Performance Management
Content validation is the only way to confirm the right page Youll also want to capture application logs such as Apaches
got downloaded or the right action was performed. You can do error log. Any logging you do during a load test can hinder
this by searching for an appropriate piece of content in every performance slightly, but will ultimately help you pinpoint
step that confirms the validity of each downloaded page. more bottlenecks and errors. The data will help you fine tune
the application, plus determine the additional hardware
Setting Proper Timeouts needed to handle the target load level.
Most Wait For commands correspond to the default timeout. While the test is running, its a good idea to open a conference
We recommend setting the timeout value before the actual bridge with all responsible partiessystem administrators,
transaction begins in the script. Studies show that the ideal database administrators and developers. Having everyones
page load time is 5 seconds. Anything longer doesnt work eyes on the system and application during testing lets you
for real users. However, 5 seconds is too small of a timeout diagnose issues in real time. It also helps you agree on a plan
threshold for load testing, since load times will likely rise for resolving pressing issues. If you attempt a fix while the
with increase in overall load. Hence, 60 seconds to 120 load test is running, consider pausing the test. If the fix is
seconds is ideal. time-consuming and the test has ceased yielding useful data,
consider stopping the test and running another later.
Neustar, Inc. 5
Neustar Web Performance Management
The most useful metrics while running a load test are: Number Analysis
of successful transactions, number of page views, page load
Once your load test is done, youll want to make sense of
times, number and types of errors, and throughput. These are
it all. Youll especially want to point your developers and
detailed further below.
system administrators to the likely causes of problems
youve uncovered.
Successful transactions
What kind of real-time metrics will you get when the test is High-level results
running? For starters, look for successful transactions. This
To get an overview of your test results, begin with successful
shows how many users made it through the entire script flow
page loads per minute. This is a very highlevel view, but it
without any errors. Bear in mind there will probably be a slight
can help you identify if and when your site started having
lag as reporting unfolds. With most testing tools, real-time
problemsand whether those problems were related to site
is an approximation.
performance or full-fledged errors.
Page views Lets assume that were looking at data for a one-hour test
Viewing the number of page views per minute the application split up into 10 six-minute intervals. Also assume we applied
is serving measures your total capacity and provides a 10% of the load during each interval, as we recommended for
simple benchmark. Utilizing a success/failure graph over the configuration. If youre lucky and your site can handle all the
duration of the test will let you easily see a ratio of errors traffic youve thrown at it, youll see results that look more or
versus successes, plus whether the application was able to less like this:
scale as users increased.
Neustar, Inc. 6
Neustar Web Performance Management
Digging deeper: load times These charts show the total number of page requests per
page during each interval (colorcoded to show successful
Now that weve seen our site is in fact suffering under the
and unsuccessful requests). This gives you an idea of how
load, lets get a little more detail on where and when that
error distribution evolved over time. Its best to focus more
happens. First, we need to identify which of our user scripts
on things that went wrong early in the test first. Often, early
are having trouble. Examine the successes/failures graph
problems take up a large share of your servers resources,
for each individual scenario and use the same technique as
which can trigger errors on subsequent pages. Important:
above to find problems. Once weve identified which scenario
You want to track down the root cause of the problem and not
is slowing down, well take a look at a graph of load times by
waste time looking at the symptoms.
page (see chart below):
Neustar, Inc. 7
Neustar Web Performance Management
Other Considerations
One more thing to keep in mind you can always drill deeper.
All of the charts and graphs weve looked at so far represent
aggregate data. Unless youre looking at the individual rows in
your test results, every data point you see has even more data
underneath.
In Closing
We hope this white paper is a useful guide to building an
effective test plan, one that improves your web applications
and performance initiatives. For more information visit www.
neustar.biz/load-testing..
Neustar, Inc. 8
FOR MORE INFORMATION
Visit www.neustar.biz/load-testing
About Neustar
Neustar, Inc., (NYSE: NSR) is a trusted, neutral provider
of real-time information and analysis to the Internet,
telecommunications, technology, financial services, retail,
media and advertising sectors. Neustar applies its advanced,
secure technologies in location, identification, and evaluation
to help its customers promote and protect their businesses.
More information is available at www.neustar.biz.