emqx/apps/emqx_machine
Ilya Averyanov dd3471bc22 Merge branch 'master' into file-transfer
* master: (194 commits)
  fix(limiter): update change && fix deprecated version
  chore: update changes
  perf(limiter): simplify the memory represent of limiter configuration
  ci(perf test): update tf variable name and set job timeout
  ci: fix artifact name in scheduled packages workflow
  fix: build_packages_cron.yaml workflow
  ci: move scheduled builds to a separate workflow
  build: check mnesia compatibility when generating mria config
  docs: fix a typo in api doc description
  feat(./dev): use command style and added 'ctl' command
  test: fix delayed-pubish test case flakyness
  refactor: remove raw_with_default config load option
  chore: add changelog for trace timestrap
  feat: increase the time precision of trace logs to microseconds
  chore: make sure topic_metrics/rewrite's default is []
  docs: Update changes/ce/perf-10417.en.md
  chore: bump `snabbkaffe` to 1.0.8
  ci: run static checks in separate jobs
  chore(schema): mark deprecated quic listener fields ?IMPORTANCE_HIDDEN
  chore: remove unused mqtt cap 'subscription_identifiers'
  ...
2023-05-05 16:50:18 +03:00
..
src Merge branch 'master' into file-transfer 2023-05-05 16:50:18 +03:00
test test: add a test case for emqx_machine:node_status 2023-04-26 20:48:53 +02:00
README.md chore: fix typos 2023-04-18 13:48:55 +08:00
rebar.config refactor: move emqx_json to emqx_utils_json 2023-04-14 13:31:27 +02:00

EMQX machine

This application manages other OTP applications in EMQX and serves as the entry point when BEAM VM starts up. It prepares the node before starting mnesia/mria, as well as EMQX business logic. It keeps track of the business applications storing data in Mnesia, which need to be restarted when the node joins the cluster by registering ekka callbacks. Also it kicks off autoclustering (EMQX cluster discovery) on the core nodes.

emqx_machine application doesn't do much on its own, but it facilitates the environment for running other EMQX applications.

Features

Global GC

emqx_global_gc is a gen_server that forces garbage collection of all Erlang processes running in the BEAM VM. This is meant to save the RAM.

Restricted shell

emqx_restricted_shell module prevents user from accidentally issuing Erlang shell commands that can stop the remote node.

Signal handler

emqx_machine_signal_handler handles POSIX signals sent to BEAM VM process. It helps to shut down EMQX broker gracefully when it receives SIGTERM signal.

Cover

emqx_cover is a helper module that helps to collect coverage reports during testing.

Limitation

Currently emqx_machine boots the business apps before starting autocluster, so a fresh node joining the cluster actually starts business application twice: first in the singleton mode, and then in clustered mode.

Documentation links

Configuration: node.global_gc_interval

Configurations

The following application environment variables are used:

  • emqx_machine.global_gc_interval: interval at which global GC is run
  • emqx_machine.custom_shard_transports: contains a map that allows to fine tune transport (rpc or gen_rpc) used to send Mria transactions from the core node to the replicant
  • emqx_machine.backtrace_depth: set maximum depth of Erlang stacktraces in crash reports

Contributing

Please see our contributing.md.