Hi again,

What do you think about this?

Regards
damencho

On Wednesday, November 16, 2022 at 10:43:14 PM UTC+2 Damian Minkov wrote:

> While testing big conferences and observing and profiling prosody we 
> noticed(thanks to Boris Grozev) that some presences are created and not 
> sent to participants which drastically increased CPU usage for 2000 
> participants in a room. This is a case with a large room with mostly 
> occupants with a role 'visitor'.
>
> A possible fix in muc/muc.lib.lua:
> 342c342
> < if filter == nil or filter(occupant_jid, occupant) then
> ---
> > if (filter == nil or filter(occupant_jid, occupant)) and (to_bare == 
> occupant.bare_jid or broadcast_roles[occupant.role or "none"]) then
> 349,351c349
> < if to_bare == occupant.bare_jid or broadcast_roles[occupant.role or 
> "none"] then
> < self:route_stanza(pres);
> < end
> ---
> > self:route_stanza(pres);
>
> We tested this change which reduced the CPU by more than 60% in that test 
> case. 
>
> The following change was not tested but seems reasonable as unnecessary 
> clones of stanzas are created.
>
> 307d306
> < local pr = get_p(n_occupant);
> 309c308
> < self:route_to_occupant(n_occupant, pr);
> ---
> > self:route_to_occupant(n_occupant, get_p(n_occupant));
> 310a310
> > local pr = get_p(n_occupant);
>
> Thank you
> damencho
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prosody-dev/69ad8893-5030-4c7d-b2d3-03187ac25845n%40googlegroups.com.

Reply via email to