This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit b5f6d6d3807af60df9dc0e0cceb4ef4ad4e90d33 Author: Benoit Tellier <[email protected]> AuthorDate: Wed Jul 8 14:08:29 2020 +0700 JAMES-3265 IMAP FETCH reading lastUid and lastModseq should be optional When FETCH is not used with `vanished` or CONDSTORE arguments then the response returned to the IMAP clients does not need to include mailbox lastUid & lastModSeq metadata. Upon load, reading these metadata accounts for 5% of the total amount of Cassandra query time triggered by the IMAP FETCH workload on top of the Distributed James server, leading to a nice but limited performance improvement. --- .../org/apache/james/imap/processor/fetch/FetchProcessor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java index 53cdff2..901b472 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java @@ -49,9 +49,12 @@ import org.apache.james.mailbox.model.MessageResult; import org.apache.james.mailbox.model.MessageResultIterator; import org.apache.james.metrics.api.MetricFactory; import org.apache.james.util.MDCBuilder; +import org.apache.james.util.MemoizedSupplier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.github.fge.lambdas.Throwing; + import reactor.core.publisher.Flux; public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> { @@ -86,10 +89,12 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> { } final MailboxSession mailboxSession = session.getMailboxSession(); - MailboxMetaData metaData = mailbox.getMetaData(false, mailboxSession, MailboxMetaData.FetchGroup.NO_COUNT); + MemoizedSupplier<MailboxMetaData> metaData = MemoizedSupplier.of(Throwing.supplier( + () -> mailbox.getMetaData(false, mailboxSession, MailboxMetaData.FetchGroup.NO_COUNT)) + .sneakyThrow()); if (fetch.getChangedSince() != -1 || fetch.contains(Item.MODSEQ)) { // Enable CONDSTORE as this is a CONDSTORE enabling command - condstoreEnablingCommand(session, responder, metaData, true); + condstoreEnablingCommand(session, responder, metaData.get(), true); } List<MessageRange> ranges = new ArrayList<>(); @@ -106,7 +111,7 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> { if (vanished) { // TODO: From the QRESYNC RFC it seems ok to send the VANISHED responses after the FETCH Responses. // If we do so we could prolly save one mailbox access which should give use some more speed up - respondVanished(mailboxSession, mailbox, ranges, changedSince, metaData, responder); + respondVanished(mailboxSession, mailbox, ranges, changedSince, metaData.get(), responder); } processMessageRanges(session, mailbox, ranges, fetch, useUids, mailboxSession, responder); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
