"Barber shop model": Performance Testing concepts and theories

Source: Internet
Author: User

Reprinted: http://bbs.51testing.com/thread-136405-1-1.html

In our barber shop, we made the following assumptions in advance:
1. There are three hairdressers in the barber shop;

2. Each barber takes one hour to cut a hair;

3. our customers are all very time-oriented and very picky. They are able to tolerate the waiting time and the haircut time each time they shop at the barber shop. The longer the waiting time, customer satisfaction is lower. Our customers will immediately get angry if they cannot cut their hair in three hours.

Through the above assumptions, we can easily imagine the following scenarios:

1. When there is only one customer in the barber shop, only one barber needs to provide services for him. The other two may continue to wait and may also help with the miscellaneous. One hour later, the customer cut his hair and went out. In this hour, the whole barber shop only served one customer. The customer spent one hour cutting the hair;

2. When there are two customers in the barber shop at the same time, two hairdressers will serve the customers, and the other one will be in a daze or seek help. One hour later, the two customers cut their hair and went out. During the hour, the barber shop served two customers, who spent one hour cutting hair;

3. It is easy to understand that when there are three customers in the barber shop at the same time, the barber shop can serve three customers at the same time within one hour, and each customer will still spend one hour at the time of the haircut;

From the above scenarios, we can find that when the number of customers serving at the same time in the barber shop increases from one to three, as the number of customers increases, the overall work efficiency of the barber shop is improved, but the time spent by each customer in the barber shop is not extended.

Of course, we can assume that when there are only one customer and two customers, the idle hairdresser can help to increase the efficiency of other hairdressers, and each customer's hair clipping time is less than 1 hour. However, even though the service time of each customer is extended as the number of customers increases, the time is always within the acceptable scope of the customer, customers do not need to wait.

However, as barber shops get better and better, there are more and more customers and new scenarios are emerging. Assume that customer A, B, and C had just entered the barber shop to cut hair, and customers D, E, and F had been pushed out. Because customers A, B, and C come first, they have to sit on the bench. One hour later, A, B, and C cut their hair and each of them took one hour to cut the hair. But D, E, and F are not so lucky, because they have to wait until A, B, and C are cut, therefore, each of them takes two hours to cut the hair, including waiting for one hour? Hours.

Through the above scenario, we can find that for the barber shop, three customers are served every hour-1st hours are A, B, C, and the second hour is D, E, F; however, for customers D, E, and F, the "response time" is extended. If you can understand the above scenarios, you can continue to look at them.

In the new scenario, we assume that nine customers are in the barber shop once. Based on the above scenario, it is not difficult to infer that, three out of the nine customers have a "response time" of 1 hour, and three "response time" of 2 hours (waiting for 1 hour + 1 hour for haircut ), there are also three "response times" that are 3 hours (wait 2 hours + 1 hour for the haircut)-reaching the user's tolerable limit. If we change the number of customers in this scenario to 10, we can conclude that one customer will leave the barber shop because the "response time" is too long to be tolerated.

I don't want to mention it. You can also hook up the above scenarios with performance tests. If you still think it is abstract, continue to look at the figure below ^_^

This figure shows a standard software performance model. There are three curves in the figure, indicating Resource Utilization (utilization, including hardware resources and software resources) and throughput (throughput, which refers to the number of transactions per second) and response time ). The horizontal axis in the figure shows the increasing number of concurrent users from left to right.

In this figure, we can see that at the beginning, with the increase in the number of concurrent users, the resource usage and throughput will increase correspondingly, but the response time will not change much; however, when the number of concurrent users reaches a certain level, the resource usage reaches saturation, and the throughput growth slows down or even stops increasing, while the response time is further extended. If the number of concurrent users continues to grow, you will find that the usage of software and hardware resources continues to be saturated, but the throughput starts to drop, and the response time is obviously beyond the user's acceptable range, and eventually the user gave up the request or even left.

Based on this performance, the figure shows three areas: light load (Light Load) and heavy load (heavy load) and buckle zone (the user cannot bear and give up the request ). The number of concurrent users at the junction of Light Load and heavy load is called "the optimum number of concurrent users )", the concurrent users at the junction of heavy load and buckle zone are called "the maximum number of concurrent users )".


When the system load is equal to the optimal number of concurrent users, the overall efficiency of the system is the highest, no resources are wasted, and users do not need to wait; when the system load is between the optimal number of concurrent users and the maximum number of concurrent users, the system can continue to work, but the user's waiting time is prolonged, and the satisfaction level begins to decrease. If the load continues, in the end, some users will not be able to tolerate it, and when the system load is greater than the maximum number of concurrent users, it is doomed that some users will not be able to endure the long response time and give up.


In the example above, three customers per hour are the best concurrent users in the barber shop, and nine customers per hour are the maximum number of concurrent users. When three customers arrive every hour, the barber shop has the highest overall efficiency. When nine customers arrive every hour, the customers who arrive in the past few hours can still endure it, however, as the number of Waiting customers increases and the waiting time grows, there will still be customers unable to endure and leave. At the same time, as the number of customers in the barber shop increases and the working hours of the barber shop extend, the barber will gradually get tired and spend more time cleaning the environment and maintaining order, these factors will eventually cause the barber's work efficiency to decrease as the number of customers increases and the work expands, it may take 1.5 hours or even two hours to cut a hair.


Of course, if there were 10 customers in the beginning, it would be doomed that one customer could not cut his hair.


Further Understanding of "optimal concurrent users" and "Maximum number of concurrent users"


In a specific software and hardware environment, the "optimal number of concurrent users" and "Maximum number of concurrent users" of a tested system exist objectively. Taking "optimal concurrent users" as an example, if the optimal number of concurrent users in a system is 50, once the concurrency exceeds this value, the throughput and response time of the system will inevitably "take longer". If the system load exceeds this number for a long time, it will inevitably lead to a reduction in user satisfaction and eventually reach an intolerable level. Therefore, we should ensure that the optimal number of concurrent users is greater than the average load of the system.


One thing to add is that when we need to put pressure on a system for a long period of time-for example, continuous pressurization for 3-5 days to verify the reliability or stability of the system, the number of concurrent users we use should be equal to or less than the "optimal number of concurrent users"-You can also consider the above discussion as to why ^_^


To identify the maximum number of concurrent users, consider and identify the following two situations:


1. when the system load reaches the maximum number of concurrent users, the response time exceeds the user's tolerable limit-this limit should come from performance requirements, for example, under a certain level of load, the system response time should be less than 5 seconds. It is easy to neglect that the number of customers in the store should not be considered as the "Maximum number of concurrent users" of the barber shop because the customer arrived three hours ago, that is to say, the number of customers in the barber shop three hours ago is the "Maximum number of concurrent users" we are looking ". In addition, this customer's departure is only the beginning, and may lead to more customers leaving because they cannot afford the long wait time;


2. User request failures may occur before the response time reaches the user's tolerable limit. Take the barber shop model as an example. If the barber shop can accommodate only six customers, when seven customers come to the barber shop at the same time, although we can know that all customers can cut their hair within tolerable time, however, due to the limited capacity of the barber shop, one customer had to go back to the house and come back in another day.


For a system, we should ensure that the maximum number of concurrent users of the system is greater than the peak load required by the system.


If you have understood all the concepts mentioned above, I think you can start further thinking and look back at your previous performance tests, see if you can have a new understanding of previous work. You are also welcome to raise your own experiences or questions here to continue the discussion.

Further expansion of barber shop Models


In this section, I will mention some extensions to the barber shop model. Of course, I still only tell the story of the barber shop in reality, as for how to associate these extensions with performance tests and performance solutions, we will continue to think about them. ^_^


Extended scenario 1: Some customers are already old barber shop customers and they are very familiar with hairdressers. They don't have to spend too much time communicating with each other to understand their ideas. In addition, the barber is familiar with the shape of the customer's head, so he can finish a haircut faster.


Extended Scenario 2: barber shops do not only have to cut hair, but also provide services such as bronzing and hair dyeing. When customers make new requirements, A hairdresser may take more than one hour to serve a customer. In this case, it is much more complicated to calculate the waiting time of each customer. Some customers will have a longer waiting time than they expected and eventually leave because they cannot bear it.


Extended scenario 3: With the increase of the perm and hair dyeing businesses, the hairdressers decided on the division of labor, two specialized hair scissors, and one specialized for Perm and hair dyeing.


Expansion scenario 4: The barber shop business is getting better and better, and the number of hairdressers and the appearance of the barber shop cannot meet the requirements of customers, so the barber shop owner decided to open another store next to it, and recruit some hairdressers with better working abilities.


Expansion scenario 5: The barber shop business has become extremely popular. Both stores cannot meet the increasing number of customers, and some customers are beginning to reflect that the road to the barber shop is too far away, after that, too many people will wait too long for Perm and hair dyeing. However, the barber shop owner also understands that the income of perm and hair dyeing is much higher than that of haircut, so he decided to continue to change his strategy and rent a small shop to open a branch in several major nearby communities, full-time hair clipper business; then, a flagship store is opened in the bustling section of the city to serve customers of perm and hair dyeing and VIP customers. Additionally, a 800 phone number is added. When a customer wants to cut the hair, he or she can call the phone number and the service personnel will direct the phone number to the nearest branch based on the customer's place of residence.

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.