Sean Cribbs avatar Sean Cribbs committed 081e8f9

Add sequential generator that splits the keyspace among the workers.

Comments (0)

Files changed (1)

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}) ->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.