Chapter 9 Performance Testing
Chapter 9 Performance Testing
wuchenni@qq.com
Contents
Performance Testing
2
9.1 What is performance?
销售甲:“我们的系统功能那是相当的强大,完全能够满足您
所有的功能需求。”
客户乙(使用后……):“果然不错!合作愉快!”
……(一个星期后)
项目经理甲:“上星期不是试过了吗?怎么会慢呢?”
客户乙:“1个人用是没问题,但是我们公司有1000个员工使
用这个系统,一个查询的操作要等1分钟,还时不时就崩溃,简
直无法忍受!!”
销售甲:…… 3
9.1 What is performance?
4
9.1 What is performance?
5
9.1 What is performance?
• Latency:
– The time interval between the instant at which an
instruction control unit issues a call for data and the
instant at which the transfer of data has started; the
delay between request and completion of an
operation.
• Transaction processing time:
– The transaction processing time refers to the running
time needed to complete a transaction, used to
evaluate the transaction processing efficiency. Usually,
the shorter time a transaction needed, the higher the
efficiency is.
6
9.1 What is performance?
• Database performance :
– Database performance indicators generally include
the time needed for search, insert, and delete and
update the database, etc, due to database
performance is often the bottleneck of software
system performance, so it is very necessary to test
database performance.
• The largest consumption of memory:
– The largest consumption of memory shall be
equipped what level of hardware to run software, it is
the direct reflection of hardware cost. The largest
consumption of memory can be tested with a
performance monitor.
8
9.1 What is performance?
• Resource consumption:
– The amount of memory or disk space
consumed by the application.
• Peak time of memory:
– The running time for software consumes in
peak period of memory. If it is closer for the
software used in the peak of memory and
system total memory, the efficiency of software
will be greatly reduced. So, reduce the peak
time of memory can improve software
performance.
9
9.1 What is performance?
10
9.1 What is performance?
• Response time:
– Response time refers to the time that needed for
requests make a response, it can divide into
transmission time, application latency time, database
latency time and present time, etc.
• System response time:
– Application system consumptive time from sending a
request to client receiving data.
• Present time:
– Present time depends on the consumption time for
presenting page after the data received by the client.
11
9.1 What is performance?
• Page response time decomposition for a web
application
Network Database
The client Web server
server
N1 A1 N2
A2
N4 A3 N3
12
9.1 What is performance?
• 一个用户访问一个独立页面时,页面给予用户响
应并有所显示时,等待不同时间的态度分布:
– 10秒钟之内,84%的用户愿意等待
– 15秒钟之内,51%的用户愿意等待
– 20秒钟之内,26%的用户愿意等待
– 30秒钟之内,5%的用户愿意等待
13
9.1 What is performance?
• 5s — Relatively good
14
9.1 What is performance?
• Concurrent users
– Generally divide kind of case:
• Strictly concurrent, that all users at the
same time doing the same thing or
operation.
• Broad category of concurrent, multiple
users send out a request to system or
make a operation, but these operations can
be the same, also can be different.
15
9.1 What is performance?
• Performance testing is concern to concurrent users of
business, how many concurrent users should be set from
the angle of business is proper.
• The following are the concurrent users estimate formula:
nL
C=
T
• C — Concurrent users on average
• n — The number of logon session
• L — The average length of logon session
• T — Inspection period length
Cˆ C + 3 C
16
• 例题:
• 一个软件系统每天约有400个用户访问。用户在一天
之内有8小时内使用该系统,从登录到退出的平均时
间为4小时,请计算该系统的并发用户数和并发用户
的峰值各是多少?
• 分析:根据公式C=400×4/8=200
Ĉ =200+3 200 =242
17
9.1 What is performance?
18
9.1 What is performance?
19
9.1 What is performance?
20
9.1 What is performance?
• Meet performance bottlenecks status, throughput and
VU number will not meet formula.
• Below is "throughput - VU number" correlation chart
examples.
• A and B indicate two different performance tests for
the same software system.
– Test A have 100 concurrent users, each VU send 1 request
pre 1 second;
– Test B have 1000 concurrent users, each VU send 1
request pre 10 seconds.
21
9.1 What is performance?
Test A — Graph a
60.00
page numbers Per second
50.00
40.00
30.00
20.00
10.00
0.00
50 100 150 200 250 300
22
VU numbers
9.1 What is performance?
Test B — Graph b
35.00
page numbers Per second
30.00
25.00
20.00
15.00
10.00
5.00
23
0.00 500 1000 1500 2000 2500 3000
9.1 What is performance?
• Dormancy time
– Dormancy time also called thinking time, it is
point to the user requests time intervals.
– Therefore, automation test emulates user
operation, test scripts must let each operating
interval for a period of time, in operating
statements setting dormancy time by function
Think(), realize waiting time between two
operations.
– There are certain relationship between the
dormancy time, iterations, concurrent users
and throughput. 25
9.1 What is performance?
N vu R T
F= R=
T T s
26
9.1 What is performance?
27
9.2 What is performance testing?
28
9.2 What is performance testing?
29
9.2 What is performance testing?
• Load Testing
– Load Testing determine the applications
behavior under load, up to and including its
limits (not just at its limits).
– Load testing specifically refer to the load size
(number of concurrent users) and related
values.
30
9.2 What is performance testing?
• Load Testing
– Load testing is simulated practical software system
load conditions under the system load, through the
continuous load additions (increasing the number of
virtual concurrent users) or other loading additions
ways to observe the performance indicators under
different load system , such as response time and
data throughput, system resources utilization (CPU
and memory), to test the behavior and characteristics,
discovery possible performance bottlenecks of the
system, memory leaks and other problems like cannot
achieve synchronization.
31
9.2 What is performance testing?
32
9.2 What is performance testing?
33
9.2 What is performance testing?
• One-time loading:
– One-time loading a number of users, at
a certain period of time keep on running .
– For example, in the morning when start
working it is time to access web site or
land the website very concentrated,
basically fall into flat load mode.
34
9.2 What is performance testing?
• Increasing loading:
– Increase the users by a regular and gradually
way to add some new users per second,
crisscross rise.
– Assistant by this kind of loading to test, easy
to find inflection points of performance,
namely performance bottlenecks.
35
9.2 What is performance testing?
36
9.2 What is performance testing?
37
9.2 What is performance testing?
• Stress Testing
– Stress testing determines the applications
ability in strong load test (handle large
amounts of data, large numbers of concurrent
users).
– Stress testing can be much more successful
with a full load applied to the server.
– Running addition applications on the server in
conjunction with the client side tests is an
additional form of stress testing.
38
9.2 What is performance testing?
39
9.2 What is performance testing?
40
9.2 What is performance testing?
42
9.3 What are the types of performance
tests?
• Testing which is driven by what we want to measure
– Response time testing; Throughput testing
• Testing which is based on the source or type of the load
– Load variation/bounce testing
• Vary the test load during the performance measurement, to
reflect the typical pattern of how the real load ebbs and flows
over time.
– Calibration(校准) testing
• Check a system against mandated requirements such as those
from a government regulatory agency.
• Testing to stress the system or find its limits
– Deadlock testing
• Running volume tests to detect if there are resource contentions
in the system such as multiple requestors trying to access the
same data base and causing the system to lock up the user
request due to conflicts in areas like data base record locks.
43
9.4 How to conduct performance testing?
Modeling Paradigm
44
9.4 How to conduct performance testing?
Step1:Planning
• Understanding load
– Once we have an idea of what we want to
accomplish
• The general type of testing we want.
• What tests we want to run.
– Now we have to decide on the volume of
activity and the composition of that volume,
load (i.e. workload)
45
9.4 How to conduct performance testing?
Step1:Planning
46
9.4 How to conduct performance testing?
Step1:Planning
47
9.4 How to conduct performance testing?
Step1:Planning
30 3%
100 10%
200 25%
1,000 50%
48
9.4 How to conduct performance testing?
Step1:Planning
Central
Mountain
Pacific
49
9.4 How to conduct performance testing?
Step1:Planning
Browsers
Buyers
50
9.4 How to conduct performance testing?
Step1:Planning
51
9.4 How to conduct performance testing?
Step1:Planning
• Concurrency
52
9.4 How to conduct performance testing?
Step1:Planning
• Thinking time
53
9.4 How to conduct performance testing?
Step1:Planning
54
9.4 How to conduct performance testing?
Step1:Planning
55
9.4 How to conduct performance testing?
Step1:Planning
56
9.4 How to conduct performance testing?
Step2~Step4
58
9.4 How to conduct performance testing?
Step2~Step4
59
9.4 How to conduct performance testing?
Step2~Step4
• Virtual users generator
– Used to capture the end user business
processes and create test scripts, namely by
recording the application in the typical end
users executive of operation, record to
automatically virtual users (Vuser) script, so
that as the load testing foundation.
– Virtual users include: C Vuser, VB Vuser, VB
script Vuser, JAVA Vuser, Java Script
Vuser……
60
9.4 How to conduct performance testing?
Step2~Step4
• Controller
– Used to organize, driving, management and
monitoring load testing central control.
– Use controller can run used to simulate real
executed operation script, and may through
let multi-Vuser simultaneously execute these
operations to create load in the system.
61
9.4 How to conduct performance testing?
Step2~Step4
• Load Generator
– Load generator to run the virtual users, to
produce efficient, monitoring load.
• Analysis
– Help to check , analysis and comparison the
result of performance and use the reports and
graphs to label and determine the application
bottleneck, and make sure that needs to
change to improve system performance of the
system.
62
9.4 How to conduct performance testing?
Step5:Analyze
63
9.4 How to conduct performance testing?
Step5:Analyze
64
9.4 How to conduct performance testing?
Step5:Analyze
Both Load
Generator CPU’s
are spiking to 100%
65