aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/logger_disk_log_h.erl44
-rw-r--r--lib/kernel/src/logger_h_common.erl66
-rw-r--r--lib/kernel/src/logger_h_common.hrl30
-rw-r--r--lib/kernel/src/logger_std_h.erl44
-rw-r--r--lib/kernel/test/logger_disk_log_h_SUITE.erl180
-rw-r--r--lib/kernel/test/logger_std_h_SUITE.erl210
6 files changed, 289 insertions, 285 deletions
diff --git a/lib/kernel/src/logger_disk_log_h.erl b/lib/kernel/src/logger_disk_log_h.erl
index c3d2204630..e4b583c269 100644
--- a/lib/kernel/src/logger_disk_log_h.erl
+++ b/lib/kernel/src/logger_disk_log_h.erl
@@ -131,10 +131,10 @@ adding_handler(#{id:=Name}=Config) ->
Error
end;
false ->
- #{toggle_sync_qlen := TSQL,
- drop_new_reqs_qlen := DNRQL,
- flush_reqs_qlen := FRQL} = HState,
- {error,{invalid_levels,{TSQL,DNRQL,FRQL}}}
+ #{sync_mode_qlen := SMQL,
+ drop_mode_qlen := DMQL,
+ flush_qlen := FQL} = HState,
+ {error,{invalid_levels,{SMQL,DMQL,FQL}}}
end;
Error ->
Error
@@ -347,9 +347,9 @@ handle_call(disk_log_sync, _From, State = #{id := Name}) ->
handle_call({change_config,_OldConfig,NewConfig}, _From,
State = #{filesync_repeat_interval := FSyncInt0}) ->
HConfig = maps:get(config, NewConfig, #{}),
- State1 = #{toggle_sync_qlen := TSQL,
- drop_new_reqs_qlen := DNRQL,
- flush_reqs_qlen := FRQL} = maps:merge(State, HConfig),
+ State1 = #{sync_mode_qlen := SMQL,
+ drop_mode_qlen := DMQL,
+ flush_qlen := FQL} = maps:merge(State, HConfig),
case logger_h_common:overload_levels_ok(State1) of
true ->
_ =
@@ -370,7 +370,7 @@ handle_call({change_config,_OldConfig,NewConfig}, _From,
end,
{reply, ok, State1};
false ->
- {reply, {error,{invalid_levels,{TSQL,DNRQL,FRQL}}}, State}
+ {reply, {error,{invalid_levels,{SMQL,DMQL,FQL}}}, State}
end;
handle_call(info, _From, State) ->
@@ -464,19 +464,19 @@ code_change(_OldVsn, State, _Extra) ->
%%%-----------------------------------------------------------------
%%%
get_init_state() ->
- #{toggle_sync_qlen => ?TOGGLE_SYNC_QLEN,
- drop_new_reqs_qlen => ?DROP_NEW_REQS_QLEN,
- flush_reqs_qlen => ?FLUSH_REQS_QLEN,
- enable_burst_limit => ?ENABLE_BURST_LIMIT,
- burst_limit_size => ?BURST_LIMIT_SIZE,
- burst_window_time => ?BURST_WINDOW_TIME,
- enable_kill_overloaded => ?ENABLE_KILL_OVERLOADED,
- handler_overloaded_qlen => ?HANDLER_OVERLOADED_QLEN,
- handler_overloaded_mem => ?HANDLER_OVERLOADED_MEM,
- handler_restart_after => ?HANDLER_RESTART_AFTER,
- dl_sync_int => ?CONTROLLER_SYNC_INTERVAL,
- filesync_ok_qlen => ?FILESYNC_OK_QLEN,
- filesync_repeat_interval => ?FILESYNC_REPEAT_INTERVAL}.
+ #{sync_mode_qlen => ?SYNC_MODE_QLEN,
+ drop_mode_qlen => ?DROP_MODE_QLEN,
+ flush_qlen => ?FLUSH_QLEN,
+ burst_limit_enable => ?BURST_LIMIT_ENABLE,
+ burst_limit_max_count => ?BURST_LIMIT_MAX_COUNT,
+ burst_limit_window_time => ?BURST_LIMIT_WINDOW_TIME,
+ overload_kill_enable => ?OVERLOAD_KILL_ENABLE,
+ overload_kill_qlen => ?OVERLOAD_KILL_QLEN,
+ overload_kill_mem_size => ?OVERLOAD_KILL_MEM_SIZE,
+ overload_kill_restart_after => ?OVERLOAD_KILL_RESTART_AFTER,
+ dl_sync_int => ?CONTROLLER_SYNC_INTERVAL,
+ filesync_ok_qlen => ?FILESYNC_OK_QLEN,
+ filesync_repeat_interval => ?FILESYNC_REPEAT_INTERVAL}.
%%%-----------------------------------------------------------------
%%% Add a disk_log handler to the logger.
@@ -499,7 +499,7 @@ get_init_state() ->
%%% Handler specific config should be provided with a sub map associated
%%% with a key named 'config', e.g:
%%%
-%%% Config = #{config => #{toggle_sync_qlen => 50}
+%%% Config = #{config => #{sync_mode_qlen => 50}
%%%
%%% The disk_log handler process is linked to logger_sup, which is
%%% part of the kernel application's supervision tree.
diff --git a/lib/kernel/src/logger_h_common.erl b/lib/kernel/src/logger_h_common.erl
index d2fcc7e115..b145043522 100644
--- a/lib/kernel/src/logger_h_common.erl
+++ b/lib/kernel/src/logger_h_common.erl
@@ -91,29 +91,33 @@ check_common_config({mode_tab,_Tid}) ->
valid;
check_common_config({handler_pid,Pid}) when is_pid(Pid) ->
valid;
-check_common_config({toggle_sync_qlen,N}) when is_integer(N) ->
+
+check_common_config({sync_mode_qlen,N}) when is_integer(N) ->
valid;
-check_common_config({drop_new_reqs_qlen,N}) when is_integer(N) ->
+check_common_config({drop_mode_qlen,N}) when is_integer(N) ->
valid;
-check_common_config({flush_reqs_qlen,N}) when is_integer(N) ->
+check_common_config({flush_qlen,N}) when is_integer(N) ->
valid;
-check_common_config({enable_burst_limit,Bool}) when Bool == true;
+
+check_common_config({burst_limit_enable,Bool}) when Bool == true;
Bool == false ->
valid;
-check_common_config({burst_limit_size,N}) when is_integer(N) ->
+check_common_config({burst_limit_max_count,N}) when is_integer(N) ->
valid;
-check_common_config({burst_window_time,N}) when is_integer(N) ->
+check_common_config({burst_limit_window_time,N}) when is_integer(N) ->
valid;
-check_common_config({enable_kill_overloaded,Bool}) when Bool == true;
- Bool == false ->
+
+check_common_config({overload_kill_enable,Bool}) when Bool == true;
+ Bool == false ->
valid;
-check_common_config({handler_overloaded_qlen,N}) when is_integer(N) ->
+check_common_config({overload_kill_qlen,N}) when is_integer(N) ->
valid;
-check_common_config({handler_overloaded_mem,N}) when is_integer(N) ->
+check_common_config({overload_kill_mem_size,N}) when is_integer(N) ->
valid;
-check_common_config({handler_restart_after,NorA}) when is_integer(NorA);
- NorA == never ->
+check_common_config({overload_kill_restart_after,NorA}) when is_integer(NorA);
+ NorA == never ->
valid;
+
check_common_config({filesync_repeat_interval,NorA}) when is_integer(NorA);
NorA == no_repeat ->
valid;
@@ -173,9 +177,9 @@ unset_restart_flag(Name, Module) ->
end.
check_load(State = #{id:=_Name, mode_tab := ModeTab, mode := Mode,
- toggle_sync_qlen := ToggleSyncQLen,
- drop_new_reqs_qlen := DropNewQLen,
- flush_reqs_qlen := FlushQLen}) ->
+ sync_mode_qlen := SyncModeQLen,
+ drop_mode_qlen := DropModeQLen,
+ flush_qlen := FlushQLen}) ->
{_,Mem} = process_info(self(), memory),
?observe(_Name,{max_mem,Mem}),
{_,QLen} = process_info(self(), message_queue_len),
@@ -191,13 +195,13 @@ check_load(State = #{id:=_Name, mode_tab := ModeTab, mode := Mode,
if
QLen >= FlushQLen ->
{flush, 0,1};
- QLen >= DropNewQLen ->
+ QLen >= DropModeQLen ->
%% Note that drop mode will force log events to
%% be dropped on the client side (never sent get to
%% the handler).
IncDrops = if Mode == drop -> 0; true -> 1 end,
{?change_mode(ModeTab, Mode, drop), IncDrops,0};
- QLen >= ToggleSyncQLen ->
+ QLen >= SyncModeQLen ->
{?change_mode(ModeTab, Mode, sync), 0,0};
true ->
{?change_mode(ModeTab, Mode, async), 0,0}
@@ -207,17 +211,17 @@ check_load(State = #{id:=_Name, mode_tab := ModeTab, mode := Mode,
?update_other(flushes,FLUSHES,_NewFlushes,
State1#{last_qlen => QLen})}.
-limit_burst(#{enable_burst_limit := false}) ->
+limit_burst(#{burst_limit_enable := false}) ->
{true,0,0};
limit_burst(#{burst_win_ts := BurstWinT0,
burst_msg_count := BurstMsgCount,
- burst_window_time := BurstWinTime,
- burst_limit_size := BurstLimitSz}) ->
- if (BurstMsgCount >= BurstLimitSz) ->
+ burst_limit_window_time := BurstLimitWinTime,
+ burst_limit_max_count := BurstLimitMaxCnt}) ->
+ if (BurstMsgCount >= BurstLimitMaxCnt) ->
%% the limit for allowed messages has been reached
BurstWinT1 = ?timestamp(),
case ?diff_time(BurstWinT1,BurstWinT0) of
- BurstCheckTime when BurstCheckTime < (BurstWinTime*1000) ->
+ BurstCheckTime when BurstCheckTime < (BurstLimitWinTime*1000) ->
%% we're still within the burst time frame
{false,BurstWinT0,BurstMsgCount};
_BurstCheckTime ->
@@ -230,11 +234,11 @@ limit_burst(#{burst_win_ts := BurstWinT0,
end.
kill_if_choked(Name, QLen, Mem, HandlerMod,
- State = #{enable_kill_overloaded := KillIfOL,
- handler_overloaded_qlen := HOLQLen,
- handler_overloaded_mem := HOLMem}) ->
+ State = #{overload_kill_enable := KillIfOL,
+ overload_kill_qlen := OLKillQLen,
+ overload_kill_mem_size := OLKillMem}) ->
if KillIfOL andalso
- ((QLen > HOLQLen) orelse (Mem > HOLMem)) ->
+ ((QLen > OLKillQLen) orelse (Mem > OLKillMem)) ->
HandlerMod:log_handler_info(Name,
"Handler ~p overloaded and stopping",
[Name], State),
@@ -274,7 +278,7 @@ cancel_timer(TRef) -> timer:cancel(TRef).
stop_or_restart(Name, {shutdown,Reason={overloaded,_Name,_QLen,_Mem}},
- #{handler_restart_after := RestartAfter}) ->
+ #{overload_kill_restart_after := RestartAfter}) ->
%% If we're terminating because of an overload situation (see
%% logger_h_common:kill_if_choked/4), we need to remove the handler
%% and set a restart timer. A separate process must perform this
@@ -322,10 +326,10 @@ stop_or_restart(_Name, _Reason, _State) ->
ok.
overload_levels_ok(HandlerConfig) ->
- TSQL = maps:get(toggle_sync_qlen, HandlerConfig, ?TOGGLE_SYNC_QLEN),
- DNRQL = maps:get(drop_new_reqs_qlen, HandlerConfig, ?DROP_NEW_REQS_QLEN),
- FRQL = maps:get(flush_reqs_qlen, HandlerConfig, ?FLUSH_REQS_QLEN),
- (DNRQL > 1) andalso (TSQL =< DNRQL) andalso (DNRQL =< FRQL).
+ SMQL = maps:get(sync_mode_qlen, HandlerConfig, ?SYNC_MODE_QLEN),
+ DMQL = maps:get(drop_mode_qlen, HandlerConfig, ?DROP_MODE_QLEN),
+ FQL = maps:get(flush_qlen, HandlerConfig, ?FLUSH_QLEN),
+ (DMQL > 1) andalso (SMQL =< DMQL) andalso (DMQL =< FQL).
error_notify(Term) ->
?internal_log(error, Term).
diff --git a/lib/kernel/src/logger_h_common.hrl b/lib/kernel/src/logger_h_common.hrl
index e4d3431468..ad80b51109 100644
--- a/lib/kernel/src/logger_h_common.hrl
+++ b/lib/kernel/src/logger_h_common.hrl
@@ -4,47 +4,47 @@
%%! *** NOTE ***
%%! It's important that:
-%%! TOGGLE_SYNC_QLEN < DROP_NEW_REQS_QLEN < FLUSH_REQS_QLEN
-%%! and that DROP_NEW_REQS_QLEN >= 2.
+%%! SYNC_MODE_QLEN =< DROP_MODE_QLEN =< FLUSH_QLEN
+%%! and that DROP_MODE_QLEN >= 2.
%%! Otherwise the handler could end up in drop mode with no new
%%! log requests to process. This would cause all future requests
%%! to be dropped (no switch to async mode would ever take place).
%% This specifies the message_queue_len value where the log
%% requests switch from asynchronous casts to synchronous calls.
--define(TOGGLE_SYNC_QLEN, 10).
+-define(SYNC_MODE_QLEN, 10).
%% Above this message_queue_len, log requests will be dropped,
%% i.e. no log requests get sent to the handler process.
--define(DROP_NEW_REQS_QLEN, 200).
+-define(DROP_MODE_QLEN, 200).
%% Above this message_queue_len, the handler process will flush
%% its mailbox and only leave this number of messages in it.
--define(FLUSH_REQS_QLEN, 1000).
+-define(FLUSH_QLEN, 1000).
%% Never flush more than this number of messages in one go,
%% or the handler will be unresponsive for seconds (keep this
%% number as large as possible or the mailbox could grow large).
-define(FLUSH_MAX_N, 5000).
-%% BURST_LIMIT is the max number of log requests allowed to be
-%% written within a BURST_WINDOW_TIME time frame.
--define(ENABLE_BURST_LIMIT, true).
--define(BURST_LIMIT_SIZE, 500).
--define(BURST_WINDOW_TIME, 1000).
+%% BURST_LIMIT_MAX_COUNT is the max number of log requests allowed
+%% to be written within a BURST_LIMIT_WINDOW_TIME time frame.
+-define(BURST_LIMIT_ENABLE, true).
+-define(BURST_LIMIT_MAX_COUNT, 500).
+-define(BURST_LIMIT_WINDOW_TIME, 1000).
%% This enables/disables the feature to automatically get the
%% handler terminated if it gets too loaded (and can't keep up).
--define(ENABLE_KILL_OVERLOADED, false).
+-define(OVERLOAD_KILL_ENABLE, false).
%% If the message_queue_len goes above this size even after
%% flushing has been performed, the handler is terminated.
--define(HANDLER_OVERLOADED_QLEN, 20000).
+-define(OVERLOAD_KILL_QLEN, 20000).
%% If the memory usage exceeds this level
--define(HANDLER_OVERLOADED_MEM, 3000000).
+-define(OVERLOAD_KILL_MEM_SIZE, 3000000).
%% This is the default time that the handler will wait before
%% restarting and accepting new requests. The value 'never'
%% disables restarts.
--define(HANDLER_RESTART_AFTER, 5000).
-%%-define(HANDLER_RESTART_AFTER, never).
+-define(OVERLOAD_KILL_RESTART_AFTER, 5000).
+%%-define(OVERLOAD_KILL_RESTART_AFTER, never).
%% The handler sends asynchronous write requests to the process
%% controlling the i/o device, but every once in this interval
diff --git a/lib/kernel/src/logger_std_h.erl b/lib/kernel/src/logger_std_h.erl
index 77b054a9b7..e087178211 100644
--- a/lib/kernel/src/logger_std_h.erl
+++ b/lib/kernel/src/logger_std_h.erl
@@ -132,10 +132,10 @@ adding_handler(#{id:=Name}=Config) ->
Error
end;
false ->
- #{toggle_sync_qlen := TSQL,
- drop_new_reqs_qlen := DNRQL,
- flush_reqs_qlen := FRQL} = HState,
- {error,{invalid_levels,{TSQL,DNRQL,FRQL}}}
+ #{sync_mode_qlen := SMQL,
+ drop_mode_qlen := DMQL,
+ flush_qlen := FQL} = HState,
+ {error,{invalid_levels,{SMQL,DMQL,FQL}}}
end;
Error ->
Error
@@ -360,10 +360,10 @@ handle_call({change_config,_OldConfig,NewConfig}, _From,
end,
{reply, ok, State1};
false ->
- #{toggle_sync_qlen := TSQL,
- drop_new_reqs_qlen := DNRQL,
- flush_reqs_qlen := FRQL} = State1,
- {reply, {error,{invalid_levels,{TSQL,DNRQL,FRQL}}}, State}
+ #{sync_mode_qlen := SMQL,
+ drop_mode_qlen := DMQL,
+ flush_qlen := FQL} = State1,
+ {reply, {error,{invalid_levels,{SMQL,DMQL,FQL}}}, State}
end;
handle_call(info, _From, State) ->
@@ -459,19 +459,19 @@ code_change(_OldVsn, State, _Extra) ->
%%%-----------------------------------------------------------------
%%%
get_init_state() ->
- #{toggle_sync_qlen => ?TOGGLE_SYNC_QLEN,
- drop_new_reqs_qlen => ?DROP_NEW_REQS_QLEN,
- flush_reqs_qlen => ?FLUSH_REQS_QLEN,
- enable_burst_limit => ?ENABLE_BURST_LIMIT,
- burst_limit_size => ?BURST_LIMIT_SIZE,
- burst_window_time => ?BURST_WINDOW_TIME,
- enable_kill_overloaded => ?ENABLE_KILL_OVERLOADED,
- handler_overloaded_qlen => ?HANDLER_OVERLOADED_QLEN,
- handler_overloaded_mem => ?HANDLER_OVERLOADED_MEM,
- handler_restart_after => ?HANDLER_RESTART_AFTER,
- file_ctrl_sync_int => ?CONTROLLER_SYNC_INTERVAL,
- filesync_ok_qlen => ?FILESYNC_OK_QLEN,
- filesync_repeat_interval => ?FILESYNC_REPEAT_INTERVAL}.
+ #{sync_mode_qlen => ?SYNC_MODE_QLEN,
+ drop_mode_qlen => ?DROP_MODE_QLEN,
+ flush_qlen => ?FLUSH_QLEN,
+ burst_limit_enable => ?BURST_LIMIT_ENABLE,
+ burst_limit_max_count => ?BURST_LIMIT_MAX_COUNT,
+ burst_limit_window_time => ?BURST_LIMIT_WINDOW_TIME,
+ overload_kill_enable => ?OVERLOAD_KILL_ENABLE,
+ overload_kill_qlen => ?OVERLOAD_KILL_QLEN,
+ overload_kill_mem_size => ?OVERLOAD_KILL_MEM_SIZE,
+ overload_kill_restart_after => ?OVERLOAD_KILL_RESTART_AFTER,
+ file_ctrl_sync_int => ?CONTROLLER_SYNC_INTERVAL,
+ filesync_ok_qlen => ?FILESYNC_OK_QLEN,
+ filesync_repeat_interval => ?FILESYNC_REPEAT_INTERVAL}.
%%%-----------------------------------------------------------------
%%% Add a standard handler to the logger.
@@ -482,7 +482,7 @@ get_init_state() ->
%%% Handler specific config should be provided with a sub map associated
%%% with a key named 'config', e.g:
%%%
-%%% Config = #{config => #{toggle_sync_qlen => 50}
+%%% Config = #{config => #{sync_mode_qlen => 50}
%%%
%%% The standard handler process is linked to logger_sup, which is
%%% part of the kernel application's supervision tree.
diff --git a/lib/kernel/test/logger_disk_log_h_SUITE.erl b/lib/kernel/test/logger_disk_log_h_SUITE.erl
index 3f3b483b7d..c3b8237f82 100644
--- a/lib/kernel/test/logger_disk_log_h_SUITE.erl
+++ b/lib/kernel/test/logger_disk_log_h_SUITE.erl
@@ -372,15 +372,15 @@ config_fail(_Config) ->
{error,{handler_not_added,{invalid_levels,{_,1,_}}}} =
logger:add_handler(?MODULE,logger_disk_log_h,
- #{config => #{drop_new_reqs_qlen=>1}}),
+ #{config => #{drop_mode_qlen=>1}}),
{error,{handler_not_added,{invalid_levels,{43,42,_}}}} =
logger:add_handler(?MODULE,logger_disk_log_h,
- #{config => #{toggle_sync_qlen=>43,
- drop_new_reqs_qlen=>42}}),
+ #{config => #{sync_mode_qlen=>43,
+ drop_mode_qlen=>42}}),
{error,{handler_not_added,{invalid_levels,{_,43,42}}}} =
logger:add_handler(?MODULE,logger_disk_log_h,
- #{config => #{drop_new_reqs_qlen=>43,
- flush_reqs_qlen=>42}}),
+ #{config => #{drop_mode_qlen=>43,
+ flush_qlen=>42}}),
ok = logger:add_handler(?MODULE,logger_disk_log_h,
#{filter_default=>log,
@@ -395,8 +395,8 @@ config_fail(_Config) ->
%% incorrect values of OP params
{error,{invalid_levels,_}} =
logger:set_handler_config(?MODULE,config,
- #{toggle_sync_qlen=>100,
- flush_reqs_qlen=>99}),
+ #{sync_mode_qlen=>100,
+ flush_qlen=>99}),
%% invalid name of config parameter
{error,{invalid_config,logger_disk_log_h,{filesync_rep_int,2000}}} =
logger:set_handler_config(?MODULE, config,
@@ -428,16 +428,16 @@ reconfig(Config) ->
filters=>?DEFAULT_HANDLER_FILTERS([?MODULE]),
formatter=>{?MODULE,self()}}),
#{id := ?MODULE,
- toggle_sync_qlen := ?TOGGLE_SYNC_QLEN,
- drop_new_reqs_qlen := ?DROP_NEW_REQS_QLEN,
- flush_reqs_qlen := ?FLUSH_REQS_QLEN,
- enable_burst_limit := ?ENABLE_BURST_LIMIT,
- burst_limit_size := ?BURST_LIMIT_SIZE,
- burst_window_time := ?BURST_WINDOW_TIME,
- enable_kill_overloaded := ?ENABLE_KILL_OVERLOADED,
- handler_overloaded_qlen := ?HANDLER_OVERLOADED_QLEN,
- handler_overloaded_mem := ?HANDLER_OVERLOADED_MEM,
- handler_restart_after := ?HANDLER_RESTART_AFTER,
+ sync_mode_qlen := ?SYNC_MODE_QLEN,
+ drop_mode_qlen := ?DROP_MODE_QLEN,
+ flush_qlen := ?FLUSH_QLEN,
+ burst_limit_enable := ?BURST_LIMIT_ENABLE,
+ burst_limit_max_count := ?BURST_LIMIT_MAX_COUNT,
+ burst_limit_window_time := ?BURST_LIMIT_WINDOW_TIME,
+ overload_kill_enable := ?OVERLOAD_KILL_ENABLE,
+ overload_kill_qlen := ?OVERLOAD_KILL_QLEN,
+ overload_kill_mem_size := ?OVERLOAD_KILL_MEM_SIZE,
+ overload_kill_restart_after := ?OVERLOAD_KILL_RESTART_AFTER,
filesync_repeat_interval := ?FILESYNC_REPEAT_INTERVAL,
log_opts := #{type := ?DISK_LOG_TYPE,
max_no_files := ?DISK_LOG_MAX_NO_FILES,
@@ -446,28 +446,28 @@ reconfig(Config) ->
logger_disk_log_h:info(?MODULE),
ok = logger:set_handler_config(?MODULE, config,
- #{toggle_sync_qlen => 1,
- drop_new_reqs_qlen => 2,
- flush_reqs_qlen => 3,
- enable_burst_limit => false,
- burst_limit_size => 10,
- burst_window_time => 10,
- enable_kill_overloaded => true,
- handler_overloaded_qlen => 100000,
- handler_overloaded_mem => 10000000,
- handler_restart_after => never,
+ #{sync_mode_qlen => 1,
+ drop_mode_qlen => 2,
+ flush_qlen => 3,
+ burst_limit_enable => false,
+ burst_limit_max_count => 10,
+ burst_limit_window_time => 10,
+ overload_kill_enable => true,
+ overload_kill_qlen => 100000,
+ overload_kill_mem_size => 10000000,
+ overload_kill_restart_after => never,
filesync_repeat_interval => no_repeat}),
#{id := ?MODULE,
- toggle_sync_qlen := 1,
- drop_new_reqs_qlen := 2,
- flush_reqs_qlen := 3,
- enable_burst_limit := false,
- burst_limit_size := 10,
- burst_window_time := 10,
- enable_kill_overloaded := true,
- handler_overloaded_qlen := 100000,
- handler_overloaded_mem := 10000000,
- handler_restart_after := never,
+ sync_mode_qlen := 1,
+ drop_mode_qlen := 2,
+ flush_qlen := 3,
+ burst_limit_enable := false,
+ burst_limit_max_count := 10,
+ burst_limit_window_time := 10,
+ overload_kill_enable := true,
+ overload_kill_qlen := 100000,
+ overload_kill_mem_size := 10000000,
+ overload_kill_restart_after := never,
filesync_repeat_interval := no_repeat} =
logger_disk_log_h:info(?MODULE),
@@ -849,10 +849,10 @@ op_switch_to_sync(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NumOfReqs = 500,
NewHConfig =
- HConfig#{config => DLHConfig#{toggle_sync_qlen => 2,
- drop_new_reqs_qlen => NumOfReqs+1,
- flush_reqs_qlen => 2*NumOfReqs,
- enable_burst_limit => false}},
+ HConfig#{config => DLHConfig#{sync_mode_qlen => 2,
+ drop_mode_qlen => NumOfReqs+1,
+ flush_qlen => 2*NumOfReqs,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
Lines = count_lines(Log),
@@ -874,10 +874,10 @@ op_switch_to_drop(Config) ->
Bursts = 10,
NewHConfig =
HConfig#{config =>
- DLHConfig#{toggle_sync_qlen => 1,
- drop_new_reqs_qlen => 2,
- flush_reqs_qlen => Procs*NumOfReqs*Bursts,
- enable_burst_limit => false}},
+ DLHConfig#{sync_mode_qlen => 1,
+ drop_mode_qlen => 2,
+ flush_qlen => Procs*NumOfReqs*Bursts,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
%% It sometimes happens that the handler either gets
%% the requests in a slow enough pace so that dropping
@@ -919,11 +919,11 @@ op_switch_to_flush(Config) ->
NewHConfig =
HConfig#{config =>
- DLHConfig#{toggle_sync_qlen => 2,
+ DLHConfig#{sync_mode_qlen => 2,
%% disable drop mode
- drop_new_reqs_qlen => 300,
- flush_reqs_qlen => 300,
- enable_burst_limit => false}},
+ drop_mode_qlen => 300,
+ flush_qlen => 300,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 1500,
Procs = 10,
@@ -961,11 +961,11 @@ op_switch_to_flush(cleanup, _Config) ->
limit_burst_disabled(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{config => DLHConfig#{enable_burst_limit => false,
- burst_limit_size => 10,
- burst_window_time => 2000,
- drop_new_reqs_qlen => 200,
- flush_reqs_qlen => 300}},
+ HConfig#{config => DLHConfig#{burst_limit_enable => false,
+ burst_limit_max_count => 10,
+ burst_limit_window_time => 2000,
+ drop_mode_qlen => 200,
+ flush_qlen => 300}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
@@ -980,11 +980,11 @@ limit_burst_enabled_one(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
ReqLimit = 10,
NewHConfig =
- HConfig#{config => DLHConfig#{enable_burst_limit => true,
- burst_limit_size => ReqLimit,
- burst_window_time => 2000,
- drop_new_reqs_qlen => 200,
- flush_reqs_qlen => 300}},
+ HConfig#{config => DLHConfig#{burst_limit_enable => true,
+ burst_limit_max_count => ReqLimit,
+ burst_limit_window_time => 2000,
+ drop_mode_qlen => 200,
+ flush_qlen => 300}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
@@ -1000,11 +1000,11 @@ limit_burst_enabled_period(Config) ->
ReqLimit = 10,
BurstTWin = 1000,
NewHConfig =
- HConfig#{config => DLHConfig#{enable_burst_limit => true,
- burst_limit_size => ReqLimit,
- burst_window_time => BurstTWin,
- drop_new_reqs_qlen => 20000,
- flush_reqs_qlen => 20001}},
+ HConfig#{config => DLHConfig#{burst_limit_enable => true,
+ burst_limit_max_count => ReqLimit,
+ burst_limit_window_time => BurstTWin,
+ drop_mode_qlen => 20000,
+ flush_qlen => 20001}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
Windows = 3,
@@ -1021,9 +1021,9 @@ limit_burst_enabled_period(cleanup, _Config) ->
kill_disabled(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{config=>DLHConfig#{enable_kill_overloaded=>false,
- handler_overloaded_qlen=>10,
- handler_overloaded_mem=>100}},
+ HConfig#{config=>DLHConfig#{overload_kill_enable=>false,
+ overload_kill_qlen=>10,
+ overload_kill_mem_size=>100}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
@@ -1039,13 +1039,13 @@ qlen_kill_new(Config) ->
{_Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
Pid0 = whereis(h_proc_name()),
{_,Mem0} = process_info(Pid0, memory),
- RestartAfter = ?HANDLER_RESTART_AFTER,
+ RestartAfter = ?OVERLOAD_KILL_RESTART_AFTER,
NewHConfig =
HConfig#{config =>
- DLHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_overloaded_mem=>Mem0+50000,
- handler_restart_after=>RestartAfter}},
+ DLHConfig#{overload_kill_enable=>true,
+ overload_kill_qlen=>10,
+ overload_kill_mem_size=>Mem0+50000,
+ overload_kill_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
MRef = erlang:monitor(process, Pid0),
NumOfReqs = 100,
@@ -1076,13 +1076,13 @@ mem_kill_new(Config) ->
{_Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
Pid0 = whereis(h_proc_name()),
{_,Mem0} = process_info(Pid0, memory),
- RestartAfter = ?HANDLER_RESTART_AFTER,
+ RestartAfter = ?OVERLOAD_KILL_RESTART_AFTER,
NewHConfig =
HConfig#{config =>
- DLHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>50000,
- handler_overloaded_mem=>Mem0+500,
- handler_restart_after=>RestartAfter}},
+ DLHConfig#{overload_kill_enable=>true,
+ overload_kill_qlen=>50000,
+ overload_kill_mem_size=>Mem0+500,
+ overload_kill_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
MRef = erlang:monitor(process, Pid0),
NumOfReqs = 100,
@@ -1112,16 +1112,16 @@ mem_kill_new(cleanup, _Config) ->
restart_after(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig1 =
- HConfig#{config=>DLHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_restart_after=>never}},
+ HConfig#{config=>DLHConfig#{overload_kill_enable=>true,
+ overload_kill_qlen=>10,
+ overload_kill_restart_after=>never}},
ok = logger:set_handler_config(?MODULE, NewHConfig1),
MRef1 = erlang:monitor(process, whereis(h_proc_name())),
%% kill handler
send_burst({n,100}, {spawn,2,0}, {chars,79}, notice),
receive
{'DOWN', MRef1, _, _, _Info1} ->
- timer:sleep(?HANDLER_RESTART_AFTER + 1000),
+ timer:sleep(?OVERLOAD_KILL_RESTART_AFTER + 1000),
undefined = whereis(h_proc_name()),
ok
after
@@ -1130,11 +1130,11 @@ restart_after(Config) ->
end,
{Log,_,_} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
- RestartAfter = ?HANDLER_RESTART_AFTER,
+ RestartAfter = ?OVERLOAD_KILL_RESTART_AFTER,
NewHConfig2 =
- HConfig#{config=>DLHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_restart_after=>RestartAfter}},
+ HConfig#{config=>DLHConfig#{overload_kill_enable=>true,
+ overload_kill_qlen=>10,
+ overload_kill_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig2),
Pid0 = whereis(h_proc_name()),
MRef2 = erlang:monitor(process, Pid0),
@@ -1163,10 +1163,10 @@ handler_requests_under_load() ->
handler_requests_under_load(Config) ->
{Log,HConfig,DLHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{config => DLHConfig#{toggle_sync_qlen => 2,
- drop_new_reqs_qlen => 1000,
- flush_reqs_qlen => 2000,
- enable_burst_limit => false}},
+ HConfig#{config => DLHConfig#{sync_mode_qlen => 2,
+ drop_mode_qlen => 1000,
+ flush_qlen => 2000,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
Pid = spawn_link(fun() -> send_requests(?MODULE, 1, [{sync,[]},
{info,[]},
@@ -1201,7 +1201,7 @@ send_requests(HName, TO, Reqs = [{Req,Res}|Rs]) ->
case Req of
change_config ->
logger:set_handler_config(HName, logger_disk_log_h,
- #{enable_kill_overloaded =>
+ #{overload_kill_enable =>
false});
Func ->
logger_disk_log_h:Func(HName)
diff --git a/lib/kernel/test/logger_std_h_SUITE.erl b/lib/kernel/test/logger_std_h_SUITE.erl
index e71b75fe66..2efe2ce6f6 100644
--- a/lib/kernel/test/logger_std_h_SUITE.erl
+++ b/lib/kernel/test/logger_std_h_SUITE.erl
@@ -291,15 +291,15 @@ config_fail(_Config) ->
formatter=>{?MODULE,self()}}),
{error,{handler_not_added,{invalid_levels,{_,1,_}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{config => #{drop_new_reqs_qlen=>1}}),
+ #{config => #{drop_mode_qlen=>1}}),
{error,{handler_not_added,{invalid_levels,{43,42,_}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{config => #{toggle_sync_qlen=>43,
- drop_new_reqs_qlen=>42}}),
+ #{config => #{sync_mode_qlen=>43,
+ drop_mode_qlen=>42}}),
{error,{handler_not_added,{invalid_levels,{_,43,42}}}} =
logger:add_handler(?MODULE,logger_std_h,
- #{config => #{drop_new_reqs_qlen=>43,
- flush_reqs_qlen=>42}}),
+ #{config => #{drop_mode_qlen=>43,
+ flush_qlen=>42}}),
ok = logger:add_handler(?MODULE,logger_std_h,
#{filter_default=>log,
@@ -311,8 +311,8 @@ config_fail(_Config) ->
logger:set_handler_config(?MODULE,id,bad),
{error,{invalid_levels,_}} =
logger:set_handler_config(?MODULE,config,
- #{toggle_sync_qlen=>100,
- flush_reqs_qlen=>99}),
+ #{sync_mode_qlen=>100,
+ flush_qlen=>99}),
{error,{invalid_config,logger_std_h,{filesync_rep_int,2000}}} =
logger:set_handler_config(?MODULE, config,
#{filesync_rep_int => 2000}),
@@ -432,44 +432,44 @@ reconfig(Config) ->
#{id := ?MODULE,
type := standard_io,
file_ctrl_pid := FileCtrlPid,
- toggle_sync_qlen := ?TOGGLE_SYNC_QLEN,
- drop_new_reqs_qlen := ?DROP_NEW_REQS_QLEN,
- flush_reqs_qlen := ?FLUSH_REQS_QLEN,
- enable_burst_limit := ?ENABLE_BURST_LIMIT,
- burst_limit_size := ?BURST_LIMIT_SIZE,
- burst_window_time := ?BURST_WINDOW_TIME,
- enable_kill_overloaded := ?ENABLE_KILL_OVERLOADED,
- handler_overloaded_qlen := ?HANDLER_OVERLOADED_QLEN,
- handler_overloaded_mem := ?HANDLER_OVERLOADED_MEM,
- handler_restart_after := ?HANDLER_RESTART_AFTER,
+ sync_mode_qlen := ?SYNC_MODE_QLEN,
+ drop_mode_qlen := ?DROP_MODE_QLEN,
+ flush_qlen := ?FLUSH_QLEN,
+ burst_limit_enable := ?BURST_LIMIT_ENABLE,
+ burst_limit_max_count := ?BURST_LIMIT_MAX_COUNT,
+ burst_limit_window_time := ?BURST_LIMIT_WINDOW_TIME,
+ overload_kill_enable := ?OVERLOAD_KILL_ENABLE,
+ overload_kill_qlen := ?OVERLOAD_KILL_QLEN,
+ overload_kill_mem_size := ?OVERLOAD_KILL_MEM_SIZE,
+ overload_kill_restart_after := ?OVERLOAD_KILL_RESTART_AFTER,
filesync_repeat_interval := ?FILESYNC_REPEAT_INTERVAL} =
logger_std_h:info(?MODULE),
ok = logger:set_handler_config(?MODULE, config,
- #{toggle_sync_qlen => 1,
- drop_new_reqs_qlen => 2,
- flush_reqs_qlen => 3,
- enable_burst_limit => false,
- burst_limit_size => 10,
- burst_window_time => 10,
- enable_kill_overloaded => true,
- handler_overloaded_qlen => 100000,
- handler_overloaded_mem => 10000000,
- handler_restart_after => never,
+ #{sync_mode_qlen => 1,
+ drop_mode_qlen => 2,
+ flush_qlen => 3,
+ burst_limit_enable => false,
+ burst_limit_max_count => 10,
+ burst_limit_window_time => 10,
+ overload_kill_enable => true,
+ overload_kill_qlen => 100000,
+ overload_kill_mem_size => 10000000,
+ overload_kill_restart_after => never,
filesync_repeat_interval => no_repeat}),
#{id := ?MODULE,
type := standard_io,
file_ctrl_pid := FileCtrlPid,
- toggle_sync_qlen := 1,
- drop_new_reqs_qlen := 2,
- flush_reqs_qlen := 3,
- enable_burst_limit := false,
- burst_limit_size := 10,
- burst_window_time := 10,
- enable_kill_overloaded := true,
- handler_overloaded_qlen := 100000,
- handler_overloaded_mem := 10000000,
- handler_restart_after := never,
+ sync_mode_qlen := 1,
+ drop_mode_qlen := 2,
+ flush_qlen := 3,
+ burst_limit_enable := false,
+ burst_limit_max_count := 10,
+ burst_limit_window_time := 10,
+ overload_kill_enable := true,
+ overload_kill_qlen := 100000,
+ overload_kill_mem_size := 10000000,
+ overload_kill_restart_after := never,
filesync_repeat_interval := no_repeat} = logger_std_h:info(?MODULE),
ok.
@@ -699,10 +699,10 @@ op_switch_to_sync_file(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NumOfReqs = 500,
NewHConfig =
- HConfig#{config => StdHConfig#{toggle_sync_qlen => 2,
- drop_new_reqs_qlen => NumOfReqs+1,
- flush_reqs_qlen => 2*NumOfReqs,
- enable_burst_limit => false}},
+ HConfig#{config => StdHConfig#{sync_mode_qlen => 2,
+ drop_mode_qlen => NumOfReqs+1,
+ flush_qlen => 2*NumOfReqs,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
%% TRecvPid = start_op_trace(),
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
@@ -728,10 +728,10 @@ op_switch_to_sync_tty(Config) ->
{HConfig,StdHConfig} = start_handler(?MODULE, standard_io, Config),
NumOfReqs = 500,
NewHConfig =
- HConfig#{config => StdHConfig#{toggle_sync_qlen => 3,
- drop_new_reqs_qlen => NumOfReqs+1,
- flush_reqs_qlen => 2*NumOfReqs,
- enable_burst_limit => false}},
+ HConfig#{config => StdHConfig#{sync_mode_qlen => 3,
+ drop_mode_qlen => NumOfReqs+1,
+ flush_qlen => 2*NumOfReqs,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
ok.
@@ -750,11 +750,11 @@ op_switch_to_drop_file(Config) ->
Bursts = 10,
NewHConfig =
HConfig#{config =>
- StdHConfig#{toggle_sync_qlen => 1,
- drop_new_reqs_qlen => 2,
- flush_reqs_qlen =>
+ StdHConfig#{sync_mode_qlen => 1,
+ drop_mode_qlen => 2,
+ flush_qlen =>
Procs*NumOfReqs*Bursts,
- enable_burst_limit => false}},
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
%% It sometimes happens that the handler gets the
%% requests in a slow enough pace so that dropping
@@ -787,11 +787,11 @@ op_switch_to_drop_tty(Config) ->
NumOfReqs = 300,
Procs = 2,
NewHConfig =
- HConfig#{config => StdHConfig#{toggle_sync_qlen => 1,
- drop_new_reqs_qlen => 2,
- flush_reqs_qlen =>
+ HConfig#{config => StdHConfig#{sync_mode_qlen => 1,
+ drop_mode_qlen => 2,
+ flush_qlen =>
Procs*NumOfReqs+1,
- enable_burst_limit => false}},
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
send_burst({n,NumOfReqs}, {spawn,Procs,0}, {chars,79}, notice),
ok.
@@ -812,11 +812,11 @@ op_switch_to_flush_file(Config) ->
NewHConfig =
HConfig#{config =>
- StdHConfig#{toggle_sync_qlen => 2,
+ StdHConfig#{sync_mode_qlen => 2,
%% disable drop mode
- drop_new_reqs_qlen => 300,
- flush_reqs_qlen => 300,
- enable_burst_limit => false}},
+ drop_mode_qlen => 300,
+ flush_qlen => 300,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 1500,
Procs = 10,
@@ -859,11 +859,11 @@ op_switch_to_flush_tty(Config) ->
%% when the flush happens (verify with coverage of flush_log_requests/2)
NewHConfig =
- HConfig#{config => StdHConfig#{toggle_sync_qlen => 2,
+ HConfig#{config => StdHConfig#{sync_mode_qlen => 2,
%% disable drop mode
- drop_new_reqs_qlen => 100,
- flush_reqs_qlen => 100,
- enable_burst_limit => false}},
+ drop_mode_qlen => 100,
+ flush_qlen => 100,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 1000,
Procs = 100,
@@ -875,11 +875,11 @@ op_switch_to_flush_tty(cleanup, _Config) ->
limit_burst_disabled(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{config => StdHConfig#{enable_burst_limit => false,
- burst_limit_size => 10,
- burst_window_time => 2000,
- drop_new_reqs_qlen => 200,
- flush_reqs_qlen => 300}},
+ HConfig#{config => StdHConfig#{burst_limit_enable => false,
+ burst_limit_max_count => 10,
+ burst_limit_window_time => 2000,
+ drop_mode_qlen => 200,
+ flush_qlen => 300}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
@@ -894,11 +894,11 @@ limit_burst_enabled_one(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
ReqLimit = 10,
NewHConfig =
- HConfig#{config => StdHConfig#{enable_burst_limit => true,
- burst_limit_size => ReqLimit,
- burst_window_time => 2000,
- drop_new_reqs_qlen => 200,
- flush_reqs_qlen => 300}},
+ HConfig#{config => StdHConfig#{burst_limit_enable => true,
+ burst_limit_max_count => ReqLimit,
+ burst_limit_window_time => 2000,
+ drop_mode_qlen => 200,
+ flush_qlen => 300}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
@@ -914,11 +914,11 @@ limit_burst_enabled_period(Config) ->
ReqLimit = 10,
BurstTWin = 1000,
NewHConfig =
- HConfig#{config => StdHConfig#{enable_burst_limit => true,
- burst_limit_size => ReqLimit,
- burst_window_time => BurstTWin,
- drop_new_reqs_qlen => 20000,
- flush_reqs_qlen => 20001}},
+ HConfig#{config => StdHConfig#{burst_limit_enable => true,
+ burst_limit_max_count => ReqLimit,
+ burst_limit_window_time => BurstTWin,
+ drop_mode_qlen => 20000,
+ flush_qlen => 20001}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
Windows = 3,
@@ -935,9 +935,9 @@ limit_burst_enabled_period(cleanup, _Config) ->
kill_disabled(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{config=>StdHConfig#{enable_kill_overloaded=>false,
- handler_overloaded_qlen=>10,
- handler_overloaded_mem=>100}},
+ HConfig#{config=>StdHConfig#{overload_kill_enable=>false,
+ overload_kill_qlen=>10,
+ overload_kill_mem_size=>100}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
NumOfReqs = 100,
send_burst({n,NumOfReqs}, seq, {chars,79}, notice),
@@ -953,12 +953,12 @@ qlen_kill_new(Config) ->
{_Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
Pid0 = whereis(h_proc_name()),
{_,Mem0} = process_info(Pid0, memory),
- RestartAfter = ?HANDLER_RESTART_AFTER,
+ RestartAfter = ?OVERLOAD_KILL_RESTART_AFTER,
NewHConfig =
- HConfig#{config=>StdHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_overloaded_mem=>Mem0+50000,
- handler_restart_after=>RestartAfter}},
+ HConfig#{config=>StdHConfig#{overload_kill_enable=>true,
+ overload_kill_qlen=>10,
+ overload_kill_mem_size=>Mem0+50000,
+ overload_kill_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
MRef = erlang:monitor(process, Pid0),
NumOfReqs = 100,
@@ -995,21 +995,21 @@ qlen_kill_std(_Config) ->
%% Node = start_std_h_on_new_node(Config, ?FUNCTION_NAME, Log),
%% ok = rpc:call(Node, logger, set_handler_config,
%% [?STANDARD_HANDLER, config,
- %% #{enable_kill_overloaded=>true,
- %% handler_overloaded_qlen=>10,
- %% handler_overloaded_mem=>100000}]),
+ %% #{overload_kill_enable=>true,
+ %% overload_kill_qlen=>10,
+ %% overload_kill_mem_size=>100000}]),
{skip,"Not done yet"}.
mem_kill_new(Config) ->
{_Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
Pid0 = whereis(h_proc_name()),
{_,Mem0} = process_info(Pid0, memory),
- RestartAfter = ?HANDLER_RESTART_AFTER,
+ RestartAfter = ?OVERLOAD_KILL_RESTART_AFTER,
NewHConfig =
- HConfig#{config=>StdHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>50000,
- handler_overloaded_mem=>Mem0+500,
- handler_restart_after=>RestartAfter}},
+ HConfig#{config=>StdHConfig#{overload_kill_enable=>true,
+ overload_kill_qlen=>50000,
+ overload_kill_mem_size=>Mem0+500,
+ overload_kill_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
MRef = erlang:monitor(process, Pid0),
NumOfReqs = 100,
@@ -1044,16 +1044,16 @@ mem_kill_std(_Config) ->
restart_after(Config) ->
{Log,HConfig,StdHConfig} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig1 =
- HConfig#{config=>StdHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_restart_after=>never}},
+ HConfig#{config=>StdHConfig#{overload_kill_enable=>true,
+ overload_kill_qlen=>10,
+ overload_kill_restart_after=>never}},
ok = logger:set_handler_config(?MODULE, NewHConfig1),
MRef1 = erlang:monitor(process, whereis(h_proc_name())),
%% kill handler
send_burst({n,100}, {spawn,2,0}, {chars,79}, notice),
receive
{'DOWN', MRef1, _, _, _Info1} ->
- timer:sleep(?HANDLER_RESTART_AFTER + 1000),
+ timer:sleep(?OVERLOAD_KILL_RESTART_AFTER + 1000),
undefined = whereis(h_proc_name()),
ok
after
@@ -1062,11 +1062,11 @@ restart_after(Config) ->
end,
{Log,_,_} = start_handler(?MODULE, ?FUNCTION_NAME, Config),
- RestartAfter = ?HANDLER_RESTART_AFTER,
+ RestartAfter = ?OVERLOAD_KILL_RESTART_AFTER,
NewHConfig2 =
- HConfig#{config=>StdHConfig#{enable_kill_overloaded=>true,
- handler_overloaded_qlen=>10,
- handler_restart_after=>RestartAfter}},
+ HConfig#{config=>StdHConfig#{overload_kill_enable=>true,
+ overload_kill_qlen=>10,
+ overload_kill_restart_after=>RestartAfter}},
ok = logger:set_handler_config(?MODULE, NewHConfig2),
Pid0 = whereis(h_proc_name()),
MRef2 = erlang:monitor(process, Pid0),
@@ -1096,10 +1096,10 @@ handler_requests_under_load(Config) ->
{Log,HConfig,StdHConfig} =
start_handler(?MODULE, ?FUNCTION_NAME, Config),
NewHConfig =
- HConfig#{config => StdHConfig#{toggle_sync_qlen => 2,
- drop_new_reqs_qlen => 1000,
- flush_reqs_qlen => 2000,
- enable_burst_limit => false}},
+ HConfig#{config => StdHConfig#{sync_mode_qlen => 2,
+ drop_mode_qlen => 1000,
+ flush_qlen => 2000,
+ burst_limit_enable => false}},
ok = logger:set_handler_config(?MODULE, NewHConfig),
Pid = spawn_link(fun() -> send_requests(?MODULE, 1, [{sync,[]},
{info,[]},
@@ -1133,7 +1133,7 @@ send_requests(HName, TO, Reqs = [{Req,Res}|Rs]) ->
case Req of
change_config ->
logger:set_handler_config(HName, config,
- #{enable_kill_overloaded =>
+ #{overload_kill_enable =>
false});
Func ->
logger_std_h:Func(HName)