ejabberd mod_archive_odbc表现

时间:2013-05-12 09:44:46

标签: mysql xmpp ejabberd

我正在使用ejabberd 2.1.12和为mysql数据库配置的mod_archive_odbc。我在保存单个邮件时检查了日志,看起来很恐怖。 Ejabberd假设是高度可扩展的xmpp服务器,但启用此模块可能是mysql数据库将瓶颈。

日志:

7 Query begin
7 Query select * from archive_global_prefs where us = '6@my.server'
7 Query select * from archive_jid_prefs where us = '6@my.server' and with_user = '4' and with_server = 'my.server' and with_resource = ''
7 Query select * from archive_jid_prefs where us = '6@my.server' and with_user = '4' and with_server = 'my.server' and with_resource = ''
7 Query select * from archive_jid_prefs where us = '6@my.server' and with_user = '' and with_server = 'my.server' and with_resource = ''
7 Query commit
5 Query begin
5 Query update archive_collections set with_resource = '', change_by = '6@my.server/my-resource', change_utc = '2013-05-11 09:47:46', subject = '', thread = '' where id = 9
5 Query insert into archive_messages(coll_id, utc, dir, name, body) values(9, '2013-05-11 09:47:46', 1, '', 'some random message')
5 Query commit
5 Query begin
5 Query select * from archive_global_prefs where us = '4@my.server'
5 Query select * from archive_jid_prefs where us = '4@my.server' and with_user = '6' and with_server = 'my.server' and with_resource = 'my-resource'
5 Query select * from archive_jid_prefs where us = '4@my.server' and with_user = '6' and with_server = 'my.server' and with_resource = ''
5 Query select * from archive_jid_prefs where us = '4@my.server' and with_user = '' and with_server = 'my.server' and with_resource = ''
5 Query commit
3 Query begin
3 Query update archive_collections set with_resource = 'my-resource', change_by = '4@my.server', change_utc = '2013-05-11 09:47:46', subject = '', thread = '' where id = 10
3 Query insert into archive_messages(coll_id, utc, dir, name, body) values(10, '2013-05-11 09:47:46', 0, '', 'some random message')
3 Query commit

这为每条消息提供了8个选择,2个更新和2个插入。我查看plugin's code并发现有multiple insert implementation,但这仅适用于手动存档。

有没有办法优化这个?

2 个答案:

答案 0 :(得分:1)

Erlang VM具有高度可扩展性和可靠性。 eJabberd不是。

不要害怕修改mod档案。您还可以考虑优化ejabberd odbc模块,它们执行太多的事务。

答案 1 :(得分:0)

XMPP档案现在围绕XEP-0313 Message Archive Management构建。它是ejabberd 15.06以来的默认支持,有几个后端,可以根据您的需要进行扩展。

通过切换到MAM实现,您将更加面向未来,因为所有现代XMPP客户端都将该规范作为实现归档的参考。