Skip to content

Commit

Permalink
Increase default pool_size
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Dec 16, 2021
1 parent 95c9150 commit 19e818d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions doc/modules/mod_mam.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ If the buffer is full, messages are flushed to a database immediately and the fl

#### `modules.mod_mam_meta.async_writer.pool_size`
* **Syntax:** non-negative integer
* **Default:** `2 * erlang:system_info(schedulers_online)`
* **Example:** `modules.mod_mam_meta.async_writer.pool_size = 30`
* **Default:** `4 * erlang:system_info(schedulers_online)`
* **Example:** `modules.mod_mam_meta.async_writer.pool_size = 32`

Number of workers in the pool.
Number of workers in the pool. More than the number of available schedulers is recommended, to minimise lock contention on the message queues, and more than the number of DB workers, to fully utilise the DB capacity. How much more than these two parameters is then a good fine-tuning for specific deployments.

### Common backend options

Expand Down
2 changes: 1 addition & 1 deletion src/mam/mod_mam_rdbms_arch_async.erl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ add_callback(muc, Opts) ->
defaults() ->
#{flush_interval => 2000,
batch_size => 30,
pool_size => 2 * erlang:system_info(schedulers_online)}.
pool_size => 4 * erlang:system_info(schedulers_online)}.

prepare_insert_queries(pm, Opts) ->
MaxSize = gen_mod:get_opt(batch_size, Opts, 30),
Expand Down
2 changes: 1 addition & 1 deletion src/mongoose_async_pools.erl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ gen_pool_name(HostType, PoolId) ->
make_wpool_opts(HostType, PoolId, Opts) ->
Interval = gen_mod:get_opt(flush_interval, Opts, 1000),
MaxSize = gen_mod:get_opt(batch_size, Opts, 100),
NumWorkers = gen_mod:get_opt(pool_size, Opts, 2 * erlang:system_info(schedulers_online)),
NumWorkers = gen_mod:get_opt(pool_size, Opts, 4 * erlang:system_info(schedulers_online)),
FlushCallback = gen_mod:get_opt(flush_callback, Opts),
FlushExtra = make_extra(HostType, PoolId, Opts),
ProcessOpts = [{message_queue_data, off_heap}],
Expand Down

0 comments on commit 19e818d

Please sign in to comment.