Skip to content

Commit da7756d

Browse files
committed
Attempt at HTTP based bench GET
1 parent f02cd71 commit da7756d

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

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
18-
{alwaysget, {300000, 120000, skew_order}}.
18+
{alwaysget, {400000, 120000, skew_order}}.
1919
{unique, {7000, skew_order}}.
2020

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

src/basho_bench_driver_nhs.erl

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,38 @@ run(get_pb, KeyGen, _ValueGen, State) ->
167167
{error, Reason, State}
168168
end;
169169

170+
run(alwaysget_http, _KeyGen, _ValueGen, State) ->
171+
Host = inet_parse:ntoa(State#state.http_host),
172+
Port = State#state.http_port,
173+
Bucket = State#state.recordBucket,
174+
AGKC = State#state.alwaysget_key_count,
175+
case AGKC > State#state.alwaysget_perworker_minkeycount of
176+
true ->
177+
KeyInt = eightytwenty_keycount(AGKC),
178+
Key = generate_uniquekey(KeyInt, State#state.rand_keyid,
179+
State#state.alwaysget_keyorder),
180+
URL =
181+
io_lib:format("http://~s:~p/buckets/~s/keys/~s",
182+
[Host, Port, Bucket, Key]),
183+
184+
case get_existing(URL, State#state.http_timeout) of
185+
ok ->
186+
{ok, State};
187+
{error, Reason} ->
188+
% not_found is not OK
189+
{error, Reason, State}
190+
end;
191+
false ->
192+
{silent, State}
193+
end;
194+
170195
run(alwaysget_pb, _KeyGen, _ValueGen, State) ->
171196
% Get one of the objects with unique keys
172197
Pid = State#state.pb_pid,
173198
Bucket = State#state.recordBucket,
174199
AGKC = State#state.alwaysget_key_count,
175200
case AGKC > State#state.alwaysget_perworker_minkeycount of
176201
true ->
177-
178202
KeyInt = eightytwenty_keycount(AGKC),
179203
Key = generate_uniquekey(KeyInt, State#state.rand_keyid,
180204
State#state.alwaysget_keyorder),
@@ -505,6 +529,14 @@ json_get(Url, Timeout, UsePool) ->
505529
{error, Other}
506530
end.
507531

532+
get_existing(Url, Timeout) ->
533+
case ibrowse:send_req(lists:flatten(Url), [], get, [], [], Timeout) of
534+
{ok, "200", _, _Body} ->
535+
ok;
536+
Other ->
537+
{error, Other}
538+
end.
539+
508540

509541
to_binary(B) when is_binary(B) ->
510542
B;

0 commit comments

Comments
 (0)