Permalink
Browse files

Updates bench_driver_2i to create space between integer keys in index

  • Loading branch information...
1 parent a9ad7bc commit 6231a69038b228f92548d6385e33e9df3bdf1787 @jonmeredith jonmeredith committed Aug 8, 2012
Showing with 58 additions and 6 deletions.
  1. +52 −0 cfgs/2i_preload.config
  2. +6 −6 src/basho_bench_driver_2i.erl
View
@@ -0,0 +1,52 @@
+%% 2i_preload.config
+ %%
+ %% This basho_bench configuration file preloads a database with 10M
+ %% sequentially ordered keys.
+
+ {operations, [
+ {{put_pb, 1}, 1}
+ ]}.
+
+ {mode, max}.
+
+ {concurrent, 20}.
+
+ {duration, infinity}.
+
+ {driver, basho_bench_driver_2i}.
+
+ {code_paths, [
+ "deps/stats",
+ "deps/riakc",
+ "deps/protobuffs",
+ "deps/mochiweb"
+ ]}.
+
+ {key_generator,
+ %{sequential_int, 100000}}.
+ {partitioned_sequential_int, 100000}}.
+
+ {value_generator,
+ {fixed_bin, 1000}}.
+
+ {pb_ips, [
+ "10.0.27.21",
+ "10.0.27.23",
+ "10.0.27.24",
+ "10.0.27.25"
+ ]}.
+
+ {pb_port, 8087}.
+
+ {http_hosts, [
+ "10.0.27.21",
+ "10.0.27.23",
+ "10.0.27.24",
+ "10.0.27.25"
+ ]}.
+
+ {http_port, 8098}.
+
+ {rng_seed, {1, 2, 3}}.
+
+ {riakc_pb_bucket, <<"otherbucket">>}.
@@ -107,8 +107,8 @@ run({query_http, N}, KeyGen, _ValueGen, State) ->
Host = State#state.http_host,
Port = State#state.http_port,
Bucket = State#state.bucket,
- StartKey = to_integer(KeyGen()),
- EndKey = StartKey + N - 1,
+ StartKey = 10 * to_integer(KeyGen()),
+ EndKey = StartKey + 10 * N - 1,
URL = io_lib:format("http://~s:~p/buckets/~s/index/field1_int/~p/~p",
[Host, Port, Bucket, StartKey, EndKey]),
case json_get(URL) of
@@ -258,7 +258,7 @@ run({query_mr2, N}, KeyGen, _ValueGen, State) ->
run({query_pb, 1}, KeyGen, _ValueGen, State) ->
Pid = State#state.pb_pid,
Bucket = State#state.bucket,
- Key = to_integer(KeyGen()),
+ Key = 10 * to_integer(KeyGen()),
case riakc_pb_socket:get_index(Pid, Bucket, <<"field1_int">>, to_binary(Key)) of
{ok, Results} when length(Results) == 1 ->
{ok, State};
@@ -272,8 +272,8 @@ run({query_pb, 1}, KeyGen, _ValueGen, State) ->
run({query_pb, N}, KeyGen, _ValueGen, State) ->
Pid = State#state.pb_pid,
Bucket = State#state.bucket,
- StartKey = to_integer(KeyGen()),
- EndKey = StartKey + N - 1,
+ StartKey = 10 * to_integer(KeyGen()),
+ EndKey = StartKey + 10 * N - 1,
case riakc_pb_socket:get_index(Pid, Bucket, <<"field1_int">>,
to_binary(StartKey), to_binary(EndKey)) of
{ok, Results} when length(Results) == N ->
@@ -295,7 +295,7 @@ run(Other, _, _, _) ->
generate_integer_indexes_for_key(Key, N) ->
F = fun(X) ->
- {"field" ++ to_list(X) ++ "_int", Key}
+ {"field" ++ to_list(X) ++ "_int", Key * 10}
end,
[F(X) || X <- lists:seq(1, N)].

0 comments on commit 6231a69

Please sign in to comment.