[ejabberd] Performances issues with ejabberd+LDAP+PostgreSQL

pitchum pitchum at gramaton.org
Mon May 13 16:31:15 MSK 2019


Le 13/05/2019 à 13:12, Holger Weiß a écrit :
> * pitchum <pitchum at gramaton.org> [2019-05-13 13:06]:
>> I forgot to mention that all CPU load was on process beam.smp *only*.
> 
> Then it might be interesting to look at the output of, first:
> 
>     etop -sort reductions

See attached files. I don't know how to interpret these.


By the way, I have tested different cache configurations and currently
it looks like this:

  mod_roster:
    versioning: true
    use_cache: true
    cache_size: 255000
    cache_life_time: 600 # 10 minutes
  mod_shared_roster:
    db_type: mnesia
  mod_shared_roster_ldap:
    use_cache: true
    cache_size: 255000
    cache_life_time: 600 # 10 minutes

beam.smp finally eat 4GB + some swap. So now I'm pretty sure cache has
an impact on memory usage but on the other hand I still can see the
exact same LDAP query repeated multiple times.

It turns out that the ldap_rfilter is applied at multiple occasions:
- when a user connects
- when the user changes its status
- when one of the contacts changes its status

I can't understand why so many LDAP queries are needed.
I thought that shared_roster was only a matter of populating the roster
items, not updating their statuses.


By the way, ma ldap_rfilter is not as simple as the one provided in
documentation. It looks like this:

(&(objectClass=corpGroup)(corpImRoomEnable=TRUE)(memberUid=%u))

I tried removing the "(memberuid=%u)" part but then every user is in
everyone's roster, which is unwanted. What we want is to have in rosters
only contacts that share a common LDAP group. Maybe there is a better
way to achieve this and that would perform better...

-- 
pitchum

-------------- next part --------------
========================================================================================
 etop at lambada                                                              12:44:42
 Load:  cpu         0               Memory:  total       15950    binary        113
        procs      36                        processes    4171    code         4081
        runq        0                        atom          198    ets           246

Pid            Name or Initial Func    Time    Reds  Memory    MsgQ Current Function
----------------------------------------------------------------------------------------
<0.55.0>       user                     '-'    6052   26520       0 group:server_loop/3 
<0.63.0>       etop_txt:init/1          '-'    2175   34368       0 etop:update/1       
<0.54.0>       user_drv                 '-'     560   10712       0 user_drv:server_loop
<0.0.0>        init                     '-'       0   10664       0 init:boot_loop/2    
<0.1.0>        erts_code_purger         '-'       0    2608       0 erts_code_purger:loo
<0.3.0>        etop_server              '-'       0   88480       0 etop:data_handler/2 
<0.4.0>        erl_prim_loader          '-'       0   24520       0 erl_prim_loader:loop
<0.30.0>       error_logger             '-'       0    8800       0 gen_event:fetch_msg/
<0.31.0>       application_controll     '-'       0  196936       0 gen_server:loop/6   
<0.33.0>       application_master:i     '-'       0    5784       0 application_master:m
========================================================================================
-------------- next part --------------
========================================================================================
 etop at lambada                                                              12:45:39
 Load:  cpu         0               Memory:  total       15973    binary        114
        procs      36                        processes    4228    code         4081
        runq        0                        atom          198    ets           246

Pid            Name or Initial Func    Time    Reds  Memory    MsgQ Current Function
----------------------------------------------------------------------------------------
<0.55.0>       user                     '-'    5746   34424       0 group:server_loop/3 
<0.63.0>       etop_txt:init/1          '-'    2175   34368       0 etop:update/1       
<0.54.0>       user_drv                 '-'     560   10712       0 user_drv:server_loop
<0.0.0>        init                     '-'       0   10664       0 init:boot_loop/2    
<0.1.0>        erts_code_purger         '-'       0    2608       0 erts_code_purger:loo
<0.3.0>        etop_server              '-'       0   88480       0 etop:data_handler/2 
<0.4.0>        erl_prim_loader          '-'       0   24520       0 erl_prim_loader:loop
<0.30.0>       error_logger             '-'       0    8800       0 gen_event:fetch_msg/
<0.31.0>       application_controll     '-'       0  196936       0 gen_server:loop/6   
<0.33.0>       application_master:i     '-'       0    5784       0 application_master:m
========================================================================================


More information about the ejabberd mailing list