Ejabberd hangs and 'beam.smp' eating memory

Hello.

Environment:
NethServer 7.9.2009 (on oVirt vm: 12 cpu threads, 12 g RAM)
About 130-150 active users.
Symptoms:
Sometime ejabberd hangs:
cpu_load
At log we found:
2023-07-12 15:17:01.606 [warning] <0.514.0> Shrinking cache ‘roster_item_cache’ (current size = 1001, max size = 1000, life time = 3600000, memory = 284888 bytes); you should increase maximum cache size if this message repeats too often
Question:
Restarting not helping. Have seen about cache_size and cache_life_time parameters. Where should we set this parameters?
There are no cahce_size at /etc/ejabberd/ejabberd.yml

Haven’t tested it but it shall work with a custom template:

mkdir -p /etc/e-smith/templates-custom/etc/ejabberd/ejabberd.yml/90Custom
vi /etc/e-smith/templates-custom/etc/ejabberd/ejabberd.yml/90Custom

Sample content of /etc/e-smith/templates-custom/etc/ejabberd/ejabberd.yml/90Custom file to increase cache_size just for roster module:

modules:
  mod_roster:
    use_cache: true
    cache_size: 3000

Apply changes:

signal-event nethserver-ejabberd-update

https://docs.ejabberd.im/admin/configuration/toplevel/#cache-size