perf: add TLS config hibernate_after, reduce memory footprint
This commit is contained in:
parent
43aab61a3a
commit
572e50e0a2
|
@ -1495,6 +1495,17 @@ In case PSK cipher suites are intended, make sure to configure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common_ssl_opts_schema_hibernate_after {
|
||||||
|
desc {
|
||||||
|
en: """ Hibernate the SSL process after idling for amount of time reducing its memory footprint. """
|
||||||
|
zh: """ 在闲置一定时间后休眠 SSL 进程,减少其内存占用。"""
|
||||||
|
}
|
||||||
|
label: {
|
||||||
|
en: "hibernate after"
|
||||||
|
zh: "闲置多久后休眠"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ciphers_schema_common {
|
ciphers_schema_common {
|
||||||
desc {
|
desc {
|
||||||
en: """This config holds TLS cipher suite names separated by comma,
|
en: """This config holds TLS cipher suite names separated by comma,
|
||||||
|
|
|
@ -1929,6 +1929,16 @@ common_ssl_opts_schema(Defaults) ->
|
||||||
default => Df("secure_renegotiate", true),
|
default => Df("secure_renegotiate", true),
|
||||||
desc => ?DESC(common_ssl_opts_schema_secure_renegotiate)
|
desc => ?DESC(common_ssl_opts_schema_secure_renegotiate)
|
||||||
}
|
}
|
||||||
|
)},
|
||||||
|
|
||||||
|
{"hibernate_after",
|
||||||
|
sc(
|
||||||
|
duration(),
|
||||||
|
#{
|
||||||
|
default => undefined,
|
||||||
|
required => false,
|
||||||
|
desc => ?DESC(common_ssl_opts_schema_hibernate_after)
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
].
|
].
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,41 @@ t_restart_listeners(_) ->
|
||||||
ok = emqx_listeners:restart(),
|
ok = emqx_listeners:restart(),
|
||||||
ok = emqx_listeners:stop().
|
ok = emqx_listeners:stop().
|
||||||
|
|
||||||
|
t_restart_listeners_with_hibernate_after_disabled(Config) ->
|
||||||
|
OldLConf = emqx_config:get([listeners]),
|
||||||
|
maps:foreach(
|
||||||
|
fun(LType, Listeners) ->
|
||||||
|
maps:foreach(
|
||||||
|
fun(Name, Opts) ->
|
||||||
|
case maps:is_key(ssl_options, Opts) of
|
||||||
|
true ->
|
||||||
|
emqx_config:put(
|
||||||
|
[
|
||||||
|
listeners,
|
||||||
|
LType,
|
||||||
|
Name,
|
||||||
|
ssl_options,
|
||||||
|
hibernate_after
|
||||||
|
],
|
||||||
|
5000
|
||||||
|
);
|
||||||
|
_ ->
|
||||||
|
skip
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
Listeners
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
OldLConf
|
||||||
|
),
|
||||||
|
ok = emqx_listeners:start(),
|
||||||
|
ok = emqx_listeners:stop(),
|
||||||
|
%% flakyness: eaddrinuse
|
||||||
|
timer:sleep(timer:seconds(2)),
|
||||||
|
ok = emqx_listeners:restart(),
|
||||||
|
ok = emqx_listeners:stop(),
|
||||||
|
emqx_config:put([listeners], OldLConf).
|
||||||
|
|
||||||
t_max_conns_tcp(_) ->
|
t_max_conns_tcp(_) ->
|
||||||
%% Note: Using a string representation for the bind address like
|
%% Note: Using a string representation for the bind address like
|
||||||
%% "127.0.0.1" does not work
|
%% "127.0.0.1" does not work
|
||||||
|
|
Loading…
Reference in New Issue