Skip to content

Commit cee8727

Browse files
committed
Add counters configuration for 2.0+.
Add a configuration that can be modified to do benchmarking for the new 2.0 CRDT counters.
1 parent cf968c9 commit cee8727

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

examples/counters-2.0.config

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{mode,{rate,max}}.
2+
{duration,1}.
3+
{rng_seed,now}.
4+
5+
%% This bucket type must be created and set to be datatype, maps.
6+
{riakc_pb_bucket,{<<"counters">>,<<"testbucket">>}}.
7+
8+
%% Pareto distribution over 7.5 million records.
9+
{key_generator, {int_to_bin_bigendian, {uniform_int, 10000}}}.
10+
{value_generator, {uniform_int, 100}}.
11+
12+
{concurrent,10}.
13+
14+
{operations,[{{counter,increment},1},
15+
{{counter,value},10}]}.
16+
17+
{riakc_pb_ips,[{"127.0.0.1",8087}]}.
18+
19+
{riakc_pb_replies,default}.
20+
21+
{driver,basho_bench_driver_riakc_pb}.

src/basho_bench_driver_riakc_pb.erl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,16 @@ run(mr_keylist_js, KeyGen, _ValueGen, State) ->
440440

441441
run({counter, value}, KeyGen, _ValueGen, State) ->
442442
Key = KeyGen(),
443+
lager:info("Counter value called for key: ~p", [Key]),
443444
Options = [{r,2}, {notfound_ok, true}, {timeout, 5000}],
444445
Result = riakc_pb_socket:fetch_type(State#state.pid,
445446
State#state.bucket,
446447
Key,
447448
Options),
448449
case Result of
449-
{ok, _} ->
450+
{ok, C0} ->
451+
C = riakc_counter:value(C0),
452+
lager:info("Counter value is: ~p", [C]),
450453
{ok, State};
451454
{error, {notfound, _}} ->
452455
{ok, State};
@@ -458,6 +461,7 @@ run({counter, value}, KeyGen, _ValueGen, State) ->
458461
run({counter, increment}, KeyGen, ValueGen, State) ->
459462
Amt = ValueGen(),
460463
Key = KeyGen(),
464+
lager:info("Counter value called for key: ~p", [Key]),
461465
Result = riakc_pb_socket:modify_type(State#state.pid,
462466
fun(C) ->
463467
riakc_counter:increment(Amt, C)

0 commit comments

Comments
 (0)