Rosters in mySQL

Me again...

So we've come up with a solution with our roster size being too big. Since we keep a entry of all users who have favourited each other (which means they can chat to one another), we decided to populate the roster for each user when they log on to the site. When they log off, we will clean up the rosters by removing or remove them once the session has timed out.

We had problems with the delay times when adding loads of rosters though, the system would get lagged and it would be ages before the roster was updated and the person would see their contacts.

Thats just some back ground info on the problem.

We decided that it might be best to configure ejabberd to use mySQL, but just for rosters. Since we would then be able to add roster entries straight into the DB without putting overhead on the ejabberd system, which means it could concentrate on just doing chat and user registrations.

I've configured the system and it seems to be working to a degree.

My config entries look like such (the database is not on the same machine as ejabberd:

{odbc_server, {mysql, "host.net", "ejabberd", "ejabberd", "password"}}.
{mod_roster_odbc,   []},

The above is the only entry that I have configured to be _odbc, which I assume is correct. I have not added the auth section for mysql, since I only want rosters in mysql. I have however, tested it with auth on mysql, and it does auth through the DB (can create user, etc), but the roster still behaves the same.

Now, if I add a roster entry for a particular user via the web admin interface, it adds it to the mySQL database just fine, then when run (via the command line)

ejabberdctl get_roster 42 localhost

It returns the roster as you would expect, which is good so far. The problem comes in when I try to add_roster entries via mod_rest or via the command line. For instance, the following has no effect what so ever (24912 is a registered user):

add_rosteritem 42 localhost 24912 localhost Garth Contacts both

No roster entry is entered into the DB. Logging level is set to 4 and there is nothing coming up in the logs.

Anyone able to help?

Thanks

Update

dbl post :(

same problem here. Any fix?

same problem here. Any fix?

Update

Thought I would post a update.

I've managed to insert a entry into the db and now when I run ejabberdctl get_roster it is actually returning the entry. Also, when I log on, the web interface is showing the contact too. How ever, if I add a roster entry via the web interface, which is still basically executing the add_rosteritem command, then no entry shows up in the mySQL db, but it does show up in the web interface.

What this says to me, is that when get_roster is being run by the web interface, it's getting results from the mnesia db AND the mySQL db.

I've upped the logging to level 5 and I can see some select statements being run for get roster, how ever, no insert/update statements are being run for adding a roster entry.

I've included bits of a log entry of a add rosteritem command executes


=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1698.0>:ejabberd_commands:314) : Executing command mod_admin_extra:add_rosteritem with Args=["42",
                                                                                                  "host.net",
                                                                                                  "24912",
                                                                                                  "host.net",
                                                                                                  "Garth",
                                                                                                  "Contacts",
                                                                                                  "both"]


=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1698.0>:ejabberd_router:313) : route
	from {jid,"42","host.net","ijabE258D","42",
                  "host.net","ijabE258D"}
	to {jid,"42","host.net","ijabE258D","42",
                "host.net","ijabE258D"}
	packet {xmlelement,"iq",
                   [{"type","set"},{"id","push"}],
                   [{xmlelement,"query",
                        [{"xmlns","jabber:iq:roster"}],
                        [{xmlelement,"item",
                             [{"jid","24912@host.net"},
                              {"name","Garth"},
                              {"subscription","both"}],
                             [{xmlelement,"group",[],
                                  [{xmlcdata,"Contacts"}]}]}]}]}


=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1698.0>:ejabberd_local:286) : local route
	from {jid,"42","host.net","ijabE258D","42",
                  "host.net","ijabE258D"}
	to {jid,"42","host.net","ijabE258D","42",
                "host.net","ijabE258D"}
	packet {xmlelement,"iq",
                           [{"type","set"},{"id",[...]}],
                           [{xmlelement,[...],...}]}



=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1144.0>:ejabberd_c2s:1205) : broadcast
[{item,{"24912","host.net",[]},both}]


=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1144.0>:ejabberd_c2s:1936) : roster changed for "42"


=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1695.0>:ejabberd_http_bind:899) : OutPacket: [{xmlstreamelement,
                                                    {xmlelement,"iq",
                                                     [{"from",
                                                       "42@host.net/ijabE258D"},
                                                      {"to",
                                                       "42@host.net/ijabE258D"},
                                                      {"type","set"},
                                                      {"id","push"}],
                                                     [{xmlelement,"query",
                                                       [{"xmlns",
                                                         "jabber:iq:roster"}],
                                                       [{xmlelement,"item",
                                                         [{"jid",
                                                           "24912@host.net"},
                                                          {"name","Garth"},
                                                          {"subscription",
                                                           "both"}],
                                                         [{xmlelement,
                                                           "group",[],
                                                           [{xmlcdata,
                                                             "Contacts"}]}]}]}]}}]


=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1699.0>:ejabberd_http:135) : S: [{["r3st"],mod_rest},
                                      {["admin"],ejabberd_web_admin},
                                      {["http-bind"],mod_http_bind},
                                      {["http-poll"],ejabberd_http_poll}]


=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1143.0>:ejabberd_http_bind:410) : New request: {http_put,3553578,
                                                     [{"xmlns",
                                                       "http://jabber.org/protocol/httpbind"},
                                                      {"rid","3553578"},
                                                      {"sid",
                                                       "9fb97d543f8b73c5326965f5ce9b5985e26f8629"}],
                                                     [],112,1,[],
                                                     {{192,168,2,1},49466}}

=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1143.0>:shaper:61) : State: {maxrate,1000,3.7650727139653224,
                                     1299487891766445}, Size=112
M=56.10562087112097, I=4587.914


=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1143.0>:ejabberd_http_bind:550) : New request: {http_put,3553578,
                                                     [{"xmlns",
                                                       "http://jabber.org/protocol/httpbind"},
                                                      {"rid","3553578"},
                                                      {"sid",
                                                       "9fb97d543f8b73c5326965f5ce9b5985e26f8629"}],
                                                     [],112,1,[],
                                                     {{192,168,2,1},49466}}

=INFO REPORT==== 2011-03-07 10:51:36 ===
D(<0.1143.0>:ejabberd_http_bind:668) : reqlist: [{hbr,3553578,[],[]},
                                                 {hbr,3553577,[],
                                                  [{xmlstreamelement,
                                                    {xmlelement,"iq",
                                                     [{"from",
                                                       "42@host.net/ijabE258D"},
                                                      {"to",
                                                       "42@host.net/ijabE258D"},
                                                      {"type","set"},
                                                      {"id","push"}],
                                                     [{xmlelement,"query",
                                                       [{"xmlns",
                                                         "jabber:iq:roster"}],
                                                       [{xmlelement,"item",
                                                         [{"jid",
                                                           "24912@host.net"},
                                                          {"name","Garth"},
                                                          {"subscription",
                                                           "both"}],
                                                         [{xmlelement,
                                                           "group",[],
                                                           [{xmlcdata,
                                                             "Contacts"}]}]}]}]}}]}]

ejabberdclt does not work with odbc

In fact this module mod_admin_extra was just blindly trying to write to internal DB.

We have fixed this issue, but i do not know how to upload this fixes.

Paste anywhere

anh25721 wrote:

In fact this module mod_admin_extra was just blindly trying to write to internal DB.

We have fixed this issue, but i do not know how to upload this fixes.

If it is few lines (less than 30 lines), you can put here in a comment. If it is long, you can put in http://pastebin.com/ or http://paste.jabbim.cz/ and then comment here the URL.

I'll either commit your patch to SVN, or upload the patch to a permanent page.

Can you upload / paste your changes?

anh25721 wrote:

In fact this module mod_admin_extra was just blindly trying to write to internal DB.

We have fixed this issue, but i do not know how to upload this fixes.

Hi Anh25721,

Would you mind sharing your changes? I have hit the exact same issue...

Thank you in advance

--Franky

Hi Anh25721, i need your

Hi Anh25721, i need your fixes too, please share it in some way.
Thanks a lot.

Syndicate content