Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add basho bench driver for pipeline queries.

  • Loading branch information...
commit c79f8fe5fe431c8532cbe9ca1cfe2aae054b8389 1 parent 52addf9
@jdavisp3 jdavisp3 authored
View
2  priv/basho_bench_eredis.config
@@ -7,7 +7,7 @@
{driver, basho_bench_driver_eredis}.
-{code_paths, ["/home/knutin/git/eredis/ebin/"]}.
+{code_paths, ["../eredis/ebin"]}.
{operations, [{get,1}, {put,4}]}.
View
17 priv/basho_bench_eredis_pipeline.config
@@ -0,0 +1,17 @@
+{mode, max}.
+%{mode, {rate, 5}}.
+
+{duration, 15}.
+
+{concurrent, 30}.
+
+{driver, basho_bench_driver_eredis}.
+
+{code_paths, ["../eredis/ebin"]}.
+
+{operations, [{pipeline_get,100}, {pipeline_put,1}]}.
+
+{key_generator, {uniform_int, 10000}}.
+
+{value_generator, {function, basho_bench_driver_eredis, value_gen, []}}.
+%{value_generator, {fixed_bin, 1}}.
View
4 priv/basho_bench_erldis.config
@@ -7,8 +7,8 @@
{driver, basho_bench_driver_erldis}.
-{code_paths, ["/home/knutin/git/eredis/ebin/",
- "/home/knutin/git/erldis/ebin/"]}.
+{code_paths, ["../eredis/ebin",
+ "../erldis/ebin/"]}.
{operations, [{get,1}, {put,4}]}.
View
41 src/basho_bench_driver_eredis.erl
@@ -31,6 +31,24 @@ run(get, KeyGen, _ValueGen, Client) ->
{error, timeout, Client}
end;
+run(pipeline_get, KeyGen, _ValueGen, Client) ->
+ Seq = lists:seq(1, 5),
+ P = [["GET", KeyGen()] || _ <- Seq],
+
+ case catch(eredis:qp(Client, P, 500)) of
+ {error, Reason} ->
+ {error, Reason, Client};
+ {'EXIT', {timeout, _}} ->
+ {error, timeout, Client};
+ Res ->
+ case check_pipeline_get(Res, Seq) of
+ ok ->
+ {ok, Client};
+ {error, Reason} ->
+ {error, Reason, Client}
+ end
+ end;
+
run(put, KeyGen, ValueGen, Client) ->
case catch(eredis:q(Client, ["SET", KeyGen(), ValueGen()], 100)) of
{ok, <<"OK">>} ->
@@ -39,8 +57,31 @@ run(put, KeyGen, ValueGen, Client) ->
{error, Reason, Client};
{'EXIT', {timeout, _}} ->
{error, timeout, Client}
+ end;
+
+run(pipeline_put, KeyGen, ValueGen, Client) ->
+ Seq = lists:seq(1, 5),
+ P = [["SET", KeyGen(), ValueGen()] || _ <- Seq],
+ R = [{ok, <<"OK">>} || _ <- Seq],
+
+ case catch(eredis:qp(Client, P, 500)) of
+ R ->
+ {ok, Client};
+ {error, Reason} ->
+ {error, Reason, Client};
+ {'EXIT', {timeout, _}} ->
+ {error, timeout, Client}
end.
+
+check_pipeline_get([], []) ->
+ ok;
+check_pipeline_get([{ok, _}|Res], [_|Seq]) ->
+ check_pipeline_get(Res, Seq);
+check_pipeline_get([{error, Reason}], _) ->
+ {error, Reason}.
+
+
value_gen(_Id) ->
fun() ->
%% %% Example data from http://json.org/example.html
Please sign in to comment.
Something went wrong with that request. Please try again.