Nginx httpmemcmodule and Direct access memcached efficiency comparison test

Source: Internet
Author: User
Tags benchmark nginx server dell r710 e5620

    • Test environment:

    1. Test client A:HP dl380g4,2 dual-core CPU,4G ram,2 Block 10k RPM SAS disk for RAID 1,EXT3

    2. Nginx Server B:dell r710,e5620 * 2,32g ram,6 block disk 15K RPM SAS disk RAID 1+0,XFS

    3. memcached Server C:dell r710,e5620 * 2,32g ram,6 block disk 15K RPM SAS disk RAID 5,EXT4

    4. Nginx setting: KeepAlive 8192

    5. PHP fpm Settings: Listen.backlog = 1

    6. memcached Start parameter: memcached-d-M 24576-p 12000-c 10240

    7. 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

    • Test scenario:

    1. Using PHP to connect to the local Nginx proxy, access remote memcached data;

    2. Direct connection to remote memcached server using PHP;

    3. Initiate concurrent tests with AB from the test client;

    4. The concurrent threads start from 64 until 2048, respectively, and are 64 n times;

    5. Each concurrency mode is tested in 5 rounds and the average is averaged;

    6. The key length stored in the memcached is 96 characters long and the value is 400 characters long and is always randomly generated;

    • Test results:

Conclusions and recommendations:

    1. PHP Program through HTTPMEMCMC access to memcache and direct access to memcached efficiency and not much loss;

    2. 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;

    3. Follow-up will be a test, adjust nginx, PHP and kernel-related parameters, and then do the comparison;

    4. 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:)

    • Results updated:

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.

    • Supplementary Summary:

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

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.