From 5c3f5d808568fca7c94e0a06c57606a57f09a77a Mon Sep 17 00:00:00 2001 From: zmstone Date: Tue, 4 Jun 2024 14:33:13 +0200 Subject: [PATCH] perf: do not call inet getstat before each and every send In a stress test environment, when alarm is enabled, there were a lot of long_schedule warnings with the stacktrace pointing to congestion alarm based inet:getstat function. When alarm is disabled, the one single client is able to hold 40,000 QoS 1 messages per second (inflight=32) throughput. When alarm is enabled, its mqueue overflows. This commit removes the call before each and every data send, so to rely on emit_stats timer to trigger the congestion check. --- apps/emqx/src/emqx_connection.erl | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/emqx/src/emqx_connection.erl b/apps/emqx/src/emqx_connection.erl index e0baab238..3708593e7 100644 --- a/apps/emqx/src/emqx_connection.erl +++ b/apps/emqx/src/emqx_connection.erl @@ -914,7 +914,6 @@ send(IoData, #state{transport = Transport, socket = Socket, channel = Channel}) Oct = iolist_size(IoData), ok = emqx_metrics:inc('bytes.sent', Oct), inc_counter(outgoing_bytes, Oct), - emqx_congestion:maybe_alarm_conn_congestion(Socket, Transport, Channel), case Transport:async_send(Socket, IoData, []) of ok -> ok;