[ejabberd] Implementing XEP-0059 (question for mnesia gurus)

Alexander Tsvyashchenko lists at ndl.kiev.ua
Fri Oct 10 13:31:47 MSD 2008


Hello Eric,

I'm by no means "mnesia guru", but still would like to provide some
information on that subject.

On Fri, 10 Oct 2008 11:04:25 +0200, Eric Cestari <eric at ohmforce.com> wrote:

> I am considering implementing Result Set management in ejabberd.
> (http://xmpp.org/extensions/xep-0059.html 
> ).
> (For pubsub and muc browsing via disco).

I'm not that familiar with ejabberd sources, but there are already at least
two implementations of RSM available there in mod_archive_* family of
modules: one for mnesia database and another one for SQL ones. I believe
the SQL-based implementation available in mod_archive_odbc should be the
most complete of them, but original (mod_archive) implementation, while
containing several bugs, also can be fixed up to the working state.

However, these implementations are specific to archiving support. It might
be a good idea to generalize them to re-use everywhere where RSM makes
sense instead of implementing it in every module separately.

> I'd like to do it, but I have a few questions regarding mnesia  
> performance for paging.
>  From what I saw, there is no OFFSET and LIMIT for limiting a query  
> result.
>
> One can use lists module for doing this, but is it efficient enough ?
> Wouldn't that involve many things moving around, and potentially very  
> big messages passed between processes ?

Yes, I've not found OFFSET/LIMIT support in mnesia also, and for archiving
purposes the performance (in terms of both memory and speed) appeared to be
absolutely unsatisfactory without them - that was the main reason I've
rewritten mod_archive to switch it from mnesia database to SQL-based
storage, see the detailed description here:
http://www.ndl.kiev.ua/content/modarchiveodbc-release

However, again - I'm not mnesia guru, probably I might just have missed
something ...

> Let's say I have 100K muc rooms to page through, 50 by 50, will that  
> work or will the server memory consumption be too high ?

While I cannot directly extrapolate archiving performance on mnesia
database to your scenario, I doubt it will work OK - archiving didn't even
with much smaller database size.

-- 
Good luck!                                     Alexander


More information about the ejabberd mailing list