perf: un-deprecate mongodb topology pool_size and set it to 10 by default

Benchmarks proved that it effects performance:
10 ecpool workers / 10 topology pool workers outperform
100 ecpool / 1 topology worker.

Fixes: EMQX-11825
This commit is contained in:
Serge Tupchii 2024-02-08 20:05:24 +02:00
parent c9ee5addb4
commit 1d9ce709f4
2 changed files with 6 additions and 19 deletions

View File

@ -131,8 +131,8 @@ fields(topology) ->
hoconsc:mk(
pos_integer(),
#{
deprecated => {since, "5.1.1"},
importance => ?IMPORTANCE_HIDDEN
importance => ?IMPORTANCE_HIDDEN,
default => 10
}
)},
{max_overflow, fun max_overflow/1},
@ -201,23 +201,7 @@ on_start(
false ->
[{ssl, false}]
end,
Topology0 = maps:get(topology, NConfig, #{}),
%% we fix this at 1 because we already have ecpool
case maps:get(pool_size, Topology0, 1) =:= 1 of
true ->
ok;
false ->
?SLOG(
info,
#{
msg => "mongodb_overriding_topology_pool_size",
connector => InstId,
reason => "this option is deprecated; please set `pool_size' for the connector",
value => 1
}
)
end,
Topology = Topology0#{pool_size => 1},
Topology = maps:get(topology, NConfig, #{}),
Opts = [
{mongo_type, init_type(NConfig)},
{hosts, Hosts},

View File

@ -0,0 +1,3 @@
Improve MongoDB connector performance.
- [mongodb-erlang PR](https://github.com/emqx/mongodb-erlang/pull/41)