[ejabberd] ejabberd mod_muc bottleneck

Karthik Kailash karthik at socialvisioninc.com
Thu Jul 1 10:27:24 MSD 2010


Hi Evgeniy,

Hello, Karthik. First of all, your investigation is interesting :) However,
> I cannot reproduce the issue. This is how I reproduce it:
>

Thanks!


> 1) Connect with 2 clients and join to some muc conference.
> 2) Start eprof on the room pid.

3) Route messages from one of the connected users to the room in erlang
> shell:
> > lists:foreach(fun(_) -> ejabberd_router:route(jlib:make_jid("user", "
> domain.com", "resource"), jlib:make_jid("room", "conference.domain.com",
> ""), {xmlelement, "message", [{"type", "groupchat"}], [{xmlelement, "body",
> [], [{xmlcdata, "a"}]}]}) end, lists:seq(1, 1000)).
> 4) Analyze eprof data.
>
> According to your report, there should be
> mod_muc_room:process_groupchat_message (and maybe some mnesia functions) in
> the top of eprof output, but I don't see this.
>

I haven't tried using eprof.  Adding debug macros (e.g. ?INFO_MSG) in the
functions I listed was how I mapped it all out.  Also I'm using the ejabberd
2.1.4 source, are you using the same?  I'd be happy to share my Tsung script
and my modified ejabberd source files.


> On the other hand, according to your symptoms and looking into mnesia
> sources I've found that dirty functions call to mnesia:do_dirty_rpc/5
> function, which calls rpc:call, here is a snippet:

do_dirty_rpc(Tab, Node, M, F, Args) ->
>    case rpc:call(Node, M, F, Args) of
>    {badrpc, Reason} ->
>    timer:sleep(20), %% Do not be too eager, and can't use yield on SMP
>    ...
>    do_dirty_rpc(Tab, NewNode, M, F, Args)
>
> This might be a problem in your case. Try to add debug output there to
> check if you don't get {badrpc, Reason} in this function.
>
>
Wow, this is a great lead -- that timer:sleep(20) looks like a really good
explanation for what is going on.  I'm going to try this out right now and
post back with what I find.

Karthik

-- 
Karthik Kailash
SocialVision Inc.
"Online Television Becomes a Social Experience"
www.socialvisioninc.com
Phone: (408) 768-7704
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20100630/1efc8fc3/attachment.html>


More information about the ejabberd mailing list