[ejabberd] Dealing with big rosters

Gregory Makarov gmakarov at gmail.com
Tue Jan 9 07:48:32 MSK 2018


>
> There is no such extension.
> However, you may not send initial presence-broadcast (<presence/>), but
> instead send direct presences to needed contacts.
>
You are toking about Ejabberd side, right? Clients cannot send direct
presences because they don't have any information about position of
roster window on another clients.
I'm thinking about using "c2s_filter_send" hook to block unwanted
presence messages from sending to clients. It could be inefficient
though.
Let's say we have a table:
-record(roster_windows, {usr :: {binary(), binary(), binary()},
visible_jids :: [{binary(), binary()}]}).
where
  "usr" - full jid of XMPP client and
  "visible_jids" - list of jids (contacts) visible at the moment on that client.

We insert new records to that table (or update existing) when we
receive some IQ SET command from the clients.
Each time when "c2s_filter_send" hook is called, we scan
"roster_windows" table and check jid "from" in the "visible_jids"
list. If it's not there (it means that part of the roster where "from"
is located is not visible by the user), we just drop this presence
message.


On Mon, Jan 8, 2018 at 3:03 AM, Evgeny Khramtsov <xramtsov at gmail.com> wrote:
> Mon, 8 Jan 2018 02:18:18 -0800
> Gregory Makarov <gmakarov at gmail.com> wrote:
>
>> Let's assume we have a big organization with 5000 people working on
>> it. Each employee has our proprietary XMPP client (it's more than XMPP
>> client in fact, but it doesn't matter here) installed on his computer
>> (and probably mobile client installed on his smartphone). That client
>> has a roster with all the company contacts in it. So, we have a roster
>> with 5000 elements in it. When someone changes their presence,
>> Ejabberd sends presence stanza to all the available clients. As far as
>> I understand, there is no standard way for the client to block that
>> presence stanza on XMPP server if that particular client is not
>> interested in it (for example, that contact is not displayed in the
>> roster window at that moment). I was very surprised that there is no
>> XMPP extension like "roster window". How it could be implemented:
>> after establishing a session, a client may send special IQ SET stanza
>> to inform the server that it needs presence information only for
>> particular JIDs. When different or additional contacts become visible
>> in the client's roster (user scrolled the contact list or app window
>> size changed) it will send that IQ SET stanza again with a new JID
>> list.  Are we the only people who need this or we are doing something
>> wrong?
>
> There is no such extension.
> However, you may not send initial presence-broadcast (<presence/>), but
> instead send direct presences to needed contacts. Since you have
> customized XMPP client, this shouldn't be a big problem.
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd


More information about the ejabberd mailing list