webhook 上下线事件、客户端http认证 均有消息投递失败的场景,如何优化

EMQX 版本

EMQX 5.7.2开源版

EMQX 安装部署方式

docker-compose 部署安装

EMQX 集群情况

未使用集群,仅单节点

服务器(运行 EMQX 的机器)硬件配置

8核16G CPU 型号: Intel

服务器操作系统和平台

Ubuntu

服务端参数优化情况

在 EMQX 中启用的功能

启用了 HTTP 认证和 WebHook

测试场景

业务环境设备量不到50台

具体问题

2025-12-12T03:50:23.658918+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-12T06:55:50.605065+00:00 [error] tag: ERROR, clientid: 1999055966057340928, msg: send_error, peername: 172.25.0.7:52870, username: 1999055966057340928, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,econnrefused}
2025-12-12T06:55:54.752562+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-12T07:19:39.937272+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-12T07:32:55.045804+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-15T07:57:19.038997+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => econnrefused,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-15T10:13:34.827022+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-16T05:33:11.166827+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-16T06:01:56.358566+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-17T02:20:48.260930+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-17T06:46:19.166823+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:48836, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:46:19.754837+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:48842, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:46:32.394842+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:46950, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:46:41.032021+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:41908, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:46:44.574890+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:41918, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:46:54.502860+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:38864, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:47:01.877814+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:39550, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:48:57.157821+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:55848, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:49:09.703794+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:56598, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:49:11.983899+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:56608, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:49:18.051844+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:48382, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}

2025-12-17T06:57:19.151823+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:52872, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:57:19.250836+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:52878, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:57:24.971820+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:52888, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:57:40.079827+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:47360, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:57:40.839850+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:47366, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:57:47.030945+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:55380, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:58:00.922808+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:37094, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:58:03.510874+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:37106, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:58:08.184832+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:48918, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T06:58:21.815832+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:43754, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}

2025-12-17T07:00:57.551789+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:45820, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:00:59.288839+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:45822, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:01:14.057827+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:56568, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:01:18.035823+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:41974, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:01:22.098005+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:41978, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:01:34.113775+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,etimedout}
2025-12-17T07:01:36.072824+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:55558, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:01:36.161623+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,etimedout}
2025-12-17T07:01:39.016835+00:00 [error] tag: ERROR, clientid: 1999325093229060096, msg: send_error, peername: 172.25.0.7:55572, username: 1999325093229060096, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:01:44.225840+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:55588, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:01:56.641692+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,etimedout}
2025-12-17T07:01:56.858815+00:00 [error] tag: ERROR, clientid: 2000500588178665472, msg: send_error, peername: 172.25.0.7:41634, username: 2000500588178665472, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:01:58.690185+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,etimedout}
2025-12-17T07:02:05.490901+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:41384, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:02:06.642652+00:00 [error] clientid: 1999325093229060096, msg: http_connector_do_request_failed, peername: 172.25.0.7:41640, username: 1999325093229060096, reason: connect_timeout, request: {“/message/mqtt/auth”,[{<<“content-type”>>,<<“application/json”>>}],<<““>>}, connector: <<“emqx_authn_http:1”>>, note: the request body is redacted due to security reasons
2025-12-17T07:02:06.642933+00:00 [error] tag: RESOURCE, clientid: 1999325093229060096, msg: unrecoverable_resource_error, peername: 172.25.0.7:41640, username: 1999325093229060096, reason: connect_timeout, resource_id: <<“emqx_authn_http:1”>>
2025-12-17T07:02:10.977600+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,etimedout}
2025-12-17T07:02:15.073585+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,etimedout}
2025-12-17T07:02:26.894815+00:00 [error] tag: ERROR, clientid: 1999401946933960704, msg: send_error, peername: 172.25.0.7:57056, username: 1999401946933960704, id: <<“emqx_authn_http:1”>>, reason: {recoverable_error,timeout}
2025-12-17T07:02:28.603624+00:00 [error] clientid: 2000500588178665472, msg: http_connector_do_request_failed, peername: 172.25.0.7:38356, username: 2000500588178665472, reason: connect_timeout, request: {”/message/mqtt/auth",[{<<“content-type”>>,<<“application/json”>>}],<<"
”>>}, connector: <<“emqx_authn_http:1”>>, note: the request body is redacted due to security reasons
2025-12-17T07:02:28.603963+00:00 [error] tag: RESOURCE, clientid: 2000500588178665472, msg: unrecoverable_resource_error, peername: 172.25.0.7:38356, username: 2000500588178665472, reason: connect_timeout, resource_id: <<“emqx_authn_http:1”>>
2025-12-17T07:02:31.457663+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,etimedout}
2025-12-17T07:02:33.505711+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,etimedout}
2025-12-17T07:02:45.602713+00:00 [warning] msg: alarm_is_activated, message: <<“resource down: #{error => <<"Resource connector:http:connect_WH_D for channel action:http:connect_WH_D:connector:http:connect_WH_D is not connected. Resource status: disconnected">>,status => disconnected}”>>, name: <<“action:http:connect_WH_D:connector:http:connect_WH_D”>>
2025-12-17T07:09:45.976460+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,econnrefused}
2025-12-17T07:13:01.303405+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,econnrefused}
2025-12-17T07:13:01.303395+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,econnrefused}
2025-12-17T07:13:01.303620+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,econnrefused}
2025-12-17T07:13:01.303535+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,econnrefused}
2025-12-17T07:18:01.799958+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,econnrefused}
2025-12-17T07:18:31.844882+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,econnrefused}
2025-12-17T07:19:01.893481+00:00 [warning] ehttpc: Received ‘gun_down’ message with reason: {error,econnrefused}
这是 emqx 容器error日志

这是 webhook的统计和配置 webhook 转发的上下线事件 到 业务http服务 webhook的高级设置 怎么设置了都有失败的场景



hhtp认证的概览和设置如下


能提供一下 优化思路吗

日志有非常明确的信号说明你的 http server 不太行。
你就优化你的 http server 就行了。
他要不就是econnrefused (拒绝访问,直接端口都连不通了)
要不就是:timeout 连接超时。

优化思路就是自己压测一下 http server