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 prosody-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prosody-dev/2a014630-f23e-4fe6-86df-0a6bb7b59cf3n%40googlegroups.com.

Reply via email to