[ejabberd] Optimization of mod_disco.erl

Michal Slaski michal at erlang-consulting.com
Fri Sep 7 20:29:50 MSD 2007

When number of hosts (domains) handled by a single ejabberd server is  
big (hundreds), response time for services discovery increases a lot.  
We have seen response times greater than 30 seconds when number of  
domains was above 1000. The attached patch optimizes  
mod_disco:get_vh_services/1 function. I removed also sorting of  
hosts. Is there any reason why one would need to sort them? Is it  
because you want to list discovered services in alphabetic order?

When performance of ejabberd becomes an issue you can profile it with  
one of the tools included in Erlang/OTP. We used fprof. Remember to  
be careful when playing around with profiling, because fprof dumps a  
lot of data on hdd (could be 100MB per 5 seconds).


Michal Slaski

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mod_disco.erl.patch
Type: application/octet-stream
Size: 844 bytes
Desc: not available
Url : http://lists.jabber.ru/pipermail/ejabberd/attachments/20070907/4f93be85/attachment.obj 

More information about the ejabberd mailing list