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 e248cd6c66
commit c3b7d76102
2 changed files with 6 additions and 19 deletions

View File

@ -131,8 +131,8 @@ fields(topology) ->
hoconsc:mk( hoconsc:mk(
pos_integer(), pos_integer(),
#{ #{
deprecated => {since, "5.1.1"}, importance => ?IMPORTANCE_HIDDEN,
importance => ?IMPORTANCE_HIDDEN default => 10
} }
)}, )},
{max_overflow, fun max_overflow/1}, {max_overflow, fun max_overflow/1},
@ -201,23 +201,7 @@ on_start(
false -> false ->
[{ssl, false}] [{ssl, false}]
end, end,
Topology0 = maps:get(topology, NConfig, #{}), Topology = 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},
Opts = [ Opts = [
{mongo_type, init_type(NConfig)}, {mongo_type, init_type(NConfig)},
{hosts, Hosts}, {hosts, Hosts},

View File

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