title: ejabberd, Rosters and mySQL
body: <p>A quick background.</p>
  
  <p>We're running a ejabberd server with a fairly large userbase connecting to it (700k+ users). We had a problem with the roster size being too big for mnesia to handle, so we decided to have the web interface, add and remove roster entries for a user when they log in/off. The problem with this method, is that it was delaying their log in's, which we couldn't have. Our work around for this, was to have the roster requests go into a delayed task table, which would get picked up by a cron and add the entries. The problem we then ran into was the rate at which entries were piling up in the DB was out stripping the time it was taking to process it. Testing showed it wasn't the script, but the actual response time from the ejabberd server.</p>
  
  <p>After this, we decide to move the rosters from the internal menesia DB to mysql. By doing this, we could insert/delete rosters entries straight form the DB, which would have no impact on the ejabberd server. </p>
  
  <p>I've successfully added and removed roster entries for users, and they are successfully showing up in the web interface.</p>
  
  <p>Now for the problem: After I've added reciprocal roster entries, I need to tell users that this person is online, so that they show online in the web interface. Currently, after I've added the roster entries, the users just show as offline. </p>
  
  <p>From my understanding, it should be a rather simple presence request that does this, but I'm having trouble getting it to work. Is there a module, or a easy way of sending a presence request, so people who have you in your roster know you are online and also a way to quickly probe your own roster.</p>
  
  <p>Any help appreciated.</p>