From 7b98f62f7acbb000c899ebc64010e784894fc8c1 Mon Sep 17 00:00:00 2001 From: terry-xiaoyu <506895667@qq.com> Date: Wed, 30 Sep 2020 11:35:56 +0800 Subject: [PATCH] fix(config): enable force_shutdown_policy by default --- etc/emqx.conf | 12 ++++++++++-- priv/emqx.schema | 4 ++-- src/emqx.appup.src | 15 +++++++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/etc/emqx.conf b/etc/emqx.conf index c0a34837e..24a3a3060 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -730,7 +730,11 @@ zone.external.force_gc_policy = 16000|16MB ## of queued MQTT messages of QoS 1 and 2. ## ## Numbers delimited by `|'. Zero or negative is to disable. -zone.external.force_shutdown_policy = 10000|32MB +## +## Default: +## - 10000|64MB on ARCH_64 system +## - 1000|32MB on ARCH_32 sytem +#zone.external.force_shutdown_policy = 10000|64MB ## Maximum MQTT packet size allowed. ## @@ -982,7 +986,11 @@ zone.internal.mqueue_store_qos0 = true zone.internal.enable_flapping_detect = off ## See zone.$name.force_shutdown_policy -zone.internal.force_shutdown_policy = 128000|64MB +## +## Default: +## - 10000|64MB on ARCH_64 system +## - 1000|32MB on ARCH_32 sytem +#zone.internal.force_shutdown_policy = 10000|64MB ## All the topics will be prefixed with the mountpoint path if this option is enabled. ## diff --git a/priv/emqx.schema b/priv/emqx.schema index 7d543dde0..fd5badb68 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -1087,9 +1087,9 @@ end}. {DefaultLen, DefaultSize} = case WordSize = erlang:system_info(wordsize) of 8 -> % arch_64 - {10000, cuttlefish_bytesize:parse("32MB")}; + {10000, cuttlefish_bytesize:parse("64MB")}; 4 -> % arch_32 - {10000, cuttlefish_bytesize:parse("16MB")} + {1000, cuttlefish_bytesize:parse("32MB")} end, {force_shutdown_policy, #{message_queue_len => DefaultLen, max_heap_size => DefaultSize div WordSize diff --git a/src/emqx.appup.src b/src/emqx.appup.src index c8a48d544..484eccc6e 100644 --- a/src/emqx.appup.src +++ b/src/emqx.appup.src @@ -1,7 +1,18 @@ +{DefaultLen, DefaultSize} = + case WordSize = erlang:system_info(wordsize) of + 8 -> % arch_64 + {10000, cuttlefish_bytesize:parse("64MB")}; + 4 -> % arch_32 + {1000, cuttlefish_bytesize:parse("32MB")} + end, {"4.2.1", [ {"4.2.0", [ - {load_module, emqx_channel, brutal_purge, soft_purge, []} + {load_module, emqx_channel, brutal_purge, soft_purge, []}, + {apply, {application, set_env, + [emqx, force_shutdown_policy, + #{message_queue_len => DefaultLen, + max_heap_size => DefaultSize div WordSize}]}} ]} ], [ @@ -9,4 +20,4 @@ {load_module, emqx_channel, brutal_purge, soft_purge, []} ]} ] -}. \ No newline at end of file +}.