Commits

Sean Cribbs committed 081e8f9

Add sequential generator that splits the keyspace among the workers.

  • Participants
  • Parent commits eaaba88

Comments (0)

Files changed (1)

File src/basho_bench_keygen.erl

 new({sequential_int_str, MaxKey}, _Id) ->
     Ref = make_ref(),
     fun() -> Key = sequential_int_generator(Ref, MaxKey), integer_to_list(Key) end;
+new({partitioned_sequential_int, MaxKey}, Id) ->
+    Workers = basho_bench_config:get(concurrent),
+    MaxValue = MaxKey div Workers,
+    MinValue = MaxValue * (Id - 1),
+    Ref = make_ref(),
+    fun() -> sequential_int_generator(Ref,MaxValue) + MinValue end;
+new({partitioned_sequential_int_bin, MaxKey}, Id) ->
+    Gen = new({partitioned_sequential_int, MaxKey}, Id),
+    fun() -> <<(Gen()):32/native>> end;
+new({partitioned_sequential_int_str, MaxKey}, Id) ->
+    Gen = new({partitioned_sequential_int, MaxKey}, Id),
+    fun() -> integer_to_list(Gen()) end;
 new({uniform_int_bin, MaxKey}, _Id) ->
     fun() -> Key = random:uniform(MaxKey), <<Key:32/native>> end;
 new({uniform_int_str, MaxKey}, _Id) ->
     MaxKey;
 dimension({sequential_int_str, MaxKey}) ->
     MaxKey;
+dimension({partitioned_sequential_int, MaxKey}) ->
+    MaxKey;
+dimension({partitioned_sequential_int_bin, MaxKey}) ->
+    MaxKey;
+dimension({partitioned_sequential_int_str, MaxKey}) ->
+    MaxKey;
 dimension({uniform_int_bin, MaxKey}) ->
     MaxKey;
 dimension({uniform_int_str, MaxKey}) ->