Skip to content

Commit 1444e6e

Browse files
committed
Set minimum keys for always get
So that there is a natural pre-load stage up to a minumum database size
1 parent 9bc7cc8 commit 1444e6e

3 files changed

Lines changed: 25 additions & 15 deletions

File tree

examples/riakc_nhs.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
%% For alwaysget operations what is:
1616
%% - the maximum number of keys per worker (max number of keys = this * concurrent)
1717
%% - whether the inserts should be in key_order, or whether the order should be skewed by a 1 byte hash at the head of the key
18-
{alwaysget, {600000, skew_order}}.
18+
{alwaysget, {600000, 1, skew_order}}.
1919

2020
{pb_ips, [{127,0,0,1}]}.
2121
{http_ips, [{127,0,0,1}]}.

examples/riakc_nhs_clinicals.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
%% For alwaysget operations what is:
1616
%% - the maximum number of keys per worker (max number of keys = this * concurrent)
1717
%% - whether the inserts should be in key_order, or whether the order should be skewed by a 1 byte hash at the head of the key
18-
{alwaysget, {400000, skew_order}}.
18+
{alwaysget, {400000, 50000, skew_order}}.
1919

2020
{pb_ips, [{127,0,0,1}]}.
2121
{http_ips, [{127,0,0,1}]}.

src/basho_bench_driver_nhs.erl

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
http_timeout,
4141
fold_timeout,
4242
alwaysget_perworker_maxkeycount = 1 :: integer(),
43+
alwayshet_perworker_minkeycount = 1 :: integer(),
4344
alwaysget_keyorder = key_order :: key_order|skew_order,
4445
postcodeq_count = 0 :: integer(),
4546
postcodeq_sum = 0 :: integer(),
@@ -118,7 +119,8 @@ new(Id) ->
118119
PBTargetPort,
119120
Id]),
120121

121-
{AGMaxKC, AGKeyOrder} = basho_bench_config:get(alwaysget, {1, key_order}),
122+
{AGMaxKC, AGMinKC, AGKeyOrder} =
123+
basho_bench_config:get(alwaysget, {1, 1, key_order}),
122124

123125
case riakc_pb_socket:start_link(PBTargetIp, PBTargetPort) of
124126
{ok, Pid} ->
@@ -137,6 +139,7 @@ new(Id) ->
137139
unique_key_count = 1,
138140
alwaysget_key_count = 0,
139141
alwaysget_perworker_maxkeycount = AGMaxKC,
142+
alwayshet_perworker_minkeycount = AGMinKC,
140143
alwaysget_keyorder = AGKeyOrder
141144
}};
142145
{error, Reason2} ->
@@ -163,19 +166,26 @@ run(alwaysget_pb, _KeyGen, _ValueGen, State) ->
163166
Pid = State#state.pb_pid,
164167
Bucket = State#state.recordBucket,
165168
AGKC = State#state.alwaysget_key_count,
166-
KeyInt = eightytwenty_keycount(AGKC),
167-
Key = generate_uniquekey(KeyInt, State#state.rand_keyid,
168-
State#state.alwaysget_keyorder),
169+
case AGKC > State#state.alwayshet_perworker_minkeycount of
170+
true ->
169171

170-
case {riakc_pb_socket:get(Pid, Bucket, Key, State#state.pb_timeout), KeyInt} of
171-
{{ok, _Obj}, _} ->
172-
{ok, State};
173-
{{error, notfound}, 1} ->
174-
lager:info("Not Found with KeyInt of ~w AGKC ~w", [KeyInt, AGKC]),
175-
{ok, State};
176-
{{error, Reason}, _KeyInt} ->
177-
% not_found is not OK
178-
{error, Reason, State}
172+
KeyInt = eightytwenty_keycount(AGKC),
173+
Key = generate_uniquekey(KeyInt, State#state.rand_keyid,
174+
State#state.alwaysget_keyorder),
175+
176+
case riakc_pb_socket:get(Pid,
177+
Bucket, Key,
178+
State#state.pb_timeout) of
179+
{ok, _Obj} ->
180+
{ok, State};
181+
{error, Reason} ->
182+
% not_found is not OK
183+
{error, Reason, State}
184+
end;
185+
186+
false ->
187+
{silent, State}
188+
179189
end;
180190

181191
run(alwaysget_updatewith2i, _KeyGen, ValueGen, State) ->

0 commit comments

Comments
 (0)