Merge pull request #7303 from qzhuyan/dev/william/add-olp

feat: add load control app
This commit is contained in:
William Yang 2022-03-16 15:36:53 +01:00 committed by GitHub
commit e8bbfc3806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View File

@ -27,6 +27,7 @@ File format:
* Add UTF-8 string validity check in `strict_mode` for MQTT packet. * Add UTF-8 string validity check in `strict_mode` for MQTT packet.
When set to true, invalid UTF-8 strings will cause the client to be disconnected. i.e. client ID, topic name. [#7261] When set to true, invalid UTF-8 strings will cause the client to be disconnected. i.e. client ID, topic name. [#7261]
* Changed systemd service restart delay from 10 seconds to 60 seconds. * Changed systemd service restart delay from 10 seconds to 60 seconds.
* Add load control app for future development.
### Bug fixes ### Bug fixes

View File

@ -56,6 +56,7 @@
, {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1 , {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1
, {getopt, "1.0.1"} , {getopt, "1.0.1"}
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.15.0"}}} , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.15.0"}}}
, {lc, {git, "https://github.com/emqx/lc.git", {tag, "0.2.0"}}}
]}. ]}.
{xref_ignores, {xref_ignores,

View File

@ -9,7 +9,15 @@
{vsn, "4.3.14"}, % strict semver, bump manually! {vsn, "4.3.14"}, % strict semver, bump manually!
{modules, []}, {modules, []},
{registered, []}, {registered, []},
{applications, [kernel,stdlib,gproc,gen_rpc,esockd,cowboy,sasl,os_mon]}, {applications, [ kernel
, stdlib
, gproc
, gen_rpc
, esockd
, cowboy
, sasl
, lc
, os_mon]},
{mod, {emqx_app,[]}}, {mod, {emqx_app,[]}},
{env, []}, {env, []},
{licenses, ["Apache-2.0"]}, {licenses, ["Apache-2.0"]},

View File

@ -48,6 +48,7 @@
]). ]).
-include("emqx.hrl"). -include("emqx.hrl").
-include_lib("lc/include/lc.hrl").
-define(OS_MON, ?MODULE). -define(OS_MON, ?MODULE).
@ -88,7 +89,15 @@ get_sysmem_high_watermark() ->
memsup:get_sysmem_high_watermark(). memsup:get_sysmem_high_watermark().
set_sysmem_high_watermark(Float) -> set_sysmem_high_watermark(Float) ->
memsup:set_sysmem_high_watermark(Float / 100). V = Float/100,
case load_ctl:get_config() of
#{ ?MEM_MON_F0 := true } = OldLC ->
ok = load_ctl:put_config(OldLC#{ ?MEM_MON_F0 => true
, ?MEM_MON_F1 => V});
_ ->
skip
end,
memsup:set_sysmem_high_watermark(V).
get_procmem_high_watermark() -> get_procmem_high_watermark() ->
memsup:get_procmem_high_watermark(). memsup:get_procmem_high_watermark().