[ejabberd] shared roster patches

Robert McQueen robert.mcqueen at collabora.co.uk
Tue Dec 11 17:40:44 MSK 2007


Hi Alexey, ejabberd folks,

I'm mindful of bothering Alexey too much on Jabber so I thought I'd drop
a mail to the list so that other people can take a look at these patches
too. I guess these are probably not very interesting for merging
upstream, but I thought I'd send them to you and see if you've got any
feedback... I'm new to erlang so any tips would be very appreciated.

There's a series of patches so far:

* 001-shared_roster_push2.diff - your hack from earlier this year to
  push newly registered roster items to currently-signed in users so
  that @all@ works with mod_register
* 002-shared_roster-recent.diff - not that useful any more, but I took
  code from Badlop's mod_ctlextra to list recently active users, and
  made a @recent@ group which has users who are active in the last 7
  days
* 003-shared_roster_online.diff - makes an @online@ group which contains
  currently online users, and adds hooks for user_available and
  unset_presence to push other online users the updated roster item, or
  remove/revert it when people sign out
* 004-shared_roster_nearby.diff - this is what I'm working on at the
  moment so it's currently broken/unfinished, but thus far I've added a
  User argument to get_group_users to the get_nearby_users function can
  do something which is dependent on the user, then I can implement the
  get_nearby_users function to do matching on get_user_session_ip
  results

The @online@ group seems to work very well on jabber.laptop.org, taking
the roster size down to ~150 people and reducing CPU and memory usage a
lot[1]. However, I still have serious stability issues with PEP such as
mnesia core dumping which I'm not sure can just be blamed on over-large
rosters any more. As I work on the nearby patch (and I'm going to do a
random/hashing one) it will reduce the roster size even more.

My main concern with the patches so far is what you think of the
user_available and unset_presence hook functions, are they correct or
can anyone see a way to do it more efficiently? I'm especially concerned
about my get_user_roster_item function which gets the whole roster and
throws it away just to find one item. I thought about adding a hook with
that name which would let mod_roster and mod_shared_roster look up just
one roster item rather than the whole list - what do people think?

Thanks,
Rob

[1]: I found that ejabberd was spending 100% of CPU repeatedly calling
pwrite64 on the pubsub_items table. Configuring the node to store the
table in RAM & Disk reduced CPU usage to more like 4%.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001-shared_roster_push2.diff
Type: text/x-diff
Size: 4448 bytes
Desc: not available
Url : http://lists.jabber.ru/pipermail/ejabberd/attachments/20071211/483634f6/attachment-0004.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 002-shared_roster_recent.diff
Type: text/x-diff
Size: 4535 bytes
Desc: not available
Url : http://lists.jabber.ru/pipermail/ejabberd/attachments/20071211/483634f6/attachment-0005.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 003-shared_roster_online.diff
Type: text/x-diff
Size: 7377 bytes
Desc: not available
Url : http://lists.jabber.ru/pipermail/ejabberd/attachments/20071211/483634f6/attachment-0006.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 004-shared_roster_nearby.diff
Type: text/x-diff
Size: 6020 bytes
Desc: not available
Url : http://lists.jabber.ru/pipermail/ejabberd/attachments/20071211/483634f6/attachment-0007.bin 


More information about the ejabberd mailing list