ejabberd - Comments for "Performance Mnesia vs. MySQL and even row numbers after export/import to MySQL" https://www.ejabberd.im/node/3332 en MySQL stuff https://www.ejabberd.im/node/3332#comment-53876 <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>Oh I'm sorry. I was not writing what I wanted to. The database names did not contain dots. It looked like this:</p> <p>localhost_ejabberd_jabber-localhost-com</p> <p>Dots are replaced with dashes.</p> <p>With phpMyAdmin it is possible to create datebase and user names like this.</p></div> <div class="quote-msg"> <div class="quote-author"><em>badlop</em> wrote:</div> <p>Doesn't help to use slash:</p></div> <p>Hm that's interesting. phpMyAdmin does allow it. Does anybody know what database and user names are "legal" in MySQL?!?</p> <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>there is a 64 character limit for database names and a 16 character limit for usernames</p></div> <div class="quote-msg"> <div class="quote-author"><em>badlop</em> wrote:</div> <p>Regarding the reported limit of 16-char for usernames: I can register an account in ejabberd, with MySQL storage, with up to 40 characters:</p></div> <p>NO NO! ;-)</p> <p>I was talking about a 16 character limit for MySQL user names! :-)</p> <p>The column for user names is limited to 16 characters so there has to be this limit. Also the column for database names is limited to 64 characters.</p> <p>I did not check the limits for jabber users.</p> Mon, 22 Dec 2008 23:57:17 +0000 Roi comment 53876 at https://www.ejabberd.im Limit in database name imposed by MySQL? https://www.ejabberd.im/node/3332#comment-53875 <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>Oh I'm sorry. I was not writing what I wanted to. The database names did not contain dots. It looked like this:</p> <p>localhost_ejabberd_jabber-localhost-com</p> <p>Dots are replaced with dashes.</p> <p>With phpMyAdmin it is possible to create datebase and user names like this. </p></div> <p>Doesn't help to use slash:</p> <div class="quote-msg"> <div class="quote-author">Quote:</div> <p>$ mysql -u root<br /> Welcome to the MySQL monitor. Commands end with ; or \g.<br /> Your MySQL connection id is 88<br /> Server version: 5.0.67-1 (Debian)<br /> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.</p> <p>mysql&gt; CREATE DATABASE localhost_ejabberd_jabber-localhost-com DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;<br /> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-localhost-com DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' at line 1</p> <p>mysql&gt; CREATE DATABASE localhost_ejabberd_jabber_localhost_com DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;<br /> Query OK, 1 row affected (0.02 sec)</p> <p>mysql&gt; \q<br /> Bye </p></div> <p>So, I can't create a database with name that contains . or -</p> <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>there is a 64 character limit for database names and a 16 character limit for usernames</p></div> <p>I didn't verify the 64-char limit in database name.</p> <p>Regarding the reported limit of 16-char for usernames: I can register an account in ejabberd, with MySQL storage, with up to 40 characters:</p> <div class="quote-msg"> <div class="quote-author">Quote:</div> <p>=INFO REPORT==== 23-Dec-2008::00:31:47 ===<br /> I(&lt;0.368.0&gt;:ejabberd_listener:119) : (#Port&lt;0.474&gt;) Accepted connection {{127,0,0,1},38521} -&gt; {{127,0,0,1},5222}</p> <p>=INFO REPORT==== 23-Dec-2008::00:31:48 ===<br /> I(&lt;0.383.0&gt;:ejabberd_c2s:697) : ({socket_state,gen_tcp,#Port&lt;0.474&gt;,&lt;0.382.0&gt;}) Accepted authentication for a234567890b234567890c234567890d234567890</p> <p>=INFO REPORT==== 23-Dec-2008::00:31:48 ===<br /> I(&lt;0.383.0&gt;:ejabberd_c2s:809) : ({socket_state,gen_tcp,#Port&lt;0.474&gt;,&lt;0.382.0&gt;}) Opened session for a234567890b234567890c234567890d234567890@localhost/Tka </p></div> <p>The account exists in the database:</p> <div class="quote-msg"> <div class="quote-author">Quote:</div> <p>mysql&gt; SELECT * FROM ejadb.users;<br /> +------------------------------------------+----------+<br /> | username | password |<br /> +------------------------------------------+----------+<br /> | a234567890 | aaaaaaaa |<br /> | a2345678901234567890 | aaaaaaaa |<br /> | a234567890b234567890c234567890d234567890 | aaaaaaaa |<br /> | badlop | aaaaeeee |<br /> +------------------------------------------+----------+<br /> 4 rows in set (0.00 sec) </p></div> Mon, 22 Dec 2008 23:42:34 +0000 mfoss comment 53875 at https://www.ejabberd.im Re: Can database name have dots? https://www.ejabberd.im/node/3332#comment-53874 <p>Oh I'm sorry. I was not writing what I wanted to. The database names did not contain dots. It looked like this:</p> <p>localhost_ejabberd_jabber-localhost-com</p> <p>Dots are replaced with dashes.</p> <p>With phpMyAdmin it is possible to create datebase and user names like this. Also there is a 64 character limit for database names and a 16 character limit for usernames. ejabberd seems to have problems eigher with the length of the database and/or username or _ and/or - in database and/or user names.</p> Mon, 22 Dec 2008 23:00:10 +0000 Roi comment 53874 at https://www.ejabberd.im Can database name have dots? https://www.ejabberd.im/node/3332#comment-53873 <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>It seems that ejabberd has problems with special database names (and maybe also with special user names). My database naming schema is localhost_ejabberd_jabber.domain.tld (localhost because no webspace domain is affected, then the program name and then the jabber domain which is affected). Usernames are similar but shorter because of the 16 character limitation. I got errors that ejabberd failed_changing_database and after finally changing database name AND username to ejabberd01 and everything went through smoothly.</p> <p>I think this is a issue to fix or at least talk about in the documentation. </p></div> <p>Note that I knoe few of MySQL. But I can't create a database with special characters:</p> <div class="quote-msg"> <div class="quote-author">Quote:</div> <p>$ mysql -u root<br /> Welcome to the MySQL monitor. Commands end with ; or \g.<br /> Your MySQL connection id is 87<br /> Server version: 5.0.67-1 (Debian)</p> <p>mysql&gt; CREATE DATABASE localhost_ejabberd_jabber.localhost.com DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;<br /> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.localhost.com DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' at line 1</p> <p>mysql&gt; CREATE DATABASE localhost_ejabberd_jabber-localhost-com DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;<br /> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-localhost-com DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' at line 1</p> <p>mysql&gt; CREATE DATABASE localhost_ejabberd_jabber_localhost_com DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;<br /> Query OK, 1 row affected (0.00 sec) </p></div> <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>Is this list correct or is there any file missing or wrong? </p></div> <p>Yes, all your comments are correct.</p> Mon, 22 Dec 2008 16:00:18 +0000 mfoss comment 53873 at https://www.ejabberd.im Re: With 150 concurrent users Mnesia is good. https://www.ejabberd.im/node/3332#comment-53872 <p>Hello,</p> <p>I just migrated to MySQL. I got the MySQL driver from a nice German guy who already compiled it. I just had to copy the four beam files to the right directory and everything was set. Perfect! :-) But thank you for the instructions above! I'm sure other people will love and need it, too.</p> <p>Then the problems started. It seems that ejabberd has problems with special database names (and maybe also with special user names). My database naming schema is localhost_ejabberd_jabber.domain.tld (localhost because no webspace domain is affected, then the program name and then the jabber domain which is affected). Usernames are similar but shorter because of the 16 character limitation. I got errors that ejabberd failed_changing_database and after finally changing database name AND username to ejabberd01 and everything went through smoothly.</p> <p>I think this is a issue to fix or at least talk about in the documentation.</p> <p>BTW: What Mnesia database files can I move to backup?</p> <p>The export command created these files for me:</p> <div class="codeblock"><code>last.txt<br />offline.txt<br />passwd.txt<br />private_storage.txt<br />roster.txt<br />vcard_search.txt<br />vcard.txt</code></div> <p>I now use the following modules as odbc version:</p> <div class="codeblock"><code>mod_last_odbc<br />mod_offline_odbc<br />mod_privacy_odbc<br />mod_private_odbc<br />mod_roster_odbc<br />mod_vcard_odbc</code></div> <p>When I checked ejabberd's mnesia directory I saw some files which could be useless and are better stored at my backup location (as I don't want to try to remember in a year what files are still necessary and which not):</p> <div class="codeblock"><code>last_activity.DCD<br />last_activity.DCL<br />offline_msg.DAT<br />passwd.DCD<br />passwd.DCL<br />private_storage.DAT<br />roster.DCD<br />vcard.DAT<br />vcard_search.DCD<br />vcard_search.DCL</code></div> <p>Is this list correct or is there any file missing or wrong?</p> <p>Regards,<br /> Martin</p> Mon, 22 Dec 2008 15:16:11 +0000 Roi comment 53872 at https://www.ejabberd.im With 150 concurrent users Mnesia is good. Instructions for mysql https://www.ejabberd.im/node/3332#comment-53869 <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>2500 accounts at all and about 50 to 150 concurrent users on the server.</p> <p>But it sounds like I'm going for MySQL after what I heard from you. </p></div> <p>I help to administer a server with 25000 registered accounts, 500 concurrent users maximum, 2400 different accounts were used in the last month. It uses the default Mnesia, and there hasn't been any problem, and CPU/RAM usage is low.</p> <p>So, I think right now with just 150 max concurrent users, performance of Mnesia is not an issue for you.</p> <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>Problem now is that the Debian package of ejabberd isn't supporting MySQL and I won't compile my own package. I hope there will be a development in this issue shortly as other people also request MySQL support for the Debian package. </p></div> <p>You already have the erlang compiler intalled. You only need to download with Subversion, compile and install with the ejabberd *.beam files:</p> <pre> $ svn co <noindex><a href="http://svn.process-one.net/ejabberd-modules/mysql/trunk" title="http://svn.process-one.net/ejabberd-modules/mysql/trunk" rel="nofollow" >http://svn.process-one.net/ejabberd-modules/mysql/trunk</a></noindex> mysql-erlang A mysql-erlang/Emakefile A mysql-erlang/build.bat A mysql-erlang/INSTALL A mysql-erlang/src A mysql-erlang/src/mysql_conn.erl A mysql-erlang/src/mysql_recv.erl A mysql-erlang/src/mysql.erl A mysql-erlang/src/mysql_auth.erl A mysql-erlang/src/mysql.hrl A mysql-erlang/build.sh A mysql-erlang/ebin U mysql-erlang RevisiĆ³n obtenida: 843 $ cd mysql-erlang/ $ ./build.sh Recompile: src/mysql_recv Recompile: src/mysql_conn Recompile: src/mysql_auth Recompile: src/mysql $ sudo cp ebin/*.beam /var/lib/ejabberd/ebin/ </pre> Mon, 22 Dec 2008 11:39:45 +0000 mfoss comment 53869 at https://www.ejabberd.im Re: *SQL performs better. Compare size of tables https://www.ejabberd.im/node/3332#comment-53868 <p>Hello and thanks for your reply. :-)</p> <p>No, 2500 accounts at all and about 50 to 150 concurrent users on the server.</p> <p>But it sounds like I'm going for MySQL after what I heard from you.</p> <p>Problem now is that the Debian package of ejabberd isn't supporting MySQL and I won't compile my own package. I hope there will be a development in this issue shortly as other people also request MySQL support for the Debian package.</p> <p>Thank you for the hint with the Web Admin. It really seems that I have 800 vcards even, interesting. ;-)</p> <p>Regards,<br /> Martin</p> Mon, 22 Dec 2008 09:17:23 +0000 Roi comment 53868 at https://www.ejabberd.im *SQL performs better. Compare size of tables https://www.ejabberd.im/node/3332#comment-53863 <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>I'm running a ejabberd server with ~2500 users.</p> <p>As I'm thinking about migrating to MySQL: Can anybody tell my how the performance is when comparing Mnesia with MySQL? </p></div> <p>2500 concurrent users, or total registered accounts? The important factor is concurrent users.</p> <p>ejabberd consumes less computational resources when using some *SQL database than when using internal Mnesia. You are probably interested in that topic when you have many concurrent users (more than 1000, for example). With few concurrent users ejabberd's CPU consumption is negligible so admins of small servers don't care to setup an external SQL server and database.</p> <div class="quote-msg"> <div class="quote-author"><em>Roi</em> wrote:</div> <p>Then I imported the data to a MySQL database.</p> <p>This is the result (cut-n-pasted from phpMyAdmin):</p> <p>last 2,000<br /> privacy_default_list 0<br /> privacy_list 0<br /> privacy_list_data 0<br /> private_storage 642<br /> rostergroups 8,283<br /> rosterusers ~46,566<br /> spool 2,936<br /> users 2,464<br /> vcard 800<br /> vcard_search 800</p> <p>The numbers are the rows of each table. I'm wondering why "last", "vcard" and "vcard_search" contain a even number of rows. Is this just a coincidence or did the export not work properly? </p></div> <p>It's suspicious. You can check the number of items in the tables in Mnesia, and compare with the exported results. Go to ejabberd Web Admin -&gt; Nodes -&gt; your node -&gt; Database.</p> Sun, 21 Dec 2008 22:35:23 +0000 mfoss comment 53863 at https://www.ejabberd.im