Pārlūkot izejas kodu

fix(config): enable force_shutdown_policy by default

terry-xiaoyu 5 gadi atpakaļ
vecāks
revīzija
7b98f62f7a
3 mainītis faili ar 25 papildinājumiem un 6 dzēšanām
  1. 10 2
      etc/emqx.conf
  2. 2 2
      priv/emqx.schema
  3. 13 2
      src/emqx.appup.src

+ 10 - 2
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.
 ##

+ 2 - 2
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

+ 13 - 2
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, []}
     ]}
   ]
-}.
+}.