Skip to content

Commit

Permalink
* Version 1.2.0
Browse files Browse the repository at this point in the history
    * Add --data-size-pattern
    * Add --key-pattern now has Gaussian distribution, and also --key-stddev, --key-median
    * Add --data-offset
    * Add --hide-histogram
  • Loading branch information
oranagra committed Jul 8, 2014
1 parent 3152873 commit 295897a
Show file tree
Hide file tree
Showing 11 changed files with 403 additions and 109 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
* 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

* Version 1.1.0
* Add --data-verify and --verify options to allow data verification.
* Add --no-expiry option to ignore expiry of imported data.
Expand Down
54 changes: 43 additions & 11 deletions client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,12 @@ void client::create_request(void)
// are we set or get? this depends on the ratio
if (m_set_ratio_count < m_config->ratio.a) {
// set command

data_object *obj = m_obj_gen->get_object(m_config->key_pattern[0] == 'R' ? 0 : 1);
int iter = OBJECT_GENERATOR_KEY_SET_ITER;
if (m_config->key_pattern[0] == 'R')
iter = OBJECT_GENERATOR_KEY_RANDOM;
else if (m_config->key_pattern[0] == 'G')
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
data_object *obj = m_obj_gen->get_object(iter);
unsigned int key_len;
const char *key = obj->get_key(&key_len);
unsigned int value_len;
Expand All @@ -483,7 +487,7 @@ void client::create_request(void)
benchmark_debug_log("SET key=[%.*s] value_len=%u expiry=%u\n",
key_len, key, value_len, obj->get_expiry());
cmd_size = m_protocol->write_command_set(key, key_len, value, value_len,
obj->get_expiry());
obj->get_expiry(), m_config->data_offset);

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

assert(key != NULL);
assert(keylen > 0);
Expand All @@ -521,12 +530,17 @@ void client::create_request(void)
m_pipeline.push(new client::request(rt_get, cmd_size, NULL, m_keylist->get_keys_count()));
} else {
unsigned int keylen;
const char *key = m_obj_gen->get_key(m_config->key_pattern[2] == 'R' ? 0 : 2, &keylen);
int iter = OBJECT_GENERATOR_KEY_GET_ITER;
if (m_config->key_pattern[2] == 'R')
iter = OBJECT_GENERATOR_KEY_RANDOM;
else if (m_config->key_pattern[2] == 'G')
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
const char *key = m_obj_gen->get_key(iter, &keylen);
assert(key != NULL);
assert(keylen > 0);

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

m_get_ratio_count++;
m_pipeline.push(new client::request(rt_get, cmd_size, NULL, 1));
Expand Down Expand Up @@ -734,15 +748,20 @@ void verify_client::create_request(void)
if (m_set_ratio_count < m_config->ratio.a) {
// Prepare a GET request that will be compared against a previous
// SET request.
data_object *obj = m_obj_gen->get_object(m_config->key_pattern[0] == 'R' ? 0 : 1);
int iter = OBJECT_GENERATOR_KEY_SET_ITER;
if (m_config->key_pattern[0] == 'R')
iter = OBJECT_GENERATOR_KEY_RANDOM;
else if (m_config->key_pattern[0] == 'G')
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
data_object *obj = m_obj_gen->get_object(iter);
unsigned int key_len;
const char *key = obj->get_key(&key_len);
unsigned int value_len;
const char *value = obj->get_value(&value_len);
unsigned int cmd_size;

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

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

assert(key != NULL);
assert(keylen > 0);
Expand All @@ -769,7 +793,12 @@ void verify_client::create_request(void)
m_get_ratio_count += keys_count;
} else {
unsigned int keylen;
m_obj_gen->get_key(m_config->key_pattern[2] == 'R' ? 0 : 2, &keylen);
int iter = OBJECT_GENERATOR_KEY_GET_ITER;
if (m_config->key_pattern[2] == 'R')
iter = OBJECT_GENERATOR_KEY_RANDOM;
else if (m_config->key_pattern[2] == 'G')
iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
m_obj_gen->get_key(iter, &keylen);
m_get_ratio_count++;
}

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

void run_stats::print(FILE *out)
void run_stats::print(FILE *out, bool histogram)
{
// aggregate all one_second_stats; we do this only if we have
// one_second_stats, otherwise it means we're probably printing previously
Expand Down Expand Up @@ -1382,6 +1411,9 @@ void run_stats::print(FILE *out)
m_totals.m_latency,
m_totals.m_bytes_sec);

if (!histogram)
return;

fprintf(out,
"\n\n"
"Request Latency Distribution\n"
Expand Down
2 changes: 1 addition & 1 deletion client.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class run_stats {
void merge(const run_stats& other);
bool save_csv(const char *filename);
void debug_dump(void);
void print(FILE *file);
void print(FILE *file, bool histogram);

unsigned int get_duration(void);
unsigned long int get_duration_usec(void);
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.

AC_PREREQ(2.59)
AC_INIT(memtier_benchmark,1.0.2,[email protected])
AC_INIT(memtier_benchmark,1.2.0,[email protected])
AC_CONFIG_SRCDIR([memtier_benchmark.cpp])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
Expand Down
24 changes: 23 additions & 1 deletion memtier_benchmark.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4.
.TH MEMTIER_BENCHMARK "1" "August 2013" "memtier_benchmark 1.0.2" "User Commands"
.TH MEMTIER_BENCHMARK "1" "July 2014" "memtier_benchmark 1.2.0" "User Commands"
.SH NAME
memtier_benchmark \- NoSQL benchmark tool
.SH SYNOPSIS
Expand Down Expand Up @@ -37,6 +37,9 @@ Name of output file (default: stdout)
.TP
\fB\-\-show\-config\fR
Print detailed configuration before running
.TP
\fB\-\-hide\-histogram\fR
Don't print detailed latency histogram
.SS "Test Options:"
.TP
\fB\-n\fR, \fB\-\-requests\fR=\fINUMBER\fR
Expand Down Expand Up @@ -73,6 +76,10 @@ DB number to select, when testing a redis server
\fB\-d\fR \fB\-\-data\-size\fR=\fISIZE\fR
Object data size (default: 32)
.TP
\fB\-\-data\-offset\fR=\fIOFFSET\fR
Actual size of value will be data\-size + data\-offset
Will use SETRANGE / GETRANGE (default: 0)
.TP
\fB\-R\fR \fB\-\-random\-data\fR
Indicate that data should be randomized
.TP
Expand All @@ -82,6 +89,12 @@ Use random\-sized items in the specified range (min\-max)
\fB\-\-data\-size\-list\fR=\fILIST\fR
Use sizes from weight list (size1:weight1,..sizeN:weightN)
.TP
\fB\-\-data\-size\-pattern\fR=\fIR\fR|S
Use together with data\-size\-range
when set to R, a random size from the defined data sizes will be used,
when set to S, the defined data sizes will be evenly distributed across
the key range, see \fB\-\-key\-maximum\fR (default R)
.TP
\fB\-\-expiry\-range\fR=\fIRANGE\fR
Use random expiry values from the specified range
.SS "Imported Data Options:"
Expand Down Expand Up @@ -113,6 +126,15 @@ Key ID maximum value (default: 10000000)
.TP
\fB\-\-key\-pattern\fR=\fIPATTERN\fR
Set:Get pattern (default: R:R)
G for Gaussian distribution, R for uniform Random, S for Sequential
.TP
\fB\-\-key\-stddev\fR
The standard deviation used in the Gaussian distribution
(default is key range / 6)
.TP
\fB\-\-key\-median\fR
The median point used in the Gaussian distribution
(default is the center of the key range)
.TP
\fB\-\-help\fR
Display this help
Expand Down
Loading

0 comments on commit 295897a

Please sign in to comment.