ejabberd、名册和 mySQL
快速背景。
我们正在运行一个 ejabberd 服务器,有相当大的用户群连接到它(超过 70 万用户)。我们遇到的问题是名册大小太大,mnesia 无法处理,因此我们决定使用 Web 界面,在用户登录/注销时添加和删除名册条目。这种方法的问题在于,它延迟了他们的登录,而这是我们无法做到的。我们对此的解决方法是将名册请求放入延迟任务表中,该表将由 cron 接收并添加条目。然后我们遇到的问题是,数据库中条目堆积的速度超出了处理它所需的时间。测试表明这不是脚本,而是 ejabberd 服务器的实际响应时间。
之后,我们决定将名册从内部 menesia DB 移动到 mysql。通过这样做,我们可以直接从数据库插入/删除名册条目,这对 ejabberd 服务器没有影响。
我已成功添加和删除用户的名册条目,并且它们已成功显示在 Web 界面中。
现在的问题是:在添加了相互名册条目后,我需要告诉用户此人在线,以便他们在 Web 界面中显示在线。目前,在我添加名册条目后,用户仅显示为离线。
根据我的理解,这应该是一个相当简单的存在请求来执行此操作,但我很难让它工作。是否有一个模块或一种发送在线请求的简单方法,以便您的名册中包含您的人知道您在线,并且也是一种快速探测您自己的名册的方法。
任何帮助表示赞赏。
A quick background.
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.
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.
I've successfully added and removed roster entries for users, and they are successfully showing up in the web interface.
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.
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.
Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还需要发送相关的>用于向客户端传播名册更新的节。
您应该阅读 RFC 的相关部分,链接如下:
http://xmpp.org/rfcs /rfc3921.html#int
You also need to send the related <presence/> stanzas for propagating the roster updates to the clients.
You should read the relevant part of the RFC, conveniently linked here:
http://xmpp.org/rfcs/rfc3921.html#int