The relationship between TPS and transaction response time, calculation formula

Source: Internet
Author: User
Tags memory usage time interval

Example: A high-speed road has 10 entrances, each entrance can only enter 1 vehicles per second 1, please ask 1 seconds up to a few cars.    Tps=10 2, how long each car needs to respond. Reponse time = 1 3, change to 20 cars, can enter several per second.    How long is the response time for each car? TPS = 10,reponse time = 1 (10 are first-class, divided into two equal parts, the average TPS (10/1+10/2)/2=7.5 average response times (2+1)/2=1.5 4, the inlet expands to 20, and can be entered several times per second.    How long is the response time for each car?   TPS = 20,reponse time = 1 5, look, now that the TPS has changed and response times have not changed, is there a relationship between TPS and response time? Wood is related to 6, how to understand.TPS and response times are rated in an ideal state (Lenovo runs a stress test scenario to consider), the entrance as a thread pool, if there are 20 entrances, the concurrency number is only 10, the TPS is 10, and the response time is always 1, indicating that the number of concurrency is not enough, need to increase the number of concurrency to the peak of TPs. 7. Same as 20 entrances, what happens to TPS and response time if the concurrency number becomes 100?   Concurrent number to 100, there will be traffic jams, traffic jams on average each car in the past time is long, the 100 cars in 201 parts into 5 parts, the 5th part of the waiting time is the longest, from the waiting to start to this car into the actual cost of 5 seconds, the 100 cars are past response time is (5 +4+3+2+1)/5=3, the average TPS is (20/1+20/2+20/3+20/4+20/5)/5=9.13 (How I feel should be 100/(5+4+3+2+1) =6.67 The total number of transactions completed/time to complete the transaction, The TPS calculated using this method will be slightly smaller, can be multiplied by 1.5 times as the current TPS) 8, so, TPS and response time is the inverse of the macroscopic relationship, but the two are actually directly related to wood, in the above example, the system has only 20 threads, 100 of the concurrency will cause the thread to wait, The average response time is increased from 1 seconds to 3 seconds, and the TPS is reduced from 20 to 9,tps and the response time is calculated separately and not computed from each other.   9, it is also known that, in the case of concurrent volume remains unchanged, there are several ways to improve TPS.   A, increase the number of thread pools (ingress) B, reduce the time per vehicle entry (that is, increase the processing efficiency of individual threads)   10, see the difference between these 2 from the definition of TPS and response time.   TPS = the number of times each transaction passes, fails, and stops in each second that the scene or ashing step is running   that is, TPS = Total Pass, total number of failed transactions/elapsed time of the entire scene;   reponse times = Each transaction completes the actual need Number of times/transactions   Therefore, these 2 things are all related to wood.  -------------------------------------------------------------------------JMeter Aggregation report, throughput = Number of transaction completed/time required to complete these transaction, average response time = sum of all response times/number of transaction completed, failure rate = number of failed/transaction.Another method of calculating TPS in performance testing:

In the performance testing process, the development of a performance test program is a very important part, which will involve the development of some indicators, the most important indicator is TPS (processing transactions per second), which is used to measure the system's processing capacity of an indicator, followed by response time. Let's talk about how to define these two indicators in the actual work:

1, TPS indicators, can be selected in the production process in a year before the maximum value of a transaction in a day, and then in this day in minutes, List a time table, take the largest volume of one minute, and then use this volume divided by the number, then the TPS can be obtained, It is then multiplied by 1.5 times times as the current TPS target, multiplied by another 1.5 or twice times in the second and third years.

2, response time, according to the characteristics of the business definition, plug-in transactions generally within 3 seconds.

-------------------------------------------------------------------------------

TPS, number of transactions completed per second

"80/20" principle:

The principle of "80/20" is based on the principle of "important minority and trivial majority", which is programmed to prioritize priorities according to the "importance" of the matter. This principle was proposed by Vieve Beritu, an Italian economist and sociologist in the late 19th century and early 20th century. The main idea: in any particular group, the important factor is usually only a few, and the unimportant factor is the majority, so as long as the control of the importance of a few factors can control the global. This principle has evolved over the years and has become the "80/20" principle known to the management community today-that is, 80% of the value is from 20% factors, while the remaining 20% of the value comes from 80% factors.

One important revelation of the "80/20" principle to all people is to avoid spending time on trivial most issues, because even if you spend 80% of your time, you can only achieve 20% of the effect: you should spend your time on a few important issues, because you have to take the most important few questions, and you only spend 20% of your time can achieve a 80% effect.

In the software testing work, the "80/20" principle is mainly applied to the analysis of defect distribution and performance test requirements. Defect distribution analysis, which refers to the 80% bug is found in 20% of the program code, which is actually the defect of the "cluster phenomenon." The following is mainly about the "80/20" principle in the performance testing requirements analysis of the application.

In the performance test requirements analysis, the "80/20" principle is understood as follows: 80% of the daily business is completed in 20% of the time. For example: The annual business volume is concentrated in 8 months, 20 working days per month, 8 hours per day, that is, 80% of the daily business volume within 1.6 hours of completion.

Here is a practical example of the "80/20" principle applied to performance testing requirements analysis.

Last year, about 1 million business transactions, of which 15% of the business process, each business needs to submit 7 requests to the application server, 70% of the business process, each business needs to submit 5 requests to the application server, the remaining 15% of the business process, each business needs to submit 3 requests to the application server. According to previous statistical results, the annual business increment of 15%, taking into account the needs of the next 3 years of business development, testing needs to be twice times the existing business volume.

The test strength estimation method is as follows:

The total number of requests per year is (100*15%*7+100*70%*5+100*15%*3) *2=1000 million times/year

The number of requests per day is 1000/(8 months * 20 days) = 62,500 times/day

Requests per second is (62500*80%)/(8 hours *20%*3600 seconds) = 8.68 Times/sec

That is, the application server should be able to handle requests up to 9 times per second.



PS: The following are the main concepts and calculation formulas for performance testing, which are documented below:

A. System Swallow metric elements:

The Swallow metric (pressure capability) of a system is closely associated with the request for CPU consumption, external interfaces, Io, and so on.

The higher the CPU consumption of a single reqeust, the slower the external system interface and IO effect, the lower the system throughput capacity, and the higher the reverse.

Several important parameters of system throughput: QPS (TPS), concurrency, response time

QPS (TPS): number of request/transactions per second

Concurrent Number: the number of request/transactions that the system processes concurrently

response Time: Average response time is generally taken

(a lot of people often confuse concurrency with TPS understanding)

Once you understand the meaning of the above three elements, you can deduce the relationship between them:

QPS (TPS) = concurrency number/average response time

A system throughput is usually determined by the QPS (TPS), the number of concurrent two factors, each system these two values have a relative limit value, under the application scenario access pressure, as long as a certain item reached the highest system value, the system throughput will not go up, if the pressure continues to increase, the system throughput will decline, The reason is that the system is overloaded, and other consumption such as context switching, memory, and so on is causing system performance degradation.

Determining system Response Time elements

We do the project to schedule, can more than one concurrent multi-task, can also be a person or many people serial work, there will always be a critical path, this path is the project duration.

The response time of a system call is the same as the project plan, and there is a critical path, which is the system impact time;

The critical path consists of CPU operation, IO, External system response and so on.

two. System Throughput Evaluation:

We need to consider the effects of CPU operation, IO, External system response and the preliminary estimation of system performance when we are doing system design.

And in the usual circumstances, we face the demand, we evaluate out the QPS, concurrency, there is another dimension: Day PV.

By observing the system's access logs, it was found that, in the case of a large number of users, the same time period in each time period of access traffic is almost the same. Like every morning on weekdays. As long as we can get the daily flow chart and the QPS we can calculate the daily traffic.

The usual technical methods:

1. Find the highest TPS and PV in the system, the two elements have a relatively stable relationship (in addition to holiday, seasonal factor effects)

2. The highest TPS is obtained by means of a stress test or an empirical estimate, followed by a 1 relationship to calculate the maximum daily throughput of the system. Business Chinese and Taobao are not the same customer base, the network behavior of these two customer groups do not apply, the TPS and PV relationship between them are not the same ratio.

A) Taobao

Taobao flow chart:

Taobao's relationship between TPS and PV is typically up to TPS:PV approximately 1:11*3600 (equivalent to 11 hours of access to the highest TPS, this is the scene of the commodity details, different scenarios will be somewhat different)

B) Business-to-business Chinese station

The relationship between business-to-business TPS and PV systems varies from system to application, with a rough estimate of 1:8 hours of relationship (09 traffic analysis data for offerdetail). Wang Pu and offerdetail the two proportions of the difference is very large, may be due to the high percentage of reptile temporary cause.

In the Taobao environment, assuming that we stress test the TPS is 100, then the system's daily throughput =100*11*3600=396 million

This is in the case of simple (single URL), some pages, a page has multiple request, the actual throughput of the system is also small.

Regardless of time-to-think (T_think), there is a relationship between the measured TPS value and the number of concurrent virtual users (u_concurrent) and the transaction response time (t_response) of LoadRunner read (Stable operation):
Tps=u_concurrent/(T_response+t_think).

Relationship between concurrency number, QPS and average response time

Source: http://www.cnblogs.com/jackei/ Basic concepts and computational formulae for software performance testing

first, the focus of software performance

Performance testing of a software needs to focus on those performance.

We think about what roles are involved in software design, deployment, use, and maintenance, and then consider what the performance points are for each of these roles, and what we should focus on as a software performance test engineer.

first of all, the purpose of software development is to allow users to use, we first stand in the user's perspective analysis, users need to pay attention to what performance.

For the user, when clicking on a button, link or issuing an instruction to start, to the system to show the results of the user-perceived form, the process of the time spent is the user of the software performance of the intuitive impression. That is what we call response time, when the corresponding hours, the user experience is very good, of course, the user experience response time includes individual subjective factors and objective response time, in the design of software, we need to consider how to better combine these two parts to achieve the best user experience. Such as: The user in the large data volume query, we can first extract the data presented to the user, in the process of the user to continue the data retrieval, then the user does not know what we are doing in the background.

The user is concerned about the corresponding time of the user action.

Second, we stand in the administrator's perspective to consider the performance points that need attention.

1, the corresponding time
2, the use of server resources is reasonable
3, Application Server and database resources use is reasonable
4, the system can be extended
5, the maximum number of user access to support the system, the maximum amount of business processing capacity
6. Where can the bottleneck of system performance exist
7, replace those devices can improve performance
8, the system can support 7x24 hours of business access

once again, stand on the development (design) staff angle to consider.

1, the structure design is reasonable
2, the database design is reasonable
3. Is there any performance problem with the code?
4. Is there any unreasonable memory usage in the system?
5, whether there is unreasonable thread synchronization in the system
6, whether there is unreasonable resource competition in the system

So what do we have to look at in terms of performance test engineers?

In a word, we should pay attention to all the above performance points.

Ii. Several key terms of software performance

1. Response Time: The time required to respond to the request

Network transfer time: N1+N2+N3+N4

Application Server processing time: A1+A3

Database server processing time: A2

Response Time =n1+n2+n3+n4+a1+a3+a2

2, the calculation formula of concurrent user number

Number of system users: the number of system-rated users, such as an OA system, the total number of users who may use the system is 5,000, then this number is the number of system users.

Simultaneous online Users: The largest number of simultaneous online users within a certain timeframe.
Simultaneous number of users on-line = number of requests per second RPS (throughput) + Concurrent connections + average user think time

Calculation of the average concurrent user count: c=nl/t

Where c is the average number of concurrent users, n is the average number of access users per day (login session), L is the average time of the day the user logs on to the exit (the average time of the login session), T is the length of the study (how long the user uses the system within a day)

Peak Concurrent User count: c^ approximately equals C + p

Where c^ is the peak of concurrent users and C is the average number of concurrent users, the formula follows the Poisson distribution theory.

3, the calculation formula of the throughput

The number of requests that the system processes the user within a unit of time

From a business perspective, throughput can be measured by: Number of Requests/sec, pages per second, number of people per day, or number of transactions/hours per hour.

From a network point of view, throughput can be measured in bytes per second:

For interactive applications, the throughput metrics reflect the pressure on the server, and he can demonstrate the load capacity of the system

The throughput expressed in different ways can illustrate different levels of problems, such as the number of bytes per second can be expressed in terms of network infrastructure, server architecture, Application Server constraints and other aspects of the bottleneck; the number of requests/sec representation is primarily a bottleneck by the application server and application code constraints.

When there is no performance bottleneck, there is a connection between throughput and the number of virtual users, which can be calculated using the following formula: F=vu * R/

Where F is the throughput, VU represents the number of virtual users, R represents the number of requests per virtual user, and T indicates the time spent in the performance test

4. Performance counter

is a number of data metrics that describe the performance of a server or operating system, such as the use of memory, process time, and the role of "monitoring and analysis" in performance testing, especially when it comes to analyzing all the scalability and performing new performance bottleneck positioning.

Resource utilization: Refers to the use of various resources of the system, such as the CPU occupancy rate is 68%, the memory occupancy rate is 55%, generally use "resource actual use/Total resources available" to form resource utilization.

5, the calculation formula of thinking time

Think time, from a business point of view, this refers to the time interval between each request when the user is doing the operation, and in order to simulate such a time interval, the concept of think time is introduced to simulate the user's operation more realistically when doing the new performance test.

In throughput this formula F=vu * r/t shows that throughput F is a function of the number of VU, the number of requests per user R, and the time t, where r can be calculated using time t and user think time TS: R = t/ts

Here is a general step for calculating the think time:

A, first calculate the number of concurrent users of the system

c=nl/t F=RXC

B, statistics the average throughput of the system

F=vu * r/t rxc = VU * r/t

C, statistics on the average number of requests issued by each user

R=u*c*t/vu

D. Calculate the think time according to the formula

Ts=t/r

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.