[ejabberd] Long start up time / high memory usage with ejabberd 2.1.11

Michael Amundson michael at echobit.com
Tue Sep 25 18:46:08 MSK 2012

Hi all.

I currently maintain an ejabberd server for my employer. We use it to 
provide realtime chat to users of a service we run. In the last several 
months, we've been grappling with an extremely lengthy start up time for 
ejabberd. I originally noticed this about two months ago, when it would 
take 20 minutes to start up. It now takes 45 minutes. To be clear, this 
start up time is before any listening sockets are bound--until the delay 
is over, nothing can connect to the server. Additionally, ejabberd eats 
up about 1.9GB of RAM by the time it's done starting up (and before 
anyone connects).

We have a fairly large roster table, and I'm curious if that might have 
anything to do with it? In particular, the roster apparently is 
occupying 143526483 words of mem, which, on 64-bit Linux, I understand 
to be 143526483 * 8 bytes, or roughly 1GB of RAM. I can account for 
perhaps 1.2GB of memory usage based on the mnesia stats, but I can't 
figure out where the remaining 0.7GB is spent (since this is before 
anyone connects). I'm also at a loss as to why a data set that eats up 
~130MB on disk should eat up 1.9GB when loaded in memory.

With a roster this size (and it's only going to keep growing), am I 
better off using ODBC? Will that cause ejabberd to read anything in to 
memory on start up? Is there a way to make mnesia keep the roster on 
disk rather than in memory? (90% of our userbase isn't online at any 
given time)

Thanks in advance for any suggestions!

Potentially relevant output from ejabberdctl mnesia info:

---> Processes holding locks <---
---> Processes waiting for locks <---
---> Participant transactions <---
---> Coordinator transactions <---
---> Uncertain transactions <---
---> Active tables <---
local_config   : with 11       records occupying 1634     words of mem
caps_features  : with 14       records occupying 13308    bytes on disc
roster_version : with 0        records occupying 300      words of mem
session        : with 2600     records occupying 481444   words of mem
muc_room       : with 1737     records occupying 5385556  words of mem
muc_online_room: with 1752     records occupying 128090   words of mem
acl            : with 9        records occupying 813      words of mem
privacy        : with 2        records occupying 496      words of mem
last_activity  : with 53161    records occupying 3374194  words of mem
config         : with 17       records occupying 670      words of mem
offline_msg    : with 6327     records occupying 14341364 bytes on disc
route          : with 5        records occupying 569      words of mem
private_storage: with 3        records occupying 6629     bytes on disc
iq_response    : with 0        records occupying 300      words of mem
http_bind      : with 0        records occupying 300      words of mem
motd           : with 0        records occupying 300      words of mem
temporarily_blocked: with 0        records occupying 300      words of mem
muc_registered : with 1        records occupying 446      words of mem
s2s            : with 0        records occupying 300      words of mem
motd_users     : with 0        records occupying 300      words of mem
roster         : with 562873   records occupying 143526483 words of mem
session_counter: with 1        records occupying 342      words of mem
captcha        : with 0        records occupying 300      words of mem
schema         : with 24       records occupying 2973     words of mem
===> System info in version "4.7", debug level = none <===
opt_disc. Directory "/var/lib/ejabberd" is used.
use fallback at restart = false
running db nodes   = [ejabberd at butler]
stopped db nodes   = []
master node tables = []
remote             = []
ram_copies         = 
disc_copies        = [acl,config,last_activity,local_config,motd,motd_users,
disc_only_copies   = [caps_features,offline_msg,private_storage]
[{ejabberd at butler,disc_copies}] = [schema,roster,motd_users,muc_registered,
[{ejabberd at butler,disc_only_copies}] = [caps_features,private_storage,
[{ejabberd at butler,ram_copies}] = [captcha,session_counter,s2s,
332780 transactions committed, 39 aborted, 6062 restarted, 291693 logged 
to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []

Michael Amundson

More information about the ejabberd mailing list