Cluster Server uses NGINX+FPM (PHP) structure, this structure of the performance of a large degree of bottleneck in the FPM layer, with the business development, the increase in traffic, in order to ensure the user experience, we are through various means to improve the throughput and service quality of the cluster-machine expansion, business sub-pool, mc/ Redis localization and so on, do down to see the effect is obvious, but the magnitude of the upgrade is still urgent need, so think of the Web server in the next effort, the use of the Nginx version of the cluster is a bit of history, the version is not said, but has been running are very strong, so did not want to change, A simple thing prompted me to test the change to Tengine, which is the setting of the number of worker processes. Our server cluster distributed around, the configuration file is puppet unified issued, the server CPU core number 8, 12 cores, nginx only support worker process number write number, the current line is set 12, that is 8 core CPU 12 working process, All with Nginx know, this will appear some inexplicable error, and Tengine is can support auto's writing, so according to the core number of CPU automatically start corresponding number of worker process, stumbled, did not think upgrade after the performance is the increase of the volume, the process does not say, Look at the data comparison before and after the upgrade, the data are the actual monitoring of the production environment:
The number of active connections is monitored as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/82/DB/wKioL1divTGh34h4AAA3nadnU4Q905.png "title=" Number of active connections after upgrade 2.png "alt=" Wkiol1divtgh34h4aaa3nadnu4q905.png "/>
Upgrading from 3 o'clock in the afternoon, in the same environment only upgraded the Web server under the conditions (QPS around 300 to 500), the number of active web connections down to the original One-third and remain stable, we all know that if the same number of requests, The faster the processing of nginx active connections will be less, processing slow to the number of active connections and TCP accumulation, speculation performance is very good, but this data does not explain the problem, because ultimately to see the quality of user access, continue to check the data analysis.
The response time of the log is compared as follows (1 hours):
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/82/DB/wKioL1dixGDQne73AAAsYdnFbdI279.png "title=" Qq20160616231732.png "alt=" Wkiol1dixgdqne73aaasydnfbdi279.png "/>
Note: The time is the interval, the first is less than 10ms, the second is greater than 10 less than 30ms, the third is greater than 30 less than 50ms, and so on ...
From the chart can be clearly seen before and after the upgrade of the corresponding time comparison, if the 30ms and 100ms for the two-sill comparison (500ms above we even timeout), the 30MS response request from the original 20% increased to 80%, if the calculation of the request within 100ms from the original 68% Rose to 92%, compared to the appearance of more than 1s should be requested from the original 3.9% to less than 1% of the amount, it can be said that the effect is very obvious, performance increased several times, tengine in some respects is a sharp weapon, of course, the upgrade process also encountered some configuration on the small twists, in short, business performance optimization never-ending, Tengine is an excellent and fpm-paired Web server.
Finally, the image of a picture of the comparison:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/DC/wKiom1diyVTzSP_gAAC78MBJG2c753.png "title=" Qq20160616234312.png "alt=" Wkiom1diyvtzsp_gaac78mbjg2c753.png "/>
This article is from the "Running Linux" blog, so be sure to keep this source http://benpaozhe.blog.51cto.com/10239098/1790098
Upgrading the old Nginx cluster to Tengine cluster, and improving performance several times