Skip to content

Commit a3e2815

Browse files
committed
Add memtier benchmark
1 parent c363556 commit a3e2815

File tree

7 files changed

+224
-0
lines changed

7 files changed

+224
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CMakeFiles
55
memcapable
66
memaslap
77
memslap
8+
memtier_benchmark
89
.*.swp
910
*~
1011
test/var

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "test-run"]
55
path = test-run
66
url = https://github.com/tarantool/test-run.git
7+
[submodule "third_party/memtier"]
8+
path = third_party/memtier
9+
url = https://github.com/RedisLabs/memtier_benchmark.git

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ cmake_minimum_required(VERSION 2.8)
22

33
include(cmake/build_libmemcached.cmake)
44
libmemcached_build()
5+
include(cmake/build_memtier.cmake)
6+
memtier_build()

cmake/build_memtier.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
macro (memtier_build)
2+
set(memtier_src ${PROJECT_SOURCE_DIR}/third_party/memtier)
3+
add_custom_target(memtier_cfg autoreconf -ivf
4+
COMMAND ./configure
5+
WORKING_DIRECTORY ${memtier_src}
6+
)
7+
add_custom_target(memtier_make
8+
COMMAND make
9+
DEPENDS memtier_cfg
10+
WORKING_DIRECTORY ${memtier_src}
11+
)
12+
add_custom_target(memtier_copy
13+
COMMAND ${CMAKE_COMMAND} -E copy ${memtier_src}/memtier_benchmark
14+
${PROJECT_BINARY_DIR}/test/bench/memtier_benchmark
15+
DEPENDS memtier_make
16+
)
17+
add_custom_target(memtier ALL DEPENDS memtier_copy)
18+
endmacro(memtier_build)

test/bench/README.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Building
2+
3+
```
4+
cmake .
5+
make libmemcached memtier
6+
```
7+
8+
# Mem(a)slap
9+
10+
```
11+
* -s, --servers= : List one or more servers to connect. Servers count must be less than threads count.
12+
e.g.: –servers=localhost:1234,localhost:11211
13+
* -T, --threads= : Number of threads to startup, better equal to CPU numbers.
14+
Default 8.
15+
* -c, --concurrency= : Number of concurrency to simulate with load.
16+
Default 128.
17+
* -n, --conn_sock= : Number of TCP socks per concurrency.
18+
Default 1.
19+
* -x, --execute_number= : Number of operations(get and set) to execute for the given test.
20+
Default 1000000.
21+
* -t, --time= : How long the test to run, suffix: s,m,h,d
22+
e.g.: –time=2h.
23+
* -F, --cfg_cmd= : Load the configure file to get command, key and value distribution list.
24+
* -w, --win_size= : Task window size of each concurrency, suffix: K, M
25+
e.g.: –win_size=10k. Default 10k.
26+
* -X, --fixed_size= : Fixed length of value.
27+
* -v, --verify= : The proportion of date verification, e.g.:
28+
–verify=0.01
29+
* -d, --division= : Number of keys to multi-get once.
30+
Default 1, means single get.
31+
* -S, --stat_freq= : Frequency of dumping statistic information. suffix: s,m
32+
e.g.: –resp_freq=10s.
33+
* -e, --exp_verify : The proportion of objects with expire time
34+
e.g.: –exp_verify=0.01
35+
Default no object with expire time
36+
* -o, --overwrite= : The proportion of objects need overwrite
37+
e.g.: –overwrite=0.01.
38+
Default never overwrite object.
39+
* -R, --reconnect= : Reconnect tests, when connection is closed it will be reconnected.
40+
* -U, --udp : UDP tests, default memaslap uses TCP, TCP port and UDP port of server must be same.
41+
* -a, --facebook : Whether it enables facebook test feature, set with TCP and multi-get with UDP.
42+
* -B, --binary : Whether it enables binary protocol.
43+
Default with ASCII protocol.
44+
* -P, --tps= : Expected throughput, suffix: K
45+
e.g.: –tps=10k.
46+
* -p, --rep_write= : The first nth servers can write data
47+
e.g.: –rep_write=2.
48+
* -b, --verbose : Whether it outputs detailed information when verification fails.
49+
* -h, --help : Display this message and then exit.
50+
* -V, --version : Display the version of the application and then exit.
51+
```
52+
53+
Configuration file:
54+
```
55+
###################################
56+
#
57+
# key
58+
# start_len end_len proportion
59+
#
60+
# example1: key range 16~100 accounts for 80%
61+
# key range 101~200 accounts for 10%
62+
# key range 201~250 accounts for 10%
63+
# total should be 1 (0.8+0.1+0.1 = 1)
64+
#
65+
# 16 100 0.8
66+
# 101 200 0.1
67+
# 201 249 0.1
68+
#
69+
# example2: all keys length are 128 bytes
70+
#
71+
# 128 128 1
72+
#
73+
###################################
74+
#
75+
# value
76+
# start_len end_len proportion
77+
#
78+
# example1: value range 1~1000 accounts for 80%
79+
# value range 1001~10000 accounts for 10%
80+
# value range 10001~100000 accounts for 10%
81+
# total should be 1 (0.8+0.1+0.1 = 1)
82+
#
83+
# 1 1000 0.8
84+
# 1001 10000 0.1
85+
# 10001 100000 0.1
86+
#
87+
# example2: all value length are 128 bytes
88+
#
89+
# 128 128 1
90+
#
91+
###################################
92+
#
93+
# cmd
94+
# cmd_type cmd_proportion
95+
#
96+
# currently memaslap only testss get and set command.
97+
#
98+
# cmd_type:
99+
# set 0
100+
# get 1
101+
#
102+
# example: set command accounts for 50%
103+
# get command accounts for 50%
104+
# total should be 1 (0.5+0.5 = 1)
105+
#
106+
# cmd
107+
# 0 0.5
108+
# 1 0.5
109+
#
110+
###################################
111+
```
112+
113+
# Memtier benchmark
114+
115+
```
116+
A memcache/redis NoSQL traffic generator and performance benchmarking tool.
117+
118+
Connection and General Options:
119+
-s, --server=ADDR Server address (default: localhost)
120+
-p, --port=PORT Server port (default: 6379)
121+
-S, --unix-socket=SOCKET UNIX Domain socket name (default: none)
122+
-P, --protocol=PROTOCOL Protocol to use (default: redis). Other
123+
supported protocols are memcache_text,
124+
memcache_binary.
125+
-x, --run-count=NUMBER Number of full-test iterations to perform
126+
-D, --debug Print debug output
127+
--client-stats=FILE Produce per-client stats file
128+
--out-file=FILE Name of output file (default: stdout)
129+
--show-config Print detailed configuration before running
130+
--hide-histogram Don't print detailed latency histogram
131+
132+
Test Options:
133+
-n, --requests=NUMBER Number of total requests per client (default: 10000)
134+
use 'allkeys' to run on the entire key-range
135+
-c, --clients=NUMBER Number of clients per thread (default: 50)
136+
-t, --threads=NUMBER Number of threads (default: 4)
137+
--test-time=SECS Number of seconds to run the test
138+
--ratio=RATIO Set:Get ratio (default: 1:10)
139+
--pipeline=NUMBER Number of concurrent pipelined requests (default: 1)
140+
--reconnect-interval=NUM Number of requests after which re-connection is performed
141+
--multi-key-get=NUM Enable multi-key get commands, up to NUM keys (default: 0)
142+
-a, --authenticate=CREDENTIALS Authenticate to redis using CREDENTIALS, which depending
143+
on the protocol can be PASSWORD or USER:PASSWORD.
144+
--select-db=DB DB number to select, when testing a redis server
145+
--distinct-client-seed Use a different random seed for each client
146+
--randomize random seed based on timestamp (defalut is constant value)
147+
148+
Object Options:
149+
-d --data-size=SIZE Object data size (default: 32)
150+
--data-offset=OFFSET Actual size of value will be data-size + data-offset
151+
Will use SETRANGE / GETRANGE (default: 0)
152+
-R --random-data Indicate that data should be randomized
153+
--data-size-range=RANGE Use random-sized items in the specified range (min-max)
154+
--data-size-list=LIST Use sizes from weight list (size1:weight1,..sizeN:weightN)
155+
--data-size-pattern=R|S Use together with data-size-range
156+
when set to R, a random size from the defined data sizes will be used,
157+
when set to S, the defined data sizes will be evenly distributed across
158+
the key range, see --key-maximum (default R)
159+
--expiry-range=RANGE Use random expiry values from the specified range
160+
161+
Imported Data Options:
162+
--data-import=FILE Read object data from file
163+
--data-verify Enable data verification when test is complete
164+
--verify-only Only perform --data-verify, without any other test
165+
--generate-keys Generate keys for imported objects
166+
--no-expiry Ignore expiry information in imported data
167+
168+
Key Options:
169+
--key-prefix=PREFIX Prefix for keys (default: "memtier-")
170+
--key-minimum=NUMBER Key ID minimum value (default: 0)
171+
--key-maximum=NUMBER Key ID maximum value (default: 10000000)
172+
--key-pattern=PATTERN Set:Get pattern (default: R:R)
173+
G for Gaussian distribution.
174+
R for uniform Random.
175+
S for Sequential.
176+
P for Parallel (Sequential were each client has a subset of the key-range).
177+
--key-stddev The standard deviation used in the Gaussian distribution
178+
(default is key range / 6)
179+
--key-median The median point used in the Gaussian distribution
180+
(default is the center of the key range)
181+
--help Display this help
182+
--version Display version information
183+
184+
```

test/bench/memcached.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env tarantool
2+
3+
box.cfg{
4+
wal_mode = 'none',
5+
slab_alloc_arena = 0.1,
6+
}
7+
8+
local inst = require('memcached').create{
9+
name = 'memcached',
10+
uri = '0.0.0.0:11211',
11+
-- uri = os.getenv('LISTEN'):match(':(.*)'),
12+
expire_full_scan_time = 120
13+
}
14+
15+
-- box.schema.user.grant('guest', 'read,write,execute', 'universe')

third_party/memtier

Submodule memtier added at 40d47a0

0 commit comments

Comments
 (0)