A.Http Request For HTML page request, the server responds to the page only need to be through Nginx. In the process of the test, you can use top, cat command to get real-time server-side CPU utilization and memory consumption, etc., and write it to the specified file. In order to more intuitive, the test results will be in the form of a line graph to show it. The following two graphs respectively are CPU usage when the number of concurrent clients is 100 and 500
From what has been tested above, CPU utilization is changing at all times, and the increase in concurrent clients led to a substantial increase in server’s CPU utilization. When the number of concurrent clients is 100, CPU utilization fluctuates by 50% for most of the time, with just over 75% CPU utilization at two points in time. When the number of concurrent clients increased to 500, CPU usage increased significantly. There are three periods that CPU usage is more than 75%, indicating that the system is now relatively busy. The next step is through the exploratory test to understand the performance of the server for http requests. Code Shoppy For CPU usage is a dynamically changing data, this paper gives some important test points for CPU usage, and the rest is described in words. After the test, the result can be showed in following charts:
In the chart, you can intuitive to see when the number of concurrent clients below 300, with the increase in the number of concurrent clients, the number of requests is a gradual increase. And when the number of concurrent clients over 300, the number of requests began to decline, indicating that the test server has begun to encounter bottlenecks. When the number of concurrent clients reaches 800, the average number of requests generated per second is even lower than the number of concurrent clients is only 100, indicating that server concurrent performance is declining dramatically. Figure 4 shows the change in average response time with increasing number of concurrent clients. When the number of concurrent clients below 300, the average response time is less than 100ms, indicating that the server at this time can accept 300 concurrent clients access. The response time has doubled when the number of clients over300, but still within 2 seconds. And when the number ofclients more than 800, the response time increased significantly. Response time is approaching 10 seconds whenthe number of clients is 1000. In fact, when the number of concurrent clients after 800, CPU utilization has been quite high. During the test, the CPU usage is above 75% in most time.
CPU has been very busy that keep long-term in a busy state and occasionally reach the limit point (peak to 98%). This indicates that the server is already in a high load state, and the “result code” begins to appear a few internal server errors (error code: 500). When the number of clientsreached 1000, the server has socket errors. CPU usage is close to 100%. During the test the server crashes several times, indicating that this time has reached the limit of the server. Server internal errors account for 5.4% of the total number of responses. For this server, 1000 is the maximum number of concurrent clients that it can accept.
B.PHP Requests For the requests of the PHP dynamic page, the server response need to use Nginx and PHP. Similarly, in order to get the server performance of dealing with the dynamic PHP request, this experiment test the server through the exploration method.
The result here is very similar to the result for testing http requests. With the number of concurrent clients is less than 300, the increase of concurrent clients will lead to a gradual increase in requests. And when the number of concurrent clients over 300, the average number of requests per second begin to decline, indicating that our server has begun to encounter bottlenecks. When the number of concurrent clients reaches 450, the average number of requests generated per second is essentially fluctuating around 140. The number of requests are lower than the number of concurrent clients is only 100, indicating that the server’s concurrent performance declines dramatically.
When the number of concurrent clients below 350, the average response time is less than 1 second, indicating that the server is capable of accepting less than 350 concurrent clients access. When the number of clients over 350, the response time gradually increases, but the increase is not significant. When the number of clients exceeds 400, the response time is more than 2 seconds, and even when the number of clients reaches 650, the response time does not exceed 6 seconds. In accordance with the previous rules of the experiment, now should continue to exploratory testing that continue to increase the number of concurrent clients and continue to press the server. A socket communication error occurs when the number of clients reached 900. The test continues to increase the number of concurrent clients to 1100, then the server crashes. Test has found that when the clients become over 150, the list of the result begin to appear 502 errors, and the proportion is increasing.
When the number of clients is over 250, the 502 error suddenly increased, and the proportion fluctuates around 20%. When the number of users is over 750, the errorproportion is more than 30%, or even 40%. The error shows that the test server directly returns an HTTP status code 502 to the client browser without processing a number of requests. In fact, after users reached 200, the peak of CPU utilization during the test close to 100%. As the number of users increases, the CPU usage is approaching 100% longer and longer, but there is no crashes and user, system and IRQ usage is almost the same. The server appears a large numberof 502 errors, resulting that the server does not properly handle all the requests, which is one of the reason that the PHP dynamic response-time does not significant increase with the clients increase. So in the follow-up optimization process, this is the big problem that need to optimize.
C.SQL Requests In order to respond SQL requests, the server need use Ngnix, PHP and MySQL work together. SQL request is included in the http request and PHP request and the test uses the same method as the above. Figure 9 shows the average number of requests generated per second as the number of concurrent clients increases, while Figure 10 shows the change in average response time.
The highest visit is 19.74 / s, and it shows a linear growth trend with the increase of requests. It shows that although there are so many clients, but the total number of requests issued is not much. For the total number of requests is not much, the response time of 500 clients is acceptable. And even in the case of a substantial reduction in requests, there will still has large 502 errors. When the number of clients reached 250, 502 errors begin to appear and the proportion is about 1.5%. When the number of users is over 300, 502 error proportion reaches nearly 25%. In fact, the performance of the server now is already very poor, and it is not in line with our expectations. The server needs more action to send response information for the SQL request compares to the PHP request. It needmuch time to access the database. Visit Page