ejabberd - Comments for "Startup slow with many pubsub nodes" https://www.ejabberd.im/node/3109 en Minor improvement https://www.ejabberd.im/node/3109#comment-53319 <p>Since I made the pubsub tables Disk Only, the performance of actually publishing an item has become extremely slow.<br /> create and subscribe do not seem to be affected.</p> <p>There are three pubsub tables which I had changed:<br /> pubsub_items 18412 records 8770315 memory<br /> pubsub_nodes 76365 records 81849201memory<br /> pubsub_state 83263 records 27473061 memory</p> <p>I have made it so that the only table to be loaded Disk Only is pubsub_nodes. This seems to return the publish performance back to normal yet the load time is still fast.</p> Thu, 19 Jun 2008 10:56:56 +0000 yellowdog comment 53319 at https://www.ejabberd.im Workaround https://www.ejabberd.im/node/3109#comment-53317 <p>One of my questions was whether the pubsub needed to be loaded completely into memory and if it would make sense to load it on-demand.</p> <p>The guys in the ejabberd chatroom pointed me towards a nice workaround. Using the Admin webpage, you can set tables to load Disk Only copy. Once this is set, the startup takes seconds once again.</p> <p>There was some mention of using an empty cfg file because the config table gets overwritten at startup, but I think this was not necessary in this case.</p> <p>Note: This is a workaround, but I still think there is a scalability issue here. I can't explain why the load time would be non-linear. Badlop suggested that it could be because of RAM swap, which I will investigate further.</p> <p>Here is a copy of the chatroom conversation:</p> <div class="codeblock"><code>[10:25:04] *** badlop has joined the room as a moderator and an owner<br />[10:30:51] &lt;yellowdog&gt; Kev: I&#039;ve sent Mickael a mail regarding <a href="http://www.ejabberd.im/node/3109" title="http://www.ejabberd.im/node/3109">http://www.ejabberd.im/node/3109</a> Do you know if he&#039;s still very active in development?<br />[10:34:12] &lt;badlop&gt; yellowdog: also, i&#039;ll later mention that thread to the author of the newer pubsub module, who probably knows more the details of the code<br />[10:35:05] &lt;teo&gt; yellowdog: afaik, the person who is responsible for pubsub in ejabberd is christophe romain. i doubt that mickael can fix the scalability issue<br />[10:35:10] &lt;Kev&gt; yellowdog: I have no idea<br />[10:36:09] &lt;badlop&gt; right, as teo explained; in addition you can set the table to be stored only in disk (not in ram) using the web admin<br />[10:37:34] &lt;Kev&gt; I had the notion that web admin changes were only transient - am I wrong?<br />[10:37:38] &lt;badlop&gt; extauth:80 &lt;-- this should mean line 80 of extauth.erl, and &lt;0.292.0&gt; is the Pid of the erlang process that was running that code<br />[10:37:48] &lt;yellowdog&gt; Thanks badlop. If you&#039;re going to mention it to him then I won&#039;t bother bugging him. I&#039;ll try your suggestion, I guess that will cause it to not get loaded at startup.<br />[10:39:17] &lt;teo&gt; Kev: not the changes to a database schema at least<br />[10:39:40] &lt;Kev&gt; ah, ta<br />[10:42:29] &lt;badlop&gt; and the config changes are stored in the temporary (only RAM) config table; those options are overwritten at startup with the ejabberd.cfg file<br />[10:43:45] &lt;badlop&gt; obvious trick: if you delete all the content of ejabberd.cfg and start ejabberd then the options stored are not overwritten<br />[10:44:53] &lt;teo&gt; badlop: it isn&#039;t true. config table is disk-only. but their entries are definitely overwritten on ejabberd start. but if you clear ejabberd.cfg ejabberd will use stored config from db<br />[10:46:01] &lt;badlop&gt; ah, right: config table is in mnesia (so it&#039;s permanent); i confused with the hooks table :S<br />[10:46:29] &lt;Kev&gt; oh good, I&#039;m glad this isn&#039;t confusing ;)<br />[10:47:28] &lt;yellowdog&gt; Ok I&#039;ve made the change... I&#039;m about to restart, I don&#039;t want to get this wrong because it takes 2 hours to load the database as it is... You&#039;re all suggesting that I use an empty ejabberd.cfg file to startup?<br />[10:48:34] &lt;teo&gt; yellowdog: then you&#039;ll forget your server setup and after some time will be disappointed (for one or another reason)<br />[10:49:06] &lt;yellowdog&gt; teo: no worries, I&#039;ll just move it somewhere and touch ejabberd.cfg<br />[10:49:30] &lt;yellowdog&gt; This isn&#039;t a good long-term solution for me...<br />[10:50:40] &lt;badlop&gt; yellowdog: the trick i mentioned about starting with emtpy ejabberd.cfg is not documented for that reason, and also because it isn&#039;t possible to dump the config from ejabberd DB to a newer ejabberd.cfg<br />[10:56:40] &lt;yellowdog&gt; Ok, I tried a restart with an empty ejabberd.cfg and lo and behold, it was fast.<br />[10:57:14] &lt;yellowdog&gt; To be sure, I put back the original cfg, restarted... it&#039;s also fast.<br />[10:57:37] &lt;yellowdog&gt; I brought up the admin webapp, checked the database and the tables are still set to Disk Only. </code></div> Thu, 19 Jun 2008 09:18:05 +0000 yellowdog comment 53317 at https://www.ejabberd.im It took 2 hours and 10 https://www.ejabberd.im/node/3109#comment-53316 <p>It took 2 hours and 10 minutes to load mnesia...</p> Thu, 19 Jun 2008 07:23:17 +0000 yellowdog comment 53316 at https://www.ejabberd.im Still loading mnesia... 1 https://www.ejabberd.im/node/3109#comment-53315 <p>Still loading mnesia... 1 hour 40 minutes...</p> Wed, 18 Jun 2008 16:48:29 +0000 yellowdog comment 53315 at https://www.ejabberd.im