Introduction
Why I write this blog, because recently a lot of Jingdong Cloud Jae User response a problem is that they deployed in Jae application access is very slow, there are very few applications or even frequent 504 timeout phenomenon, of course, the first thing we think of is Jae performance is too bad, this is human nature, Often there are mistakes when the first thought is the bad of others, work many colleagues are also the case, if the software system appears a bug first doubt is not the code you write. Taking the time to write this blog today is mostly about telling people how to make sure that we are deploying on a PAAs platform (not just jae OH) why is the Web application slow? Where's the slow? Is there any way to solve it?
Cause analysis
The advent of access to their Web applications slowly from the macro can be summed up below three points:
(1) Slow network: Specifically, the network between the visitor and the PAAs platform where the Web application is deployed is slow;
(2) PAAs platform performance problems: specifically for a variety of reasons that the PAAs platform can not be very good service deployed on its application;
(3) Web application itself slow: for a variety of reasons (frequently read and write disk, a large number of time-consuming computing, resource competition, etc.) cause Web applications can not quickly respond to visitor requests.
The above three points are mainly summarized in the Web application access path, because the Web applications accessing the PAAs platform first need to pass through the network, then through the PAAs platform filtering and forwarding processing, and finally to the Web application itself processing. Any problem with any of these three links will cause Web application access to become slower. Know the reason, we also need to determine which part of the problem, the following is to say how to locate specific links.
Locate specific reasons
The above analysis of the three reasons, in addition to the second reason, everyone can locate and exclude themselves, first check the network, in order to more accurately we can remove from the aspect:
(1) First check to visit other Web site is very slow phenomenon, if soon, then your network must be generally normal;
(2) access to the corresponding PAAs platform to provide relevant sites and PAAs platform of the company's Web site, such as Jae, you can visit the Jingdong Mall main station and Beijing East Cloud platform home and so on, BAE can visit Baidu related sites, SAE can visit Sina related websites, Because these affiliate websites are generally deployed in the same room or the same city, if these sites are also very slow, it is likely that these Web sites related to network problems or access to a large number of sites, resulting in the export of these websites and the speed of access to slow, that is, the ability to provide services to carry out, if there is no problem, Then can eliminate the large network environment is no problem;
Excluding the network factors, we can eliminate the following two reasons, because the performance of the PAAs platform is basically transparent to the user, that is, users basically do not know, so you can skip the exclusion of this reason, of course, there is a means, but a little more complex, so inconvenient for all users, If this is the case, it would be best to give it to the developers of the PAAs platform for processing.
The last reason is, of course, the implementation of the Web application itself, I found that many user feedback Web site access is slow because of their own code implementation problems.
The first problem of the site most of the sites have a certain amount of traffic, especially a certain period of time there is a large number of visits, and frequently read and write disk. To locate this reason, I want you to use the Web Performance test tool for your local application deployment, such as the more commonly used Web performance test Tool AB, which is a handy test tool from Apache, which is easy to install and use with Ubuntu, for example, when we enter AB directly in the console, If not installed, the Ubuntu system will be prompted as follows:
The program ' AB ' are currently not installed. Can install it by typing:
sudo apt-get install apache2-utils
Then installation prompts installation, after the successful installation we can use AB software for our deployment in the local Web application performance test evaluation, the command is as follows:
AB-N1000-C10 http://localhost/
The above command means to send a total of 1000 requests, each 10 concurrent requests, access path is the local Web server root path, the result is as follows:
This is apachebench, Version 2.3 < $Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to the Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (Be patient)
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed 900 Requests
Completed 1000 Requests
Finished 1000 requests
Server software:apache/2.4.6
Server Hostname:localhost
Server port:80
Document Path:/
Document length:177 bytes
Concurrency Level:10
Time taken for tests:0.075 seconds
Complete requests:1000
Failed requests:0
Write errors:0
Total transferred:446000 bytes
HTML transferred:177000 bytes
Requests per second:13283.74 [#/sec] (mean)
Time per request:0.753 [MS] (mean)
Time/request:0.075 [MS] (mean, across all concurrent requests)
Transfer rate:5785.69 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:0 0 0.1 0 1
Processing:0 1 0.2 0 2
waiting:0 0 0.2 0 2
Total:0 1 0.1 1 2
Error:the median and mean for the processing time are more than twice the standard
Deviation apart. These results are are not reliable.
Percentage of the requests served within a certain time (MS)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 2 (Longest request)
This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/tools/