17165fb7a2f9b87c94b1da2f04197263654f54a1
[m6w6/libmemcached] / bin / memaslap.html
1
2
3 <!DOCTYPE html>
4 <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
5 <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
6 <head>
7 <meta charset="utf-8">
8
9 <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
11 <title>memaslap - Load testing and benchmarking a server &mdash; libmemcached 1.0.99 documentation</title>
12
13
14
15
16
17
18
19
20 <script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
21
22
23 <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
24 <script src="../_static/jquery.js"></script>
25 <script src="../_static/underscore.js"></script>
26 <script src="../_static/doctools.js"></script>
27 <script src="../_static/language_data.js"></script>
28
29 <script type="text/javascript" src="../_static/js/theme.js"></script>
30
31
32
33
34 <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
35 <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
36 <link rel="index" title="Index" href="../genindex.html" />
37 <link rel="search" title="Search" href="../search.html" />
38 <link rel="copyright" title="Copyright" href="../copyright.html" />
39 <link rel="next" title="memstat - Gather statistics from a server" href="memstat.html" />
40 <link rel="prev" title="memslap - Load testing and benchmarking a server" href="memslap.html" />
41 </head>
42
43 <body class="wy-body-for-nav">
44
45
46 <div class="wy-grid-for-nav">
47
48 <nav data-toggle="wy-nav-shift" class="wy-nav-side">
49 <div class="wy-side-scroll">
50 <div class="wy-side-nav-search" >
51
52
53
54 <a href="../index.html" class="icon icon-home"> libmemcached
55
56
57
58 </a>
59
60
61
62
63 <div class="version">
64 1.0
65 </div>
66
67
68
69
70 <div role="search">
71 <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
72 <input type="text" name="q" placeholder="Search docs" />
73 <input type="hidden" name="check_keywords" value="yes" />
74 <input type="hidden" name="area" value="default" />
75 </form>
76 </div>
77
78
79 </div>
80
81 <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
82
83
84
85
86
87
88 <p class="caption"><span class="caption-text">libmemcached</span></p>
89 <ul>
90 <li class="toctree-l1"><a class="reference internal" href="../libmemcached.html">Introduction</a></li>
91 <li class="toctree-l1"><a class="reference internal" href="../libmemcached/index.html">libmemcached API</a></li>
92 <li class="toctree-l1"><a class="reference internal" href="../libmemcached/index_misc.html">Misc</a></li>
93 </ul>
94 <p class="caption"><span class="caption-text">libmemcachedutil</span></p>
95 <ul>
96 <li class="toctree-l1"><a class="reference internal" href="../libmemcachedutil.html">Introduction</a></li>
97 <li class="toctree-l1"><a class="reference internal" href="../libmemcachedutil/index.html">libmemcachedutil API</a></li>
98 </ul>
99 <p class="caption"><span class="caption-text">libhashkit</span></p>
100 <ul>
101 <li class="toctree-l1"><a class="reference internal" href="../libhashkit.html">Introduction</a></li>
102 <li class="toctree-l1"><a class="reference internal" href="../libhashkit/index.html">libhashkit API</a></li>
103 </ul>
104 <p class="caption"><span class="caption-text">Client Applications</span></p>
105 <ul class="current">
106 <li class="toctree-l1 current"><a class="reference internal" href="index.html">Client Applications</a><ul class="current">
107 <li class="toctree-l2"><a class="reference internal" href="memcapable.html">memcapable - Checking a Memcached server capabilities and compatibility</a></li>
108 <li class="toctree-l2"><a class="reference internal" href="memcat.html">memcat - “cat” data from a server</a></li>
109 <li class="toctree-l2"><a class="reference internal" href="memcp.html">memcp - Copy data to a server</a></li>
110 <li class="toctree-l2"><a class="reference internal" href="memdump.html">memdump - Dumping your server</a></li>
111 <li class="toctree-l2"><a class="reference internal" href="memerror.html">memerror - translate an error code to a string</a></li>
112 <li class="toctree-l2"><a class="reference internal" href="memflush.html">memflush - flush all data from a server</a></li>
113 <li class="toctree-l2"><a class="reference internal" href="memrm.html">memrm - Remove data from a server</a></li>
114 <li class="toctree-l2"><a class="reference internal" href="memslap.html">memslap - Load testing and benchmarking a server</a></li>
115 <li class="toctree-l2 current"><a class="current reference internal" href="#">memaslap - Load testing and benchmarking a server</a><ul>
116 <li class="toctree-l3"><a class="reference internal" href="#synopsis">SYNOPSIS</a></li>
117 <li class="toctree-l3"><a class="reference internal" href="#description">DESCRIPTION</a></li>
118 <li class="toctree-l3"><a class="reference internal" href="#features">FEATURES</a></li>
119 <li class="toctree-l3"><a class="reference internal" href="#details">DETAILS</a><ul>
120 <li class="toctree-l4"><a class="reference internal" href="#effective-implementation-of-network">Effective implementation of network.</a></li>
121 <li class="toctree-l4"><a class="reference internal" href="#effective-implementation-of-multi-threads-and-concurrency">Effective implementation of multi-threads and concurrency</a></li>
122 <li class="toctree-l4"><a class="reference internal" href="#effective-implementation-of-generating-key-and-value">Effective implementation of generating key and value</a></li>
123 <li class="toctree-l4"><a class="reference internal" href="#simple-but-useful-task-scheduling">Simple but useful task scheduling</a></li>
124 <li class="toctree-l4"><a class="reference internal" href="#useful-implementation-of-multi-servers-udp-tcp-multi-get-and-binary-protocol">Useful implementation of multi-servers , UDP, TCP, multi-get and binary protocol</a></li>
125 </ul>
126 </li>
127 <li class="toctree-l3"><a class="reference internal" href="#usage">USAGE</a><ul>
128 <li class="toctree-l4"><a class="reference internal" href="#key-size-value-size-and-command-distribution">Key size, value size and command distribution.</a></li>
129 <li class="toctree-l4"><a class="reference internal" href="#multi-thread-and-concurrency">Multi-thread and concurrency</a></li>
130 <li class="toctree-l4"><a class="reference internal" href="#window-size">Window size</a></li>
131 <li class="toctree-l4"><a class="reference internal" href="#verification">Verification</a></li>
132 <li class="toctree-l4"><a class="reference internal" href="#multi-servers-and-multi-config">multi-servers and multi-config</a></li>
133 <li class="toctree-l4"><a class="reference internal" href="#run-with-execute-number-mode-or-time-mode">Run with execute number mode or time mode</a></li>
134 <li class="toctree-l4"><a class="reference internal" href="#dump-statistic-information-periodically">Dump statistic information periodically.</a></li>
135 <li class="toctree-l4"><a class="reference internal" href="#multi-get">Multi-get</a></li>
136 <li class="toctree-l4"><a class="reference internal" href="#udp-and-tcp">UDP and TCP</a></li>
137 <li class="toctree-l4"><a class="reference internal" href="#facebook-test">Facebook test</a></li>
138 <li class="toctree-l4"><a class="reference internal" href="#replication-test">Replication test</a></li>
139 <li class="toctree-l4"><a class="reference internal" href="#supports-thousands-of-tcp-connections">Supports thousands of TCP connections</a></li>
140 <li class="toctree-l4"><a class="reference internal" href="#supports-binary-protocol">Supports binary protocol</a></li>
141 </ul>
142 </li>
143 <li class="toctree-l3"><a class="reference internal" href="#configuration-file">Configuration file</a></li>
144 <li class="toctree-l3"><a class="reference internal" href="#format-of-output">Format of output</a><ul>
145 <li class="toctree-l4"><a class="reference internal" href="#where">Where</a></li>
146 <li class="toctree-l4"><a class="reference internal" href="#id1">Where</a></li>
147 <li class="toctree-l4"><a class="reference internal" href="#id2">Where</a></li>
148 </ul>
149 </li>
150 <li class="toctree-l3"><a class="reference internal" href="#options">OPTIONS</a></li>
151 <li class="toctree-l3"><a class="reference internal" href="#examples">EXAMPLES</a></li>
152 <li class="toctree-l3"><a class="reference internal" href="#see-also">SEE ALSO</a></li>
153 </ul>
154 </li>
155 <li class="toctree-l2"><a class="reference internal" href="memstat.html">memstat - Gather statistics from a server</a></li>
156 <li class="toctree-l2"><a class="reference internal" href="memexist.html">memexist - Check for the existence of a key</a></li>
157 <li class="toctree-l2"><a class="reference internal" href="memparse.html">memparse - Parse an option string</a></li>
158 <li class="toctree-l2"><a class="reference internal" href="memping.html">memping - Test to see if a server is available.</a></li>
159 <li class="toctree-l2"><a class="reference internal" href="memtouch.html">memtouch - Touches a key.</a></li>
160 </ul>
161 </li>
162 </ul>
163 <p class="caption"><span class="caption-text">Copyright</span></p>
164 <ul>
165 <li class="toctree-l1"><a class="reference internal" href="../copyright.html">Copyright</a></li>
166 </ul>
167
168
169
170 </div>
171 </div>
172 </nav>
173
174 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
175
176
177 <nav class="wy-nav-top" aria-label="top navigation">
178
179 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
180 <a href="../index.html">libmemcached</a>
181
182 </nav>
183
184
185 <div class="wy-nav-content">
186
187 <div class="rst-content">
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205 <div role="navigation" aria-label="breadcrumbs navigation">
206
207 <ul class="wy-breadcrumbs">
208
209 <li><a href="../index.html">Docs</a> &raquo;</li>
210
211 <li><a href="index.html">Client Applications</a> &raquo;</li>
212
213 <li>memaslap - Load testing and benchmarking a server</li>
214
215
216 <li class="wy-breadcrumbs-aside">
217
218
219
220 </li>
221
222 </ul>
223
224
225 <hr/>
226 </div>
227 <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
228 <div itemprop="articleBody">
229
230 <div class="section" id="memaslap-load-testing-and-benchmarking-a-server">
231 <h1>memaslap - Load testing and benchmarking a server<a class="headerlink" href="#memaslap-load-testing-and-benchmarking-a-server" title="Permalink to this headline"></a></h1>
232 <div class="section" id="synopsis">
233 <h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
234 <p>memaslap [options]</p>
235 <dl class="option">
236 <dt id="cmdoption-memaslap-help">
237 <code class="sig-name descname">--help</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-memaslap-help" title="Permalink to this definition"></a></dt>
238 <dd></dd></dl>
239
240 <dl class="envvar">
241 <dt id="envvar-MEMCACHED_SERVERS">
242 <code class="sig-name descname">MEMCACHED_SERVERS</code><a class="headerlink" href="#envvar-MEMCACHED_SERVERS" title="Permalink to this definition"></a></dt>
243 <dd></dd></dl>
244
245 </div>
246 <div class="section" id="description">
247 <h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
248 <p><strong class="program">memaslap</strong> is a load generation and benchmark tool for memcached
249 servers. It generates configurable workload such as threads, concurrency,
250 connections, run time, overwrite, miss rate, key size, value size, get/set
251 proportion, expected throughput, and so on. Furthermore, it also tests data
252 verification, expire-time verification, UDP, binary protocol, facebook test,
253 replication test, multi-get and reconnection, etc.</p>
254 <p>Memaslap manages network connections like memcached with
255 libevent. Each thread of memaslap is bound with a CPU core, all
256 the threads don’t communicate with each other, and there are several socket
257 connections in each thread. Each connection keeps key size distribution,
258 value size distribution, and command distribution by itself.</p>
259 <p>You can specify servers via the <a class="reference internal" href="memslap.html#cmdoption-memslap-servers"><code class="xref std std-option docutils literal notranslate"><span class="pre">memslap</span> <span class="pre">--servers</span></code></a> option or via the
260 environment variable <span class="target" id="index-0"></span><a class="reference internal" href="#envvar-MEMCACHED_SERVERS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">MEMCACHED_SERVERS</span></code></a>.</p>
261 </div>
262 <div class="section" id="features">
263 <h2>FEATURES<a class="headerlink" href="#features" title="Permalink to this headline"></a></h2>
264 <p>Memslap is developed to for the following purposes:</p>
265 <p>Manages network connections with libevent asynchronously.</p>
266 <p>Set both TCP and UDP up to use non-blocking IO.</p>
267 <p>Improves parallelism: higher performance in multi-threads environments.</p>
268 <p>Improves time efficiency: faster processing speed.</p>
269 <p>Generates key and value more efficiently; key size distribution and value size distribution are configurable.</p>
270 <p>Supports get, multi-get, and set commands; command distribution is configurable.</p>
271 <p>Supports controllable miss rate and overwrite rate.</p>
272 <p>Supports data and expire-time verification.</p>
273 <p>Supports dumping statistic information periodically.</p>
274 <p>Supports thousands of TCP connections.</p>
275 <p>Supports binary protocol.</p>
276 <p>Supports facebook test (set with TCP and multi-get with UDP) and replication test.</p>
277 </div>
278 <div class="section" id="details">
279 <h2>DETAILS<a class="headerlink" href="#details" title="Permalink to this headline"></a></h2>
280 <div class="section" id="effective-implementation-of-network">
281 <h3>Effective implementation of network.<a class="headerlink" href="#effective-implementation-of-network" title="Permalink to this headline"></a></h3>
282 <p>For memaslap, both TCP and UDP use non-blocking network IO. All
283 the network events are managed by libevent as memcached. The network module
284 of memaslap is similar to memcached. Libevent can ensure
285 memaslap can handle network very efficiently.</p>
286 </div>
287 <div class="section" id="effective-implementation-of-multi-threads-and-concurrency">
288 <h3>Effective implementation of multi-threads and concurrency<a class="headerlink" href="#effective-implementation-of-multi-threads-and-concurrency" title="Permalink to this headline"></a></h3>
289 <p>Memslap has the similar implementation of multi-threads to
290 memcached. Memslap creates one or more self-governed threads;
291 each thread is bound with one CPU core if the system tests setting CPU
292 core affinity.</p>
293 <p>In addition, each thread has a libevent to manage the events of the network;
294 each thread has one or more self-governed concurrency; and each
295 concurrency has one or more socket connections. All the concurrent tasks don’t
296 communicate with each other even though they are in the same thread.</p>
297 <p>Memslap can create thousands of socket connections, and each
298 concurrency has tens of socket connections. Each concurrency randomly or
299 sequentially selects one socket connection from its socket connection pool
300 to run, so memaslap can ensure each concurrency handles one
301 socket connection at any given time. Users can specify the number of
302 concurrency and socket connections of each concurrency according to their
303 expected workload.</p>
304 </div>
305 <div class="section" id="effective-implementation-of-generating-key-and-value">
306 <h3>Effective implementation of generating key and value<a class="headerlink" href="#effective-implementation-of-generating-key-and-value" title="Permalink to this headline"></a></h3>
307 <p>In order to improve time efficiency and space efficiency,
308 memaslap creates a random characters table with 10M characters. All the
309 suffixes of keys and values are generated from this random characters table.</p>
310 <p>Memslap uses the offset in the character table and the length
311 of the string to identify a string. It can save much memory.
312 Each key contains two parts, a prefix and a suffix. The prefix is an
313 uint64_t, 8 bytes. In order to verify the data set before,
314 memaslap need to ensure each key is unique, so it uses the prefix to identify
315 a key. The prefix cannot include illegal characters, such as ‘r’, ‘n’,
3160’ and ‘ ‘. And memaslap has an algorithm to ensure that.</p>
317 <p>Memslap doesn’t generate all the objects (key-value pairs) at
318 the beginning. It only generates enough objects to fill the task window
319 (default 10K objects) of each concurrency. Each object has the following
320 basic information, key prefix, key suffix offset in the character table, key
321 length, value offset in the character table, and value length.</p>
322 <p>In the work process, each concurrency sequentially or randomly selects an
323 object from the window to do set operation or get operation. At the same
324 time, each concurrency kicks objects out of its window and adds new object
325 into it.</p>
326 </div>
327 <div class="section" id="simple-but-useful-task-scheduling">
328 <h3>Simple but useful task scheduling<a class="headerlink" href="#simple-but-useful-task-scheduling" title="Permalink to this headline"></a></h3>
329 <p>Memslap uses libevent to schedule all concurrent tasks of
330 threads, and each concurrency schedules tasks based on the local task
331 window. Memslap assumes that if each concurrency keeps the same
332 key distribution, value distribution and commands distribution, from
333 outside, memaslap keeps all the distribution as a whole.
334 Each task window includes a lot of objects, each object stores its basic
335 information, such as key, value, expire time, and so on. At any time, all
336 the objects in the window keep the same and fixed key and value
337 distribution. If an object is overwritten, the value of the object will be
338 updated. Memslap verifies the data or expire-time according to
339 the object information stored in the task window.</p>
340 <p>Libevent selects which concurrency to handle based on a specific network
341 event. Then the concurrency selects which command (get or set) to operate
342 based on the command distribution. If it needs to kick out an old object and
343 add a new object, in order to keep the same key and value distribution, the
344 new object must have the same key length and value length.</p>
345 <p>If memcached server has two cache layers (memory and SSD), running
346 memaslap with different window sizes can get different cache
347 miss rates. If memaslap adds enough objects into the windows at
348 the beginning, and the cache of memcached cannot store all the objects
349 initialized, then memaslap will get some objects from the second
350 cache layer. It causes the first cache layer to miss. So the user can
351 specify the window size to get the expected miss rate of the first cache
352 layer.</p>
353 </div>
354 <div class="section" id="useful-implementation-of-multi-servers-udp-tcp-multi-get-and-binary-protocol">
355 <h3>Useful implementation of multi-servers , UDP, TCP, multi-get and binary protocol<a class="headerlink" href="#useful-implementation-of-multi-servers-udp-tcp-multi-get-and-binary-protocol" title="Permalink to this headline"></a></h3>
356 <p>Because each thread is self-governed, memaslap can assign
357 different threads to handle different memcached servers. This is just one of
358 the ways in which memaslap tests multiple servers. The only
359 limitation is that the number of servers cannot be greater than the number
360 of threads. The other way to test multiple servers is for replication
361 test. Each concurrency has one socket connection to each memcached server.
362 For the implementation, memaslap can set some objects to one
363 memcached server, and get these objects from the other servers.</p>
364 <p>By default, Memslap does single get. If the user specifies
365 multi-get option, memaslap will collect enough get commands and
366 pack and send the commands together.</p>
367 <p>Memslap tests both the ASCII protocol and binary protocol,
368 but it runs on the ASCII protocol by default.
369 Memslap by default runs on the TCP protocol, but it also
370 tests UDP. Because UDP is unreliable, dropped packages and out-of-order
371 packages may occur. Memslap creates a memory buffer to handle
372 these problems. Memslap tries to read all the response data of
373 one command from the server and reorders the response data. If some packages
374 get lost, the waiting timeout mechanism can ensure half-baked packages will
375 be discarded and the next command will be sent.</p>
376 </div>
377 </div>
378 <div class="section" id="usage">
379 <h2>USAGE<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
380 <p>Below are some usage samples:</p>
381 <p>memaslap -s 127.0.0.1:11211 -S 5s</p>
382 <p>memaslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b</p>
383 <p>memaslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2</p>
384 <p>memaslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k</p>
385 <p>memaslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40</p>
386 <p>memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m</p>
387 <p>memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2</p>
388 <p>The user must specify one server at least to run memaslap. The
389 rest of the parameters have default values, as shown below:</p>
390 <p>Thread number = 1 Concurrency = 16</p>
391 <p>Run time = 600 seconds Configuration file = NULL</p>
392 <p>Key size = 64 Value size = 1024</p>
393 <p>Get/set = 9:1 Window size = 10k</p>
394 <p>Execute number = 0 Single get = true</p>
395 <p>Multi-get = false Number of sockets of each concurrency = 1</p>
396 <p>Reconnect = false Data verification = false</p>
397 <p>Expire-time verification = false ASCII protocol = true</p>
398 <p>Binary protocol = false Dumping statistic information periodically = false</p>
399 <p>Overwrite proportion = 0% UDP = false</p>
400 <p>TCP = true Limit throughput = false</p>
401 <p>Facebook test = false Replication test = false</p>
402 <div class="section" id="key-size-value-size-and-command-distribution">
403 <h3>Key size, value size and command distribution.<a class="headerlink" href="#key-size-value-size-and-command-distribution" title="Permalink to this headline"></a></h3>
404 <p>All the distributions are read from the configuration file specified by user
405 with “—cfg_cmd” option. If the user does not specify a configuration file,
406 memaslap will run with the default distribution (key size = 64,
407 value size = 1024, get/set = 9:1). For information on how to edit the
408 configuration file, refer to the “Configuration File” section.</p>
409 <p>The minimum key size is 16 bytes; the maximum key size is 250 bytes. The
410 precision of proportion is 0.001. The proportion of distribution will be
411 rounded to 3 decimal places.</p>
412 <p>The minimum value size is 1 bytes; the maximum value size is 1M bytes. The
413 precision of proportion is 0.001. The proportion of distribution will be
414 rounded to 3 decimal places.
415 Currently, memaslap only tests set and get commands. And it
416 testss 100% set and 100% get. For 100% get, it will preset some objects to
417 the server.</p>
418 </div>
419 <div class="section" id="multi-thread-and-concurrency">
420 <h3>Multi-thread and concurrency<a class="headerlink" href="#multi-thread-and-concurrency" title="Permalink to this headline"></a></h3>
421 <p>The high performance of memaslap benefits from the special
422 schedule of thread and concurrency. It’s important to specify the proper
423 number of them. The default number of threads is 1; the default number of
424 concurrency is 16. The user can use “—threads” and “–concurrency” to
425 specify these variables.</p>
426 <p>If the system tests setting CPU affinity and the number of threads
427 specified by the user is greater than 1, memaslap will try to
428 bind each thread to a different CPU core. So if you want to get the best
429 performance memaslap, it is better to specify the number of
430 thread equal to the number of CPU cores. The number of threads specified by
431 the user can also be less or greater than the number of CPU cores. Because
432 of the limitation of implementation, the number of concurrencies could be
433 the multiple of the number of threads.</p>
434 <ol class="arabic simple">
435 <li><p>For 8 CPU cores system</p></li>
436 </ol>
437 <p>For example:</p>
438 <p>–threads=2 –concurrency=128</p>
439 <p>–threads=8 –concurrency=128</p>
440 <p>–threads=8 –concurrency=256</p>
441 <p>–threads=12 –concurrency=144</p>
442 <ol class="arabic simple" start="2">
443 <li><p>For 16 CPU cores system</p></li>
444 </ol>
445 <p>For example:</p>
446 <p>–threads=8 –concurrency=128</p>
447 <p>–threads=16 –concurrency=256</p>
448 <p>–threads=16 –concurrency=512</p>
449 <p>–threads=24 –concurrency=288</p>
450 <p>The memaslap performs very well, when
451 used to test the performance of memcached servers.
452 Most of the time, the bottleneck is the network or
453 the server. If for some reason the user wants to
454 limit the performance of memaslap, there
455 are two ways to do this:</p>
456 <p>Decrease the number of threads and concurrencies.
457 Use the option “–tps” that memaslap
458 provides to limit the throughput. This option allows
459 the user to get the expected throughput. For
460 example, assume that the maximum throughput is 50
461 kops/s for a specific configuration, you can specify
462 the throughput equal to or less than the maximum
463 throughput using “–tps” option.</p>
464 </div>
465 <div class="section" id="window-size">
466 <h3>Window size<a class="headerlink" href="#window-size" title="Permalink to this headline"></a></h3>
467 <p>Most of the time, the user does not need to specify the window size. The
468 default window size is 10k. For Schooner Memcached, the user can specify
469 different window sizes to get different cache miss rates based on the test
470 case. Memslap testss cache miss rate between 0% and 100%.
471 If you use this utility to test the performance of Schooner Memcached, you
472 can specify a proper window size to get the expected cache miss rate. The
473 formula for calculating window size is as follows:</p>
474 <p>Assume that the key size is 128 bytes, and the value size is 2048 bytes, and
475 concurrency=128.</p>
476 <p>1. Small cache cache_size=1M, 100% cache miss (all data get from SSD).
477 win_size=10k</p>
478 <ol class="arabic simple" start="2">
479 <li><p>cache_size=4G</p></li>
480 </ol>
481 <p>(1). cache miss rate 0%</p>
482 <p>win_size=8k</p>
483 <p>(2). cache miss rate 5%</p>
484 <p>win_size=11k</p>
485 <ol class="arabic simple" start="3">
486 <li><p>cache_size=16G</p></li>
487 </ol>
488 <p>(1). cache miss rate 0%</p>
489 <p>win_size=32k</p>
490 <p>(2). cache miss</p>
491 <p>rate 5%</p>
492 <p>win_size=46k</p>
493 <p>The formula for calculating window size for cache miss rate 0%:</p>
494 <p>cache_size / concurrency / (key_size + value_size) * 0.5</p>
495 <p>The formula for calculating window size for cache miss rate 5%:</p>
496 <p>cache_size / concurrency / (key_size + value_size) * 0.7</p>
497 </div>
498 <div class="section" id="verification">
499 <h3>Verification<a class="headerlink" href="#verification" title="Permalink to this headline"></a></h3>
500 <p>Memslap testss both data verification and expire-time
501 verification. The user can use “–verify=” or “-v” to specify the proportion
502 of data verification. In theory, it testss 100% data verification. The
503 user can use “–exp_verify=” or “-e” to specify the proportion of
504 expire-time verification. In theory, it testss 100% expire-time
505 verification. Specify the “–verbose” options to get more detailed error
506 information.</p>
507 <p>For example: –exp_verify=0.01 –verify=0.1 , it means that 1% of the objects
508 set with expire-time, 10% of the objects gotten will be verified. If the
509 objects are gotten, memaslap will verify the expire-time and
510 value.</p>
511 </div>
512 <div class="section" id="multi-servers-and-multi-config">
513 <h3>multi-servers and multi-config<a class="headerlink" href="#multi-servers-and-multi-config" title="Permalink to this headline"></a></h3>
514 <p>Memslap testss multi-servers based on self-governed thread.
515 There is a limitation that the number of servers cannot be greater than the
516 number of threads. Memslap assigns one thread to handle one
517 server at least. The user can use the “–servers=” or “-s” option to specify
518 multi-servers.</p>
519 <p>For example:</p>
520 <p>–servers=10.1.1.1:11211,10.1.1.2:11212,10.1.1.3:11213 –threads=6 –concurrency=36</p>
521 <p>The above command means that there are 6 threads, with each thread having 6
522 concurrencies and that threads 0 and 3 handle server 0 (10.1.1.1); threads 1
523 and 4 handle server 1 (10.1.1.2); and thread 2 and 5 handle server 2
524 (10.1.1.3).</p>
525 <p>All the threads and concurrencies in memaslap are self-governed.</p>
526 <p>So is memaslap. The user can start up several
527 memaslap instances. The user can run memaslap on different client
528 machines to communicate with the same memcached server at the same. It is
529 recommended that the user start different memaslap on different
530 machines using the same configuration.</p>
531 </div>
532 <div class="section" id="run-with-execute-number-mode-or-time-mode">
533 <h3>Run with execute number mode or time mode<a class="headerlink" href="#run-with-execute-number-mode-or-time-mode" title="Permalink to this headline"></a></h3>
534 <p>The default memaslap runs with time mode. The default run time
535 is 10 minutes. If it times out, memaslap will exit. Do not
536 specify both execute number mode and time mode at the same time; just
537 specify one instead.</p>
538 <p>For example:</p>
539 <p>–time=30s (It means the test will run 30 seconds.)</p>
540 <p>–execute_number=100000 (It means that after running 100000 commands, the test will exit.)</p>
541 </div>
542 <div class="section" id="dump-statistic-information-periodically">
543 <h3>Dump statistic information periodically.<a class="headerlink" href="#dump-statistic-information-periodically" title="Permalink to this headline"></a></h3>
544 <p>The user can use “–stat_freq=” or “-S” to specify the frequency.</p>
545 <p>For example:</p>
546 <p>–stat_freq=20s</p>
547 <p>Memslap will dump the statistics of the commands (get and set) at the frequency of every 20
548 seconds.</p>
549 <p>For more information on the format of dumping statistic information, refer to “Format of Output” section.</p>
550 </div>
551 <div class="section" id="multi-get">
552 <h3>Multi-get<a class="headerlink" href="#multi-get" title="Permalink to this headline"></a></h3>
553 <p>The user can use “–division=” or “-d” to specify multi-get keys count.
554 Memslap by default does single get with TCP. Memslap also testss data
555 verification and expire-time verification for multi-get.</p>
556 <p>Memslap testss multi-get with both TCP and UDP. Because of
557 the different implementation of the ASCII protocol and binary protocol,
558 there are some differences between the two. For the ASCII protocol,
559 memaslap sends one “multi-get” to the server once. For the
560 binary protocol, memaslap sends several single get commands
561 together as “multi-get” to the server.</p>
562 </div>
563 <div class="section" id="udp-and-tcp">
564 <h3>UDP and TCP<a class="headerlink" href="#udp-and-tcp" title="Permalink to this headline"></a></h3>
565 <p>Memslap testss both UDP and TCP. For TCP,
566 memaslap does not reconnect the memcached server if socket connections are
567 lost. If all the socket connections are lost or memcached server crashes,
568 memaslap will exit. If the user specifies the “–reconnect”
569 option when socket connections are lost, it will reconnect them.</p>
570 <p>User can use “–udp” to enable the UDP feature, but UDP comes with some
571 limitations:</p>
572 <p>UDP cannot set data more than 1400 bytes.</p>
573 <p>UDP is not tested by the binary protocol because the binary protocol of
574 memcached does not tests that.</p>
575 <p>UDP doesn’t tests reconnection.</p>
576 </div>
577 <div class="section" id="facebook-test">
578 <h3>Facebook test<a class="headerlink" href="#facebook-test" title="Permalink to this headline"></a></h3>
579 <p>Set data with TCP and multi-get with UDP. Specify the following options:</p>
580 <p>“–facebook –division=50</p>
581 <p>If you want to create thousands of TCP connections, specify the</p>
582 <p>“–conn_sock=” option.</p>
583 <p>For example: –facebook –division=50 –conn_sock=200</p>
584 <p>The above command means that memaslap will do facebook test,
585 each concurrency has 200 socket TCP connections and one UDP socket.</p>
586 <p>Memslap sets objects with the TCP socket, and multi-gets 50
587 objects once with the UDP socket.</p>
588 <p>If you specify “–division=50”, the key size must be less that 25 bytes
589 because the UDP packet size is 1400 bytes.</p>
590 </div>
591 <div class="section" id="replication-test">
592 <h3>Replication test<a class="headerlink" href="#replication-test" title="Permalink to this headline"></a></h3>
593 <p>For replication test, the user must specify at least two memcached servers.
594 The user can use “—rep_write=” option to enable feature.</p>
595 <p>For example:</p>
596 <p>–servers=10.1.1.1:11211,10.1.1.2:11212 –rep_write=2</p>
597 <p>The above command means that there are 2 replication memcached servers,
598 memaslap will set objects to both server 0 and server 1, get
599 objects which are set to server 0 before from server 1, and also get objects
600 which are set to server 1 before from server 0. If server 0 crashes,
601 memaslap will only get objects from server 1. If server 0 comes
602 back to life again, memaslap will reconnect server 0. If both
603 server 0 and server 1 crash, memaslap will exit.</p>
604 </div>
605 <div class="section" id="supports-thousands-of-tcp-connections">
606 <h3>Supports thousands of TCP connections<a class="headerlink" href="#supports-thousands-of-tcp-connections" title="Permalink to this headline"></a></h3>
607 <p>Start memaslap with “–conn_sock=” or “-n” to enable this
608 feature. Make sure that your system can tests opening thousands of files
609 and creating thousands of sockets. However, this feature does not tests
610 reconnection if sockets disconnect.</p>
611 <p>For example:</p>
612 <p>–threads=8 –concurrency=128 –conn_sock=128</p>
613 <p>The above command means that memaslap starts up 8 threads, each
614 thread has 16 concurrencies, each concurrency has 128 TCP socket
615 connections, and the total number of TCP socket connections is 128 * 128 =
616 16384.</p>
617 </div>
618 <div class="section" id="supports-binary-protocol">
619 <h3>Supports binary protocol<a class="headerlink" href="#supports-binary-protocol" title="Permalink to this headline"></a></h3>
620 <p>Start memaslap with “–binary” or “-B” options to enable this
621 feature. It testss all the above features except UDP, because the latest
622 memcached 1.3.3 does not implement binary UDP protocol.</p>
623 <p>For example:</p>
624 <p>–binary</p>
625 <p>Since memcached 1.3.3 doesn’t implement binary UDP protocol,
626 memaslap does not tests UDP. In addition, memcached 1.3.3 does not tests
627 multi-get. If you specify “–division=50” option, it just sends 50 get
628 commands together as “multi-get” to the server.</p>
629 </div>
630 </div>
631 <div class="section" id="configuration-file">
632 <h2>Configuration file<a class="headerlink" href="#configuration-file" title="Permalink to this headline"></a></h2>
633 <p>This section describes the format of the configuration file. By default
634 when no configuration file is specified memaslap reads the default
635 one located at ~/.memaslap.cnf.</p>
636 <p>Below is a sample configuration file:</p>
637 <div class="highlight-perl notranslate"><div class="highlight"><pre><span></span><span class="o">---------------------------------------------------------------------------</span>
638 <span class="c1">#comments should start with &#39;#&#39;</span>
639 <span class="c1">#key</span>
640 <span class="c1">#start_len end_len proportion</span>
641 <span class="c1">#</span>
642 <span class="c1">#key length range from start_len to end_len</span>
643 <span class="c1">#start_len must be equal to or greater than 16</span>
644 <span class="c1">#end_len must be equal to or less than 250</span>
645 <span class="c1">#start_len must be equal to or greater than end_len</span>
646 <span class="c1">#memaslap will generate keys according to the key range</span>
647 <span class="c1">#proportion: indicates keys generated from one range accounts for the total</span>
648 <span class="n">generated</span> <span class="nb">keys</span>
649 <span class="c1">#</span>
650 <span class="c1">#example1: key range 16~100 accounts for 80%</span>
651 <span class="c1"># key range 101~200 accounts for 10%</span>
652 <span class="c1"># key range 201~250 accounts for 10%</span>
653 <span class="c1"># total should be 1 (0.8+0.1+0.1 = 1)</span>
654 <span class="c1">#</span>
655 <span class="c1"># 16 100 0.8</span>
656 <span class="c1"># 101 200 0.1</span>
657 <span class="c1"># 201 249 0.1</span>
658 <span class="c1">#</span>
659 <span class="c1">#example2: all keys length are 128 bytes</span>
660 <span class="c1">#</span>
661 <span class="c1"># 128 128 1</span>
662 <span class="n">key</span>
663 <span class="mi">128</span> <span class="mi">128</span> <span class="mi">1</span>
664 <span class="c1">#value</span>
665 <span class="c1">#start_len end_len proportion</span>
666 <span class="c1">#</span>
667 <span class="c1">#value length range from start_len to end_len</span>
668 <span class="c1">#start_len must be equal to or greater than 1</span>
669 <span class="c1">#end_len must be equal to or less than 1M</span>
670 <span class="c1">#start_len must be equal to or greater than end_len</span>
671 <span class="c1">#memaslap will generate values according to the value range</span>
672 <span class="c1">#proportion: indicates values generated from one range accounts for the</span>
673 <span class="n">total</span> <span class="n">generated</span> <span class="nb">values</span>
674 <span class="c1">#</span>
675 <span class="c1">#example1: value range 1~1000 accounts for 80%</span>
676 <span class="c1"># value range 1001~10000 accounts for 10%</span>
677 <span class="c1"># value range 10001~100000 accounts for 10%</span>
678 <span class="c1"># total should be 1 (0.8+0.1+0.1 = 1)</span>
679 <span class="c1">#</span>
680 <span class="c1"># 1 1000 0.8</span>
681 <span class="c1"># 1001 10000 0.1</span>
682 <span class="c1"># 10001 100000 0.1</span>
683 <span class="c1">#</span>
684 <span class="c1">#example2: all value length are 128 bytes</span>
685 <span class="c1">#</span>
686 <span class="c1"># 128 128 1</span>
687 <span class="n">value</span>
688 <span class="mi">2048</span> <span class="mi">2048</span> <span class="mi">1</span>
689 <span class="c1">#cmd</span>
690 <span class="c1">#cmd_type cmd_proportion</span>
691 <span class="c1">#</span>
692 <span class="c1">#currently memaslap only testss get and set command.</span>
693 <span class="c1">#</span>
694 <span class="c1">#cmd_type</span>
695 <span class="c1">#set 0</span>
696 <span class="c1">#get 1</span>
697 <span class="c1">#</span>
698 <span class="c1">#example: set command accounts for 50%</span>
699 <span class="c1"># get command accounts for 50%</span>
700 <span class="c1"># total should be 1 (0.5+0.5 = 1)</span>
701 <span class="c1">#</span>
702 <span class="c1"># cmd</span>
703 <span class="c1"># 0 0.5</span>
704 <span class="c1"># 1 0.5</span>
705 <span class="n">cmd</span>
706 <span class="mi">0</span> <span class="mf">0.1</span>
707 <span class="mf">1.0</span> <span class="mf">0.9</span>
708 </pre></div>
709 </div>
710 </div>
711 <div class="section" id="format-of-output">
712 <h2>Format of output<a class="headerlink" href="#format-of-output" title="Permalink to this headline"></a></h2>
713 <p>At the beginning, memaslap displays some configuration information as follows:</p>
714 <p>servers : 127.0.0.1:11211</p>
715 <p>threads count: 1</p>
716 <p>concurrency: 16</p>
717 <p>run time: 20s</p>
718 <p>windows size: 10k</p>
719 <p>set proportion: set_prop=0.10</p>
720 <p>get proportion: get_prop=0.90</p>
721 <div class="section" id="where">
722 <h3>Where<a class="headerlink" href="#where" title="Permalink to this headline"></a></h3>
723 <p>servers : “servers”</p>
724 <blockquote>
725 <div><p>The servers used by memaslap.</p>
726 </div></blockquote>
727 <p>threads count</p>
728 <blockquote>
729 <div><p>The number of threads memaslap runs with.</p>
730 </div></blockquote>
731 <p>concurrency</p>
732 <blockquote>
733 <div><p>The number of concurrencies memaslap runs with.</p>
734 </div></blockquote>
735 <p>run time</p>
736 <blockquote>
737 <div><p>How long to run memaslap.</p>
738 </div></blockquote>
739 <p>windows size</p>
740 <blockquote>
741 <div><p>The task window size of each concurrency.</p>
742 </div></blockquote>
743 <p>set proportion</p>
744 <blockquote>
745 <div><p>The proportion of set command.</p>
746 </div></blockquote>
747 <p>get proportion</p>
748 <blockquote>
749 <div><p>The proportion of get command.</p>
750 </div></blockquote>
751 <p>The output of dynamic statistics is something like this:</p>
752 <div class="highlight-perl notranslate"><div class="highlight"><pre><span></span><span class="o">---------------------------------------------------------------------------------------------------------------------------------</span>
753 <span class="n">Get</span> <span class="n">Statistics</span>
754 <span class="n">Type</span> <span class="n">Time</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> <span class="n">Ops</span> <span class="n">TPS</span><span class="p">(</span><span class="n">ops</span><span class="sr">/s) Net(M/s</span><span class="p">)</span> <span class="n">Get_miss</span> <span class="n">Min</span><span class="p">(</span><span class="n">us</span><span class="p">)</span> <span class="n">Max</span><span class="p">(</span><span class="n">us</span><span class="p">)</span>
755 <span class="n">Avg</span><span class="p">(</span><span class="n">us</span><span class="p">)</span> <span class="n">Std_dev</span> <span class="n">Geo_dist</span>
756 <span class="n">Period</span> <span class="mi">5</span> <span class="mi">345826</span> <span class="mi">69165</span> <span class="mf">65.3</span> <span class="mi">0</span> <span class="mi">27</span> <span class="mi">2198</span> <span class="mi">203</span>
757 <span class="mf">95.43</span> <span class="mf">177.29</span>
758 <span class="n">Global</span> <span class="mi">20</span> <span class="mi">1257935</span> <span class="mi">62896</span> <span class="mf">71.8</span> <span class="mi">0</span> <span class="mi">26</span> <span class="mi">3791</span> <span class="mi">224</span>
759 <span class="mf">117.79</span> <span class="mf">192.60</span>
760 <span class="n">Set</span> <span class="n">Statistics</span>
761
762 <span class="n">Type</span> <span class="n">Time</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> <span class="n">Ops</span> <span class="n">TPS</span><span class="p">(</span><span class="n">ops</span><span class="sr">/s) Net(M/s</span><span class="p">)</span> <span class="n">Get_miss</span> <span class="n">Min</span><span class="p">(</span><span class="n">us</span><span class="p">)</span> <span class="n">Max</span><span class="p">(</span><span class="n">us</span><span class="p">)</span>
763 <span class="n">Avg</span><span class="p">(</span><span class="n">us</span><span class="p">)</span> <span class="n">Std_dev</span> <span class="n">Geo_dist</span>
764 <span class="n">Period</span> <span class="mi">5</span> <span class="mi">38425</span> <span class="mi">7685</span> <span class="mf">7.3</span> <span class="mi">0</span> <span class="mi">42</span> <span class="mi">628</span> <span class="mi">240</span>
765 <span class="mf">88.05</span> <span class="mf">220.21</span>
766 <span class="n">Global</span> <span class="mi">20</span> <span class="mi">139780</span> <span class="mi">6989</span> <span class="mf">8.0</span> <span class="mi">0</span> <span class="mi">37</span> <span class="mi">3790</span> <span class="mi">253</span>
767 <span class="mf">117.93</span> <span class="mf">224.83</span>
768 <span class="n">Total</span> <span class="n">Statistics</span>
769
770 <span class="n">Type</span> <span class="n">Time</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> <span class="n">Ops</span> <span class="n">TPS</span><span class="p">(</span><span class="n">ops</span><span class="sr">/s) Net(M/s</span><span class="p">)</span> <span class="n">Get_miss</span> <span class="n">Min</span><span class="p">(</span><span class="n">us</span><span class="p">)</span> <span class="n">Max</span><span class="p">(</span><span class="n">us</span><span class="p">)</span>
771 <span class="n">Avg</span><span class="p">(</span><span class="n">us</span><span class="p">)</span> <span class="n">Std_dev</span> <span class="n">Geo_dist</span>
772 <span class="n">Period</span> <span class="mi">5</span> <span class="mi">384252</span> <span class="mi">76850</span> <span class="mf">72.5</span> <span class="mi">0</span> <span class="mi">27</span> <span class="mi">2198</span> <span class="mi">207</span>
773 <span class="mf">94.72</span> <span class="mf">181.18</span>
774 <span class="n">Global</span> <span class="mi">20</span> <span class="mi">1397720</span> <span class="mi">69886</span> <span class="mf">79.7</span> <span class="mi">0</span> <span class="mi">26</span> <span class="mi">3791</span> <span class="mi">227</span>
775 <span class="mf">117.93</span> <span class="mf">195.60</span>
776 <span class="o">---------------------------------------------------------------------------------------------------------------------------------</span>
777 </pre></div>
778 </div>
779 </div>
780 <div class="section" id="id1">
781 <h3>Where<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
782 <p>Get Statistics</p>
783 <blockquote>
784 <div><p>Statistics information of get command</p>
785 </div></blockquote>
786 <p>Set Statistics</p>
787 <blockquote>
788 <div><p>Statistics information of set command</p>
789 </div></blockquote>
790 <p>Total Statistics</p>
791 <blockquote>
792 <div><p>Statistics information of both get and set command</p>
793 </div></blockquote>
794 <p>Period</p>
795 <blockquote>
796 <div><p>Result within a period</p>
797 </div></blockquote>
798 <p>Global</p>
799 <blockquote>
800 <div><p>Accumulated results</p>
801 </div></blockquote>
802 <p>Ops</p>
803 <blockquote>
804 <div><p>Total operations</p>
805 </div></blockquote>
806 <p>TPS</p>
807 <blockquote>
808 <div><p>Throughput, operations/second</p>
809 </div></blockquote>
810 <p>Net</p>
811 <blockquote>
812 <div><p>The rate of network</p>
813 </div></blockquote>
814 <p>Get_miss</p>
815 <blockquote>
816 <div><p>How many objects can’t be gotten</p>
817 </div></blockquote>
818 <p>Min</p>
819 <blockquote>
820 <div><p>The minimum response time</p>
821 </div></blockquote>
822 <p>Max</p>
823 <blockquote>
824 <div><p>The maximum response time</p>
825 </div></blockquote>
826 <p>Avg:</p>
827 <blockquote>
828 <div><p>The average response time</p>
829 </div></blockquote>
830 <p>Std_dev</p>
831 <blockquote>
832 <div><p>Standard deviation of response time</p>
833 </div></blockquote>
834 <p>Geo_dist</p>
835 <blockquote>
836 <div><p>Geometric distribution based on natural exponential function</p>
837 </div></blockquote>
838 <p>At the end, memaslap will output something like this:</p>
839 <div class="highlight-perl notranslate"><div class="highlight"><pre><span></span><span class="o">---------------------------------------------------------------------------------------------------------------------------------</span>
840 <span class="n">Get</span> <span class="n">Statistics</span> <span class="p">(</span><span class="mi">1257956</span> <span class="n">events</span><span class="p">)</span>
841 <span class="n">Min:</span> <span class="mi">26</span>
842 <span class="n">Max:</span> <span class="mi">3791</span>
843 <span class="n">Avg:</span> <span class="mi">224</span>
844 <span class="n">Geo:</span> <span class="mf">192.60</span>
845 <span class="n">Std:</span> <span class="mf">116.23</span>
846 <span class="n">Log2</span> <span class="n">Dist:</span>
847 <span class="mi">4</span><span class="p">:</span> <span class="mi">0</span> <span class="mi">10</span> <span class="mi">84490</span> <span class="mi">215345</span>
848 <span class="mi">8</span><span class="p">:</span> <span class="mi">484890</span> <span class="mi">459823</span> <span class="mi">12543</span> <span class="mi">824</span>
849 <span class="mi">12</span><span class="p">:</span> <span class="mi">31</span>
850
851 <span class="n">Set</span> <span class="n">Statistics</span> <span class="p">(</span><span class="mi">139782</span> <span class="n">events</span><span class="p">)</span>
852 <span class="n">Min:</span> <span class="mi">37</span>
853 <span class="n">Max:</span> <span class="mi">3790</span>
854 <span class="n">Avg:</span> <span class="mi">253</span>
855 <span class="n">Geo:</span> <span class="mf">224.84</span>
856 <span class="n">Std:</span> <span class="mf">116.83</span>
857 <span class="n">Log2</span> <span class="n">Dist:</span>
858 <span class="mi">4</span><span class="p">:</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">4200</span> <span class="mi">16988</span>
859 <span class="mi">8</span><span class="p">:</span> <span class="mi">50784</span> <span class="mi">65574</span> <span class="mi">2064</span> <span class="mi">167</span>
860 <span class="mi">12</span><span class="p">:</span> <span class="mi">5</span>
861
862 <span class="n">Total</span> <span class="n">Statistics</span> <span class="p">(</span><span class="mi">1397738</span> <span class="n">events</span><span class="p">)</span>
863 <span class="n">Min:</span> <span class="mi">26</span>
864 <span class="n">Max:</span> <span class="mi">3791</span>
865 <span class="n">Avg:</span> <span class="mi">227</span>
866 <span class="n">Geo:</span> <span class="mf">195.60</span>
867 <span class="n">Std:</span> <span class="mf">116.60</span>
868 <span class="n">Log2</span> <span class="n">Dist:</span>
869 <span class="mi">4</span><span class="p">:</span> <span class="mi">0</span> <span class="mi">10</span> <span class="mi">88690</span> <span class="mi">232333</span>
870 <span class="mi">8</span><span class="p">:</span> <span class="mi">535674</span> <span class="mi">525397</span> <span class="mi">14607</span> <span class="mi">991</span>
871 <span class="mi">12</span><span class="p">:</span> <span class="mi">36</span>
872
873 <span class="n">cmd_get:</span> <span class="mi">1257969</span>
874 <span class="n">cmd_set:</span> <span class="mi">139785</span>
875 <span class="n">get_misses:</span> <span class="mi">0</span>
876 <span class="n">verify_misses:</span> <span class="mi">0</span>
877 <span class="n">verify_failed:</span> <span class="mi">0</span>
878 <span class="n">expired_get:</span> <span class="mi">0</span>
879 <span class="n">unexpired_unget:</span> <span class="mi">0</span>
880 <span class="n">written_bytes:</span> <span class="mi">242516030</span>
881 <span class="n">read_bytes:</span> <span class="mi">1003702556</span>
882 <span class="n">object_bytes:</span> <span class="mi">152086080</span>
883 <span class="n">packet_disorder:</span> <span class="mi">0</span>
884 <span class="n">packet_drop:</span> <span class="mi">0</span>
885 <span class="n">udp_timeout:</span> <span class="mi">0</span>
886
887 <span class="n">Run</span> <span class="nb">time</span><span class="p">:</span> <span class="mf">20.0</span><span class="n">s</span> <span class="n">Ops:</span> <span class="mi">1397754</span> <span class="n">TPS:</span> <span class="mi">69817</span> <span class="n">Net_rate:</span> <span class="mf">59.4</span><span class="n">M</span><span class="o">/</span><span class="n">s</span>
888 <span class="o">---------------------------------------------------------------------------------------------------------------------------------</span>
889 </pre></div>
890 </div>
891 </div>
892 <div class="section" id="id2">
893 <h3>Where<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
894 <p>Get Statistics</p>
895 <blockquote>
896 <div><p>Get statistics of response time</p>
897 </div></blockquote>
898 <p>Set Statistics</p>
899 <blockquote>
900 <div><p>Set statistics of response time</p>
901 </div></blockquote>
902 <p>Total Statistics</p>
903 <blockquote>
904 <div><p>Both get and set statistics of response time</p>
905 </div></blockquote>
906 <p>Min</p>
907 <blockquote>
908 <div><p>The accumulated and minimum response time</p>
909 </div></blockquote>
910 <p>Max</p>
911 <blockquote>
912 <div><p>The accumulated and maximum response time</p>
913 </div></blockquote>
914 <p>Avg</p>
915 <blockquote>
916 <div><p>The accumulated and average response time</p>
917 </div></blockquote>
918 <p>Std</p>
919 <blockquote>
920 <div><p>Standard deviation of response time</p>
921 </div></blockquote>
922 <p>Log2 Dist</p>
923 <blockquote>
924 <div><p>Geometric distribution based on logarithm 2</p>
925 </div></blockquote>
926 <p>cmd_get</p>
927 <blockquote>
928 <div><p>Total get commands done</p>
929 </div></blockquote>
930 <p>cmd_set</p>
931 <blockquote>
932 <div><p>Total set commands done</p>
933 </div></blockquote>
934 <p>get_misses</p>
935 <blockquote>
936 <div><p>How many objects can’t be gotten from server</p>
937 </div></blockquote>
938 <p>verify_misses</p>
939 <blockquote>
940 <div><p>How many objects need to verify but can’t get them</p>
941 </div></blockquote>
942 <p>verify_failed</p>
943 <blockquote>
944 <div><p>How many objects with insistent value</p>
945 </div></blockquote>
946 <p>expired_get</p>
947 <blockquote>
948 <div><p>How many objects are expired but we get them</p>
949 </div></blockquote>
950 <p>unexpired_unget</p>
951 <blockquote>
952 <div><p>How many objects are unexpired but we can’t get them</p>
953 </div></blockquote>
954 <p>written_bytes</p>
955 <blockquote>
956 <div><p>Total written bytes</p>
957 </div></blockquote>
958 <p>read_bytes</p>
959 <blockquote>
960 <div><p>Total read bytes</p>
961 </div></blockquote>
962 <p>object_bytes</p>
963 <blockquote>
964 <div><p>Total object bytes</p>
965 </div></blockquote>
966 <p>packet_disorder</p>
967 <blockquote>
968 <div><p>How many UDP packages are disorder</p>
969 </div></blockquote>
970 <p>packet_drop</p>
971 <blockquote>
972 <div><p>How many UDP packages are lost</p>
973 </div></blockquote>
974 <p>udp_timeout</p>
975 <blockquote>
976 <div><p>How many times UDP time out happen</p>
977 </div></blockquote>
978 <p>Run time</p>
979 <blockquote>
980 <div><p>Total run time</p>
981 </div></blockquote>
982 <p>Ops</p>
983 <blockquote>
984 <div><p>Total operations</p>
985 </div></blockquote>
986 <p>TPS</p>
987 <blockquote>
988 <div><p>Throughput, operations/second</p>
989 </div></blockquote>
990 <p>Net_rate</p>
991 <blockquote>
992 <div><p>The average rate of network</p>
993 </div></blockquote>
994 </div>
995 </div>
996 <div class="section" id="options">
997 <h2>OPTIONS<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
998 <dl class="simple">
999 <dt>-s, –servers=</dt><dd><p>List one or more servers to connect. Servers count must be less than
1000 threads count. e.g.: –servers=localhost:1234,localhost:11211</p>
1001 </dd>
1002 <dt>-T, –threads=</dt><dd><p>Number of threads to startup, better equal to CPU numbers. Default 8.</p>
1003 </dd>
1004 <dt>-c, –concurrency=</dt><dd><p>Number of concurrency to simulate with load. Default 128.</p>
1005 </dd>
1006 <dt>-n, –conn_sock=</dt><dd><p>Number of TCP socks per concurrency. Default 1.</p>
1007 </dd>
1008 <dt>-x, –execute_number=</dt><dd><p>Number of operations(get and set) to execute for the
1009 given test. Default 1000000.</p>
1010 </dd>
1011 <dt>-t, –time=</dt><dd><p>How long the test to run, suffix: s-seconds, m-minutes, h-hours,
1012 d-days e.g.: –time=2h.</p>
1013 </dd>
1014 <dt>-F, –cfg_cmd=</dt><dd><p>Load the configure file to get command,key and value distribution list.</p>
1015 </dd>
1016 <dt>-w, –win_size=</dt><dd><p>Task window size of each concurrency, suffix: K, M e.g.: –win_size=10k.
1017 Default 10k.</p>
1018 </dd>
1019 <dt>-X, –fixed_size=</dt><dd><p>Fixed length of value.</p>
1020 </dd>
1021 <dt>-v, –verify=</dt><dd><p>The proportion of date verification, e.g.: –verify=0.01</p>
1022 </dd>
1023 <dt>-d, –division=</dt><dd><p>Number of keys to multi-get once. Default 1, means single get.</p>
1024 </dd>
1025 <dt>-S, –stat_freq=</dt><dd><p>Frequency of dumping statistic information. suffix: s-seconds,
1026 m-minutes, e.g.: –resp_freq=10s.</p>
1027 </dd>
1028 <dt>-e, –exp_verify=</dt><dd><p>The proportion of objects with expire time, e.g.: –exp_verify=0.01.
1029 Default no object with expire time</p>
1030 </dd>
1031 <dt>-o, –overwrite=</dt><dd><p>The proportion of objects need overwrite, e.g.: –overwrite=0.01.
1032 Default never overwrite object.</p>
1033 </dd>
1034 </dl>
1035 <dl class="option-list">
1036 <dt><kbd><span class="option">-R</span>, <span class="option">--reconnect</span></kbd></dt>
1037 <dd><p>Reconnect tests, when connection is closed it will be reconnected.</p>
1038 </dd>
1039 <dt><kbd><span class="option">-U</span>, <span class="option">--udp</span></kbd></dt>
1040 <dd><p>UDP tests, default memaslap uses TCP, TCP port and UDP port of
1041 server must be same.</p>
1042 </dd>
1043 <dt><kbd><span class="option">-a</span>, <span class="option">--facebook</span></kbd></dt>
1044 <dd><p>Whether it enables facebook test feature, set with TCP and multi-get with UDP.</p>
1045 </dd>
1046 <dt><kbd><span class="option">-B</span>, <span class="option">--binary</span></kbd></dt>
1047 <dd><p>Whether it enables binary protocol. Default with ASCII protocol.</p>
1048 </dd>
1049 </dl>
1050 <dl class="simple">
1051 <dt>-P, –tps=</dt><dd><p>Expected throughput, suffix: K, e.g.: –tps=10k.</p>
1052 </dd>
1053 <dt>-p, –rep_write=</dt><dd><p>The first nth servers can write data, e.g.: –rep_write=2.</p>
1054 </dd>
1055 </dl>
1056 <dl class="option-list">
1057 <dt><kbd><span class="option">-b</span>, <span class="option">--verbose</span></kbd></dt>
1058 <dd><p>Whether it outputs detailed information when verification fails.</p>
1059 </dd>
1060 <dt><kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></dt>
1061 <dd><p>Display this message and then exit.</p>
1062 </dd>
1063 <dt><kbd><span class="option">-V</span>, <span class="option">--version</span></kbd></dt>
1064 <dd><p>Display the version of the application and then exit.</p>
1065 </dd>
1066 </dl>
1067 </div>
1068 <div class="section" id="examples">
1069 <h2>EXAMPLES<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
1070 <p>memaslap -s 127.0.0.1:11211 -S 5s</p>
1071 <p>memaslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b</p>
1072 <p>memaslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2</p>
1073 <p>memaslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k</p>
1074 <p>memaslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40</p>
1075 <p>memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m</p>
1076 <p>memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2</p>
1077 </div>
1078 <div class="section" id="see-also">
1079 <h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
1080 </div>
1081 </div>
1082
1083
1084 </div>
1085
1086 </div>
1087 <footer>
1088
1089 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
1090
1091 <a href="memstat.html" class="btn btn-neutral float-right" title="memstat - Gather statistics from a server" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
1092
1093
1094 <a href="memslap.html" class="btn btn-neutral float-left" title="memslap - Load testing and benchmarking a server" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
1095
1096 </div>
1097
1098
1099 <hr/>
1100
1101 <div role="contentinfo">
1102 <p>
1103 &copy; <a href="../copyright.html">Copyright</a>
1104
1105 </p>
1106 </div>
1107 Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
1108
1109 </footer>
1110
1111 </div>
1112 </div>
1113
1114 </section>
1115
1116 </div>
1117
1118
1119
1120 <script type="text/javascript">
1121 jQuery(function () {
1122 SphinxRtdTheme.Navigation.enable(true);
1123 });
1124 </script>
1125
1126
1127
1128
1129
1130
1131 </body>
1132 </html>