Я использую ejabberd 2.1.12 с mod_archive_odbc, настроенным для базы данных mysql. Я проверил журналы при сохранении одного сообщения, и они выглядят ужасно. Предполагается, что Ejabberd является хорошо масштабируемым сервером xmpp, но с включенным этим модулем, вероятно, база данных mysql будет узким местом.
Журналы:
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 вставки для каждого сообщения. Я просмотрел код плагина и нашел что существует множественная реализация вставки, но это только для ручной архивации.
Есть ли способ оптимизировать это?