Skip to content

Commit 295897a

Browse files
committed
* Version 1.2.0
* Add --data-size-pattern * Add --key-pattern now has Gaussian distribution, and also --key-stddev, --key-median * Add --data-offset * Add --hide-histogram
1 parent 3152873 commit 295897a

11 files changed

+403
-109
lines changed

CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
* Version 1.2.0
2+
* Add --data-size-pattern
3+
* Add --key-pattern now has Gaussian distribution, and also --key-stddev, --key-median
4+
* Add --data-offset
5+
* Add --hide-histogram
6+
17
* Version 1.1.0
28
* Add --data-verify and --verify options to allow data verification.
39
* Add --no-expiry option to ignore expiry of imported data.

client.cpp

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,12 @@ void client::create_request(void)
471471
// are we set or get? this depends on the ratio
472472
if (m_set_ratio_count < m_config->ratio.a) {
473473
// set command
474-
475-
data_object *obj = m_obj_gen->get_object(m_config->key_pattern[0] == 'R' ? 0 : 1);
474+
int iter = OBJECT_GENERATOR_KEY_SET_ITER;
475+
if (m_config->key_pattern[0] == 'R')
476+
iter = OBJECT_GENERATOR_KEY_RANDOM;
477+
else if (m_config->key_pattern[0] == 'G')
478+
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
479+
data_object *obj = m_obj_gen->get_object(iter);
476480
unsigned int key_len;
477481
const char *key = obj->get_key(&key_len);
478482
unsigned int value_len;
@@ -483,7 +487,7 @@ void client::create_request(void)
483487
benchmark_debug_log("SET key=[%.*s] value_len=%u expiry=%u\n",
484488
key_len, key, value_len, obj->get_expiry());
485489
cmd_size = m_protocol->write_command_set(key, key_len, value, value_len,
486-
obj->get_expiry());
490+
obj->get_expiry(), m_config->data_offset);
487491

488492
m_pipeline.push(new client::request(rt_set, cmd_size, NULL, 1));
489493
} else if (m_get_ratio_count < m_config->ratio.b) {
@@ -500,7 +504,12 @@ void client::create_request(void)
500504
m_keylist->clear();
501505
while (m_keylist->get_keys_count() < keys_count) {
502506
unsigned int keylen;
503-
const char *key = m_obj_gen->get_key(m_config->key_pattern[2] == 'R' ? 0 : 2, &keylen);
507+
int iter = OBJECT_GENERATOR_KEY_GET_ITER;
508+
if (m_config->key_pattern[2] == 'R')
509+
iter = OBJECT_GENERATOR_KEY_RANDOM;
510+
else if (m_config->key_pattern[2] == 'G')
511+
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
512+
const char *key = m_obj_gen->get_key(iter, &keylen);
504513

505514
assert(key != NULL);
506515
assert(keylen > 0);
@@ -521,12 +530,17 @@ void client::create_request(void)
521530
m_pipeline.push(new client::request(rt_get, cmd_size, NULL, m_keylist->get_keys_count()));
522531
} else {
523532
unsigned int keylen;
524-
const char *key = m_obj_gen->get_key(m_config->key_pattern[2] == 'R' ? 0 : 2, &keylen);
533+
int iter = OBJECT_GENERATOR_KEY_GET_ITER;
534+
if (m_config->key_pattern[2] == 'R')
535+
iter = OBJECT_GENERATOR_KEY_RANDOM;
536+
else if (m_config->key_pattern[2] == 'G')
537+
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
538+
const char *key = m_obj_gen->get_key(iter, &keylen);
525539
assert(key != NULL);
526540
assert(keylen > 0);
527541

528542
benchmark_debug_log("GET key=[%.*s]\n", keylen, key);
529-
cmd_size = m_protocol->write_command_get(key, keylen);
543+
cmd_size = m_protocol->write_command_get(key, keylen, m_config->data_offset);
530544

531545
m_get_ratio_count++;
532546
m_pipeline.push(new client::request(rt_get, cmd_size, NULL, 1));
@@ -734,15 +748,20 @@ void verify_client::create_request(void)
734748
if (m_set_ratio_count < m_config->ratio.a) {
735749
// Prepare a GET request that will be compared against a previous
736750
// SET request.
737-
data_object *obj = m_obj_gen->get_object(m_config->key_pattern[0] == 'R' ? 0 : 1);
751+
int iter = OBJECT_GENERATOR_KEY_SET_ITER;
752+
if (m_config->key_pattern[0] == 'R')
753+
iter = OBJECT_GENERATOR_KEY_RANDOM;
754+
else if (m_config->key_pattern[0] == 'G')
755+
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
756+
data_object *obj = m_obj_gen->get_object(iter);
738757
unsigned int key_len;
739758
const char *key = obj->get_key(&key_len);
740759
unsigned int value_len;
741760
const char *value = obj->get_value(&value_len);
742761
unsigned int cmd_size;
743762

744763
m_set_ratio_count++;
745-
cmd_size = m_protocol->write_command_get(key, key_len);
764+
cmd_size = m_protocol->write_command_get(key, key_len, m_config->data_offset);
746765

747766
m_pipeline.push(new verify_client::verify_request(rt_get,
748767
cmd_size, NULL, 1, key, key_len, value, value_len));
@@ -758,7 +777,12 @@ void verify_client::create_request(void)
758777
m_keylist->clear();
759778
while (m_keylist->get_keys_count() < keys_count) {
760779
unsigned int keylen;
761-
const char *key = m_obj_gen->get_key(m_config->key_pattern[2] == 'R' ? 0 : 2, &keylen);
780+
int iter = OBJECT_GENERATOR_KEY_GET_ITER;
781+
if (m_config->key_pattern[2] == 'R')
782+
iter = OBJECT_GENERATOR_KEY_RANDOM;
783+
else if (m_config->key_pattern[2] == 'G')
784+
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
785+
const char *key = m_obj_gen->get_key(iter, &keylen);
762786

763787
assert(key != NULL);
764788
assert(keylen > 0);
@@ -769,7 +793,12 @@ void verify_client::create_request(void)
769793
m_get_ratio_count += keys_count;
770794
} else {
771795
unsigned int keylen;
772-
m_obj_gen->get_key(m_config->key_pattern[2] == 'R' ? 0 : 2, &keylen);
796+
int iter = OBJECT_GENERATOR_KEY_GET_ITER;
797+
if (m_config->key_pattern[2] == 'R')
798+
iter = OBJECT_GENERATOR_KEY_RANDOM;
799+
else if (m_config->key_pattern[2] == 'G')
800+
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
801+
m_obj_gen->get_key(iter, &keylen);
773802
m_get_ratio_count++;
774803
}
775804

@@ -1342,7 +1371,7 @@ void run_stats::summarize(totals& result) const
13421371
result.m_bytes_sec = (double) ((result.m_bytes / 1024) / test_duration_sec);
13431372
}
13441373

1345-
void run_stats::print(FILE *out)
1374+
void run_stats::print(FILE *out, bool histogram)
13461375
{
13471376
// aggregate all one_second_stats; we do this only if we have
13481377
// one_second_stats, otherwise it means we're probably printing previously
@@ -1382,6 +1411,9 @@ void run_stats::print(FILE *out)
13821411
m_totals.m_latency,
13831412
m_totals.m_bytes_sec);
13841413

1414+
if (!histogram)
1415+
return;
1416+
13851417
fprintf(out,
13861418
"\n\n"
13871419
"Request Latency Distribution\n"

client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class run_stats {
109109
void merge(const run_stats& other);
110110
bool save_csv(const char *filename);
111111
void debug_dump(void);
112-
void print(FILE *file);
112+
void print(FILE *file, bool histogram);
113113

114114
unsigned int get_duration(void);
115115
unsigned long int get_duration_usec(void);

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License
1616
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
AC_PREREQ(2.59)
19-
AC_INIT(memtier_benchmark,1.0.2,yossigo@gmail.com)
19+
AC_INIT(memtier_benchmark,1.2.0,yossigo@gmail.com)
2020
AC_CONFIG_SRCDIR([memtier_benchmark.cpp])
2121
AC_CONFIG_HEADER([config.h])
2222
AM_INIT_AUTOMAKE

memtier_benchmark.1

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4.
2-
.TH MEMTIER_BENCHMARK "1" "August 2013" "memtier_benchmark 1.0.2" "User Commands"
2+
.TH MEMTIER_BENCHMARK "1" "July 2014" "memtier_benchmark 1.2.0" "User Commands"
33
.SH NAME
44
memtier_benchmark \- NoSQL benchmark tool
55
.SH SYNOPSIS
@@ -37,6 +37,9 @@ Name of output file (default: stdout)
3737
.TP
3838
\fB\-\-show\-config\fR
3939
Print detailed configuration before running
40+
.TP
41+
\fB\-\-hide\-histogram\fR
42+
Don't print detailed latency histogram
4043
.SS "Test Options:"
4144
.TP
4245
\fB\-n\fR, \fB\-\-requests\fR=\fINUMBER\fR
@@ -73,6 +76,10 @@ DB number to select, when testing a redis server
7376
\fB\-d\fR \fB\-\-data\-size\fR=\fISIZE\fR
7477
Object data size (default: 32)
7578
.TP
79+
\fB\-\-data\-offset\fR=\fIOFFSET\fR
80+
Actual size of value will be data\-size + data\-offset
81+
Will use SETRANGE / GETRANGE (default: 0)
82+
.TP
7683
\fB\-R\fR \fB\-\-random\-data\fR
7784
Indicate that data should be randomized
7885
.TP
@@ -82,6 +89,12 @@ Use random\-sized items in the specified range (min\-max)
8289
\fB\-\-data\-size\-list\fR=\fILIST\fR
8390
Use sizes from weight list (size1:weight1,..sizeN:weightN)
8491
.TP
92+
\fB\-\-data\-size\-pattern\fR=\fIR\fR|S
93+
Use together with data\-size\-range
94+
when set to R, a random size from the defined data sizes will be used,
95+
when set to S, the defined data sizes will be evenly distributed across
96+
the key range, see \fB\-\-key\-maximum\fR (default R)
97+
.TP
8598
\fB\-\-expiry\-range\fR=\fIRANGE\fR
8699
Use random expiry values from the specified range
87100
.SS "Imported Data Options:"
@@ -113,6 +126,15 @@ Key ID maximum value (default: 10000000)
113126
.TP
114127
\fB\-\-key\-pattern\fR=\fIPATTERN\fR
115128
Set:Get pattern (default: R:R)
129+
G for Gaussian distribution, R for uniform Random, S for Sequential
130+
.TP
131+
\fB\-\-key\-stddev\fR
132+
The standard deviation used in the Gaussian distribution
133+
(default is key range / 6)
134+
.TP
135+
\fB\-\-key\-median\fR
136+
The median point used in the Gaussian distribution
137+
(default is the center of the key range)
116138
.TP
117139
\fB\-\-help\fR
118140
Display this help

0 commit comments

Comments
 (0)