Improve 'emqx_alarm' performance by using Mnesia dirty operations and avoiding unnecessary calls from 'emqx_resource_manager' to reactivate alarms that have been already activated. Use new safe 'emqx_alarm' API to activate/deactivate alarms to ensure that emqx_resource_manager doesn't crash because of alarm timeouts. The crashes were possible when the following conditions co-occurred: