The following issue has been SUBMITTED.
======================================================================
http://www.dbmail.org/mantis/view.php?id=1010
======================================================================
Reported By: rmoesbergen
Assigned To:
======================================================================
Project: DBMail
Issue ID: 1010
Category: Database layer
Reproducibility: always
Severity: minor
Priority: normal
Status: new
target:
======================================================================
Date Submitted: 31-May-13 10:39 CEST
Last Modified: 31-May-13 10:39 CEST
======================================================================
Summary: Imapd NOOP command is very expensive/slow
Description:
We have an IMAP client program that issues many NOOP commands during
communication. We've found that the NOOP command does a complete mailbox
status flag reload every time it is executed. This particular IMAP client
issues a NOOP command after every FETCH. Message download throughput is
slowed to one message every 2/3 seconds, which is not usable. The query
that is executed is here:
state_load_messages in dm_mailboxstate.c:
line 93:
date2char_str("internal_date", &frag);
snprintf(query, DEF_QUERYSIZE,
"SELECT seen_flag, answered_flag, deleted_flag,
flagged_flag, "
"draft_flag, recent_flag, %s, rfcsize,
message_idnr FROM %smessages m "
"LEFT JOIN %sphysmessage p ON p.id =
m.physmessage_id "
"WHERE m.mailbox_idnr = ? AND m.status IN (%d,%d)
ORDER BY message_idnr ASC",
frag, DBPFX, DBPFX, MESSAGE_STATUS_NEW,
MESSAGE_STATUS_SEEN);
On a mailbox with many unread messages, this query performs poorly and
MySQL reports it as a 'slow query'. Workaround I've used for now is to
disable the flag refresh in imapcommands.c to make NOOP a 'real' NOOP:
diff --git a/src/imapcommands.c b/src/imapcommands.c
index a9b952d..8efd8fb 100644
--- a/src/imapcommands.c
+++ b/src/imapcommands.c
@@ -197,8 +197,8 @@ int _ic_starttls(ImapSession *self)
void _ic_noop_enter(dm_thread_data *D)
{
SESSION_GET;
- if (self->state == CLIENTSTATE_SELECTED)
- dbmail_imap_session_mailbox_status(self, TRUE);
+ //if (self->state == CLIENTSTATE_SELECTED)
+ // dbmail_imap_session_mailbox_status(self, TRUE);
SESSION_OK;
SESSION_RETURN;
}
A better fix might be to only refresh when there hasn't been a refresh in
the last X seconds, where X would be configurable and perhaps the query
used can be optimized (haven't looked into that yet).
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
31-May-13 10:39 rmoesbergen New Issue
======================================================================
_______________________________________________
Dbmail-dev mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev