Calculate the Qps/tps of Redis processing actual production request

Source: Internet
Author: User
Tags benchmark keep alive redis server

Qps/tpsbenchmark tool for measuring REDIS processing actual production requests

The Redis release version comes with the Redis-benchmark Performance test tool;

Example:
With 50 concurrent connections, 100,000 requests are made, and the data for each request is 2kb.
Test host for Redis server performance with 127.0.0.1 Port 6379:

./redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 100000 -d 2...====== SADD ======  100000 requests completed in 2.27 seconds  500 parallel clients  3 bytes payload  keep alive: 14.66% <= 1 milliseconds14.15% <= 2 milliseconds23.87% <= 3 milliseconds33.59% <= 4 milliseconds43.13% <= 5 milliseconds52.69% <= 6 milliseconds62.08% <= 7 milliseconds71.43% <= 8 milliseconds80.66% <= 9 milliseconds89.10% <= 10 milliseconds95.23% <= 11 milliseconds98.76% <= 12 milliseconds99.59% <= 13 milliseconds99.78% <= 14 milliseconds99.87% <= 15 milliseconds99.95% <= 16 milliseconds99.99% <= 17 milliseconds100.00% <= 17 milliseconds44150.11 requests per second

We focus on the final line of results: 44150.11 requests per second, both QPS4.4 million;
But the data here is only the test data, measured by the QPS can not represent the actual production capacity of processing;

Calculate the Qps/tps of Redis processing actual production request

In the actual production, we need to care about this indicator, in our application scenario,
What is the largest (QPS/TPS) that Redis can handle?

There are two ways to measure Redis QPS:

    1. Estimate the size of the produced message, using the benchmark tool to specify the-D data block size to simulate;

    2. Calculates the difference using the info statistic in REDIS-CLI;
      One of the REDIS-CLI's info commands total_commands_processed says: The total number of commands from start up to now, you can calculate the QPS by counting the difference between the two info commands:

//返回redis-cli info中total_commands_processed的结果 long getCmdProcessNum(redisContext *c){    string strVal;    getInfo(c,strVal);    map<string,string> mpVal;    parserInfo(strVal,mpVal);    map<string,string>::iterator  iter = mpVal.find("total_commands_processed");    if(iter != mpVal.end())    {        return atol(iter->second.c_str());    }    cout << "[err] not found total_commands_processed" << endl;    return 0;}

The program implementation is very simple, not all posted here, the complete code is described in GitHub:
Https://github.com/me115/cppset/tree/master/redisTPS

In actual production, run this program to count the actual QPS.
To run the example:

/opt/app/redisTPS#./redisTPS Time:  1  Process:40962  TPS:40839.48Time:  1  Process:43741  TPS:43610.17Time:  1  Process:38935  TPS:38779.88Time:  1  Process:31724  TPS:31597.61Time:  1  Process:32169  TPS:32008.96Time:  1  Process:31634  TPS:31476.62Time:  1  Process:46007  TPS:45823.71Time:  1  Process:50460  TPS:50258.96Time:  1  Process:47309  TPS:47167.50Time:  1  Process:50511  TPS:50359.92...

Posted by: Big CC | 14mar,2015
Blog: blog.me115.com [Subscribe]
Weibo: Sina Weibo

Calculate the Qps/tps of Redis processing actual production request

Related Article

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.