Skip to content

Commit

Permalink
perf(webhook): evaluate replies in fresh process rather than in ehttpc
Browse files Browse the repository at this point in the history
This surprisingly simple change yields a big performance improvement
in throughput.

While the previous commit achieves ~ 55 k messages / s
in throughput under some test conditions (100 k concurrent publishers
publishing 1 QoS 1 message per second), the simple change in this
commit improves it further to ~ 63 k messages / s.

Benchmarks indicated that the evaluating one reply function is
consistently quite fast (~ 20 µs), which makes this performance gain
counterintuitive.  Perhaps, although each call is cheap, `ehttpc`
calls several of these in a row when there are several sent requests,
and those costs might add up in latency.
  • Loading branch information
thalesmg committed May 17, 2023
1 parent a7b41e1 commit bc7d0d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/emqx_connector/src/emqx_connector_http.erl
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ to_bin(Atom) when is_atom(Atom) ->
atom_to_binary(Atom, utf8).

reply_delegator(Context, ReplyFunAndArgs, Result) ->
maybe_retry(Result, Context, ReplyFunAndArgs).
spawn(fun() -> maybe_retry(Result, Context, ReplyFunAndArgs) end).

transform_result(Result) ->
case Result of
Expand Down

0 comments on commit bc7d0d5

Please sign in to comment.