Test client A:HP dl380g4,2 dual-core CPU,4G ram,2 Block 10k RPM SAS disk for RAID 1,EXT3
Nginx Server B:dell r710,e5620 * 2,32g ram,6 block disk 15K RPM SAS disk RAID 1+0,XFS
memcached Server C:dell r710,e5620 * 2,32g ram,6 block disk 15K RPM SAS disk RAID 5,EXT4
Nginx setting: KeepAlive 8192
PHP fpm Settings: Listen.backlog = 1
memcached Start parameter: memcached-d-M 24576-p 12000-c 10240
Kernel parameters:
net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_tw_reuse = 0net.ipv4.tcp_timestamps = 1
The explanations for these kernel parameters can be referenced in the following: 2.12. Reduce TCP Performance Spikes
Using PHP to connect to the local Nginx proxy, access remote memcached data;
Direct connection to remote memcached server using PHP;
Initiate concurrent tests with AB from the test client;
The concurrent threads start from 64 until 2048, respectively, and are 64 n times;
Each concurrency mode is tested in 5 rounds and the average is averaged;
The key length stored in the memcached is 96 characters long and the value is 400 characters long and is always randomly generated;
Conclusions and recommendations:
PHP Program through HTTPMEMCMC access to memcache and direct access to memcached efficiency and not much loss;
The use of PHP direct access to memcached, the number of failures compared to through the HTTPMEMCMC has a larger increase, should be HTTPMEMCMC in the keepalive aspect more advantageous;
Follow-up will be a test, adjust nginx, PHP and kernel-related parameters, and then do the comparison;
This test does not mix with the normal HTTP request, the test result does not have the absolute reference value;
Judging from the results of this test alone, HTTPMEMCMC deserves to have:)
Adjust the above kernel parameters:
net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_timestamps = 1
650) this.width=650; "class=" Alignnone size-medium wp-image-156 "alt=" nginxhttpmemcmc-vs-nativemc-benchmark-2013091305 "src=" http://imysql.com/wp-content/uploads/2013/09/ Nginxhttpmemcmc-vs-nativemc-benchmark-2013091305-300x180.png "width=" "height=" "style=" margin:0px;padding : 0px;border:0px;vertical-align:baseline;height:auto; "/> 650) this.width=650;" Class= " Alignnone size-medium wp-image-157 "alt=" nginxhttpmemcmc-vs-nativemc-benchmark-2013091306 "src=" http://imysql.com/ Wp-content/uploads/2013/09/nginxhttpmemcmc-vs-nativemc-benchmark-2013091306-300x180.png "width=" 180 "height=" "Style=" Margin:0px;padding:0px;border:0px;vertical-align:baseline;height:auto; "/> 650) this.width=650;" class= "Alignnone size-medium wp-image-158" alt= "nginxhttpmemcmc-vs-nativemc-benchmark-2013091307" src= "/http Imysql.com/wp-content/uploads/2013/09/nginxhttpmemcmc-vs-nativemc-benchmark-2013091307-300x180.png "Width=" 300 " height= "style=" Margin:0px;padding:0px;border:0px;vertical-align:baseline;height:auto, "/> 650) this.width=650;" Class= "Alignnone size-medium wp-image-159 "alt=" nginxhttpmemcmc-vs-nativemc-benchmark-2013091308 "src=" http://imysql.com/wp-content/uploads/ 2013/09/nginxhttpmemcmc-vs-nativemc-benchmark-2013091308-300x180.png "width=" "height=" "style=" margin:0px; Padding:0px;border:0px;vertical-align:baseline;height:auto; "/>
Note: Since 2 test cases, each concurrent thread request number is different, so you will find that the data on both sides can not be directly compared, this is my fault, sorry.
After the kernel has been adjusted:
1. It can be found that the average efficiency of HTTPMEMC is only NATIVEMC 72.62%;
2. Tuning the kernel TCP parameters is very helpful to improve TCP efficiency, Failed requests number of times is completely 0;
3. Because of the increased memcached connectivity and the benefits of transparent procedures, even if the HTTPMEMC performance is not as good as NATIVEMC, the loss is not very strong and still acceptable;
--------------------------------------Split Line--------------------------------------
http://zhishuedu.comTraining is a professional quality training brand jointly launched by senior MySQL expert Ye Jinlong and Wu Bingxi, with MySQL dba combat optimization and Python devops Development course, which is the most conscientious and The most quality training courses.
This article is from the "Lao Ye teahouse" blog, please be sure to keep this source http://imysql.blog.51cto.com/1540006/1879883
Nginx httpmemcmodule and Direct access memcached efficiency comparison test