Hi again,

What about this one, can this optimization be included in the next 0.12 
release? 
We have been running it for a while on meet.jit.si
https://github.com/jitsi/infra-configuration/blob/061508f9a8736169d73e76b824e101de40d03da1/ansible/roles/prosody/files/muc_lib_visitor_broadcast.patch

Thank you
damencho

On Friday, December 30, 2022 at 2:24:36 AM UTC-6 Damian Minkov wrote:

> 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 prosody-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prosody-dev/52bd7570-5c52-48af-847c-61d5220cd645n%40googlegroups.com.

Reply via email to