Skip to content

Instantly share code, notes, and snippets.

@gliush
Last active August 29, 2015 13:58
Show Gist options
  • Save gliush/9974160 to your computer and use it in GitHub Desktop.
Save gliush/9974160 to your computer and use it in GitHub Desktop.
riak bench
{mod, max}.
{duration, 5}.
{report_interval,1}.
%concurrent%
{driver, basho_bench_driver_riakc_pb}.
%key_gen%
%val_gen%
{riakc_pb_ips, [
{10,166,166,103},
{10,167,21,160},
{10,179,38,66},
{10,160,190,28},
{10,161,65,164},
{10,166,165,69},
{10,179,7,44},
{10,161,67,17},
{10,179,45,102},
{10,168,165,70},
{10,166,117,104},
{10,188,27,171},
{10,179,5,7},
{10,179,49,166},
{10,178,235,66},
{10,160,194,159},
{10,160,195,128}
]}.
{riakc_pb_replies, 2}.
%%% {operations, [{get, 1}]}.
%operations%
%% Use {auto_reconnect, false} to get "old" behavior (prior to April 2013).
%% See deps/riakc/src/riakc_pb_socket.erl for all valid socket options.
{pb_connect_options, [{auto_reconnect, true}]}.
%% Overrides for the PB client's default 60 second timeout, on a
%% per-type-of-operation basis. All timeout units are specified in
%% milliseconds. The pb_timeout_general config item provides a
%% default timeout if the read/write/listkeys/mapreduce timeout is not
%% specified.
{pb_timeout_general, 30000}.
{pb_timeout_read, 5000}.
{pb_timeout_write, 5000}.
{pb_timeout_listkeys, 50000}.
%% The general timeout will be used because this specific item is commented:
%% {pb_timeout_mapreduce, 50000}.
#!/usr/bin/python
import itertools as it
import subprocess
variants = {
"concurrent" : [
"{concurrent, 1000}."
, "{concurrent, 2000}."
, "{concurrent, 3000}."
, "{concurrent, 5000}."
],
"key_gen" : [
"{key_generator, {int_to_bin_bigendian, {uniform_int, 10000}}}."
, "{key_generator, {int_to_bin_bigendian, {uniform_int, 10000000}}}."
, "{key_generator, {int_to_bin_bigendian, {pareto_int, 10000}}}."
, "{key_generator, {int_to_bin_bigendian, {pareto_int, 10000000}}}."
],
"val_gen" : [
"{value_generator, {uniform_bin, 1000, 4512}}."
, "{value_generator, {uniform_bin, 1000, 2512}}."
, "{value_generator, {exponential_bin, 1000, 2000}}."
],
"operations" : [
"{operations, [{get, 10}, {put, 1}]}."
, "{operations, [{get, 10}, {put, 5}]}."
, "{operations, [{get, 10}, {put, 10}]}."
, "{operations, [{get, 10}, {put, 10}, {delete, 10}]}."
, "{operations, [{get, 10}, {put, 10}, {update, 10}]}."
]
}
varNames = sorted(variants)
# http://stackoverflow.com/questions/3873654/combinations-from-dictionary-with-list-values-using-python
combinations = [ [ (varName, val) for varName, val in zip(varNames, prod) ]
for prod in it.product(*(variants[varName]
for varName in varNames))]
total = len(combinations)
cur = 0
for combination in combinations:
cur += 1
print "%d/%d %s" % (cur, total, combination)
config = open("nsto2.config", "w")
for line in open("nsto2.config.in", "r").readlines():
for (k,v) in combination:
line = line.replace("%%%s%%" % k, v)
config.write(line)
config.close()
subprocess.call(["./basho_bench", "nsto2.config"])
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment