Revert to a macro-only, non-recursive on eagain method for managing requests.
This commit is contained in:
parent
27dba903ef
commit
56c2ac27c2
2 changed files with 25 additions and 27 deletions
|
@ -21,28 +21,22 @@
|
||||||
%%
|
%%
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
|
|
||||||
-spec async_nif_enqueue(reference(), function(), [term()]) -> term() | {error, term()}.
|
-define(ASYNC_NIF_CALL(Fun, Args),
|
||||||
async_nif_enqueue(R, F, A) ->
|
begin
|
||||||
R = erlang:make_ref(),
|
NIFRef = erlang:make_ref(),
|
||||||
case erlang:apply(F, [R|A]) of
|
case erlang:apply(Fun, [NIFRef|Args]) of
|
||||||
{ok, enqueued} ->
|
{ok, enqueued} ->
|
||||||
receive
|
receive
|
||||||
{R, {error, shutdown}=Error} ->
|
{NIFRef, {error, shutdown}=Error} ->
|
||||||
%% Work unit was queued, but not executed.
|
%% Work unit was queued, but not executed.
|
||||||
Error;
|
Error;
|
||||||
{R, {error, _Reason}=Error} ->
|
{NIFRef, {error, _Reason}=Error} ->
|
||||||
%% Work unit returned an error.
|
%% Work unit returned an error.
|
||||||
Error;
|
Error;
|
||||||
{R, Reply} ->
|
{NIFRef, Reply} ->
|
||||||
Reply
|
Reply
|
||||||
end;
|
end;
|
||||||
{error, eagain} ->
|
Other ->
|
||||||
%% Work unit was not queued, try again.
|
Other
|
||||||
async_nif_enqueue(R, F, A);
|
end
|
||||||
%{error, enomem} ->
|
end).
|
||||||
%{error, shutdown} ->
|
|
||||||
Other ->
|
|
||||||
Other
|
|
||||||
end.
|
|
||||||
|
|
||||||
-define(ASYNC_NIF_CALL(Fun, Args), async_nif_enqueue(Fun, Args)).
|
|
||||||
|
|
|
@ -26,6 +26,12 @@
|
||||||
{mode, max}.
|
{mode, max}.
|
||||||
{duration, 10}.
|
{duration, 10}.
|
||||||
{concurrent, 4}.
|
{concurrent, 4}.
|
||||||
|
{report_interval, 1}.
|
||||||
|
{pb_timeout_general, 1000}. % ms
|
||||||
|
%{pb_timeout_read, ?}.
|
||||||
|
%{pb_timeout_write, ?}.
|
||||||
|
%{pb_timeout_listkeys, ?}.
|
||||||
|
%{pb_timeout_mapreduce, ?}.
|
||||||
{driver, basho_bench_driver_wterl}.
|
{driver, basho_bench_driver_wterl}.
|
||||||
{key_generator, {int_to_bin_littleendian,{uniform_int, 5000000}}}.
|
{key_generator, {int_to_bin_littleendian,{uniform_int, 5000000}}}.
|
||||||
{value_generator, {fixed_bin, 10000}}.
|
{value_generator, {fixed_bin, 10000}}.
|
||||||
|
@ -71,8 +77,6 @@
|
||||||
{connection, [
|
{connection, [
|
||||||
{create, true},
|
{create, true},
|
||||||
{sync, false},
|
{sync, false},
|
||||||
{logging, true},
|
|
||||||
{transactional, true},
|
|
||||||
{session_max, 1024},
|
{session_max, 1024},
|
||||||
{cache_size, 4294967296},
|
{cache_size, 4294967296},
|
||||||
{verbose, []},
|
{verbose, []},
|
||||||
|
|
Loading…
Reference in a new issue