2

我正在使用为 mysql 数据库配置 mod_archive_odbc 的 ejabberd 2.1.12。我在保存单个消息时检查了日志,它们看起来很可怕。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 次插入。我查看了插件的代码,发现有多个插入实现,但这仅用于手动存档。

有什么办法可以优化吗?

4

2 回答 2

1

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

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

于 2013-05-13T17:35:20.287 回答
0

XMPP 存档现在是围绕XEP-0313 消息存档管理构建的。自ejabberd 15.06以来,它被默认支持,具有多个后端,并且应该可以根据您的需要进行扩展。

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

于 2015-07-31T16:28:17.910 回答