wip: tune egress draining strategy
This commit is contained in:
parent
1895b250e9
commit
574746b190
|
@ -48,6 +48,7 @@
|
|||
%% Type declarations
|
||||
%%================================================================================
|
||||
|
||||
-define(ACCUM_TIMEOUT, 4).
|
||||
-define(DRAIN_TIMEOUT, 1).
|
||||
-define(COOLDOWN_TIMEOUT_MIN, 1000).
|
||||
-define(COOLDOWN_TIMEOUT_MAX, 5000).
|
||||
|
@ -112,7 +113,7 @@ handle_cast(_Cast, S) ->
|
|||
{noreply, S}.
|
||||
|
||||
handle_info(Req = {_Pid, _Ref, #message{}}, S) ->
|
||||
ok = timer:sleep(?DRAIN_TIMEOUT),
|
||||
ok = timer:sleep(?ACCUM_TIMEOUT),
|
||||
Batch = [Req | drain_requests(1, max_batch_size())],
|
||||
_ = flush(Batch, S),
|
||||
true = erlang:garbage_collect(),
|
||||
|
@ -137,7 +138,7 @@ drain_requests(N, M) ->
|
|||
receive
|
||||
Req = {_Pid, _Ref, #message{}} ->
|
||||
[Req | drain_requests(N + 1, M)]
|
||||
after 0 ->
|
||||
after ?DRAIN_TIMEOUT ->
|
||||
[N]
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue