Twemperf, also known as Mcperf, is a memcached performance testing tool. Mcperf is like Httperf, but it is based on the Memcached protocol, which uses the Memcached ASCII protocol and can quickly generate a large number of memcached connections and requests. This tool is mainly used for memcached performance test, simulating the operation of large concurrent set, get and so on, Mcperf can only run in unix/linux environment.
First, download
Twemperf corresponding to the Github:https://github.com/twitter/twemperf
Second, installation
After downloading, upload to any server (note: Only run on Linux) to unzip the installation.
Tar zxvf mcperf-0.1.1.tar.gz
CD mcperf-0.1.1
sudo autoreconf-fvi //Then generates configure File ....
Cflags= "-ggdb3-o0"./configure--enable-debug
sudo make
sudo make install
third, the Operation
1, first run memcached (the default port is 11211, if run memcached when you specify the port number, the following execution Twemperf tool command when the corresponding designated IP and port, because the Twemperf tool default is 11211 port OH).
./memcached-d-M 256-l 10.142.90.152-u root-p 8718-VV
Parameter name action
-D starts in daemon mode. If this parameter is not specified, Memcache automatically shuts down when the CTRL + C command ends
The maximum amount of memory used by-m allocated to Memcache is M, the default is 64m
-u Specifies the user running Memcache
-L: Specifies the IP address of the listener
-p Specifies the TCP port number to listen on, and you can specify the UDP port by-U. Default is 11211
-C Maximum number of concurrent connections
-p Error Process ID file
2, Twemperf tool use instructions
After the installation is complete, there are mcperf commands under $TWEMPERF/SRC, using the following parameters:
The text is explained in the following general context:
Options:
-h,–help: Display Help
-v,–version: Display version
-v,–verbosity=n: Set log level (default = 5, Min. 0, max. 11)
-o,–output=s: Setting the log file (default output standard error)
-s,–server=s: Set the server you want to test (default is native)
-p,–port=n: Set the port you want to test (default is 11211)
-h,–print-histogram: Histogram of print response time
...
-t,–timeout=x: Set the time-out for links and responses (default is 0 seconds)
-l,–linger=n: Set the disconnect time for the TCP connection (not on by default)
-b,–send-buffer=n: Set the socket send buffer size (default is 4096 bytes)
-b,–recv-buffer=n: Set the socket receive buffer size (default is 16384 bytes)
-d,–disable-nodelay: Canceling TCP Latency
...
-m,–method=m:memcached some basic operations (such as set, GET, add, delete, etc., default is set)
-e,–expiry=n:set the Expiry value in SEC for generated requests (default:0 sec)
-q,–use-noreply:set noreply for generated requests
-p,–prefix=s:set the prefix of generated keys (DEFAULT:MCP:)
...
-c,–client=i/n: Set Mcperf instance to BES I out of total N instances (DEFAULT:0/1)
-n,–num-conns=n: Set the number of connections (default is 1)
-n,–num-calls=n: Sets the number of requests sent per connection (default is 1)
-r,–conn-rate=r: Set How many connections are established per second (default is 0 connections per second, and each connection is created after the last connection is broken)
-r,–call-rate=r: Sets the number of requests sent per second (default is 0 requests per second, and each request is sent after the last request response)
-z,–sizes=r: The size of the sent storage data (default is 1 bytes)
3. Usage examples
Example One: create 1000 concurrent connections to connect the 11211 port of this machine (this port is the default port of the tool), the connection creation speed is 1000 per second, each connection sends a "SET" request 10 times (equivalent to iteration 10 times), These 10 requests are sent at the speed of 1000 requests per second, and the size of the data sent is normally distributed in 1~16 bytes (that is, the size of value credited to memcached).
Command: Mcperf--linger=0--timeout=5--conn-rate=1000--call-rate=1000--num-calls=10--num-conns=1000--sizes=u1,16
Example Two: create 100 connections to connect to the local 11211 port, each connection is created after the last connection disconnects, each connection sends 100 "set" requests, each request is created after receiving the response from the last request, and the size of the data sent is 1 bytes.
Command: Mcperf--linger=0--call-rate=0--num-calls=100--conn-rate=0--num-conns=100--sizes=d1
(IP and port if required, set--server=10.142.90.152--port=8718 with the following parameters)
Example three:
Src/mcperf-s 10.142.90.152-p 8718--linger=0--timeout=5--conn-rate=1000--call-rate=1000--num-calls=10000-- num-conns=100--sizes=u1024,10240
(--num-conns=100 is the concurrent establishment of 100 connections;--num-calls=10000 is the 1w request on a connection;--sizes is the data size between 1k and 10k is normal distribution;-conn-rate= 1000 is 1 seconds to establish 1000 connections)
Example four:
Mcperf--linger=0--timeout=5--conn-rate=1000--call-rate=1000--num-calls=10--num-conns=1000--sizes=u1,16--server =10.142.90.152--port=8718--method=set
Result field interpretation
Total: Shows the overall number of connections, total number of requests, total number of responses, and time spent testing.
Connection Rate: Actual number of connections per second
Connection time: How long each connection actually takes (including connection time, set time, etc.)
Connect time: How long the connection took (just the time it took to connect)
Request rate: Number of requests per second
Request size: The byte size per request
Response Rate: Number of responses per second
Response Size: Bytes in response
Response Time: Response (in milliseconds)
Response type:stored represents the number of stores, not_stored indicates that there is no quantity stored, exists indicates the number that already exists, and Not_found indicates that no number was found
The subsequent parameters are not significant and are therefore not explained.
Iv. Conclusion
Through the above introduction, it can be seen that the method of testing memcache with Mcperf is to adjust the different parameter values to execute the command, after multiple sampling to obtain the results.
The general focus is on the metrics of total, Connection rate, Request rate, Response rate, Response time, Response type, Net I/O.
By testing the sample multiple times, you can use the Excel table to make a statistical effect after you have obtained the above data.
Reference URL:
https://my.oschina.net/u/561917/blog/908414
http://blog.51cto.com/332532/1897359
Https://yq.aliyun.com/articles/489374?spm=5176.10695662.1996646101.searchclickresult.3df5402f4HMIm0
http://maoyidao.iteye.com/blog/1757613
Twemperf of memcached Performance test