我使用的是为mysql数据库配置的mod_archive_odbc的ejabberd 2.1.12。我保存单条消息时检查日志,他们看起来很可怕。 Ejabberd假设是高度可扩展的xmpp服务器,但是启用该模块后,可能mysql数据库将成为瓶颈。ejabberd mod_archive_odbc性能
日志:
7 Query begin
7 Query select * from archive_global_prefs where us = '[email protected]'
7 Query select * from archive_jid_prefs where us = '[email protected]' and with_user = '4' and with_server = 'my.server' and with_resource = ''
7 Query select * from archive_jid_prefs where us = '[email protected]' and with_user = '4' and with_server = 'my.server' and with_resource = ''
7 Query select * from archive_jid_prefs where us = '[email protected]' 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 = '[email protected]/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 = '[email protected]'
5 Query select * from archive_jid_prefs where us = '[email protected]' and with_user = '6' and with_server = 'my.server' and with_resource = 'my-resource'
5 Query select * from archive_jid_prefs where us = '[email protected]' and with_user = '6' and with_server = 'my.server' and with_resource = ''
5 Query select * from archive_jid_prefs where us = '[email protected]' 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 = '[email protected]', 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,但这只用于手动归档。
有什么方法可以优化这个吗?
嘿,我还以为有改变这种简单的方法,但我我不使用XEP 136(仅连接到与其他应用程序ejabberd DB)实现,所以我只是写我的简单的存档插件,它做一个插入但不使xep 136.当时我比较容易,谢谢:) – Lucas 2013-05-15 05:31:35